use of org.sonar.process.MessageException in project sonarqube by SonarSource.
the class EsSettings method getFileNameFromPathProperty.
private String getFileNameFromPathProperty(ProcessProperties.Property processProperty) {
String processPropertyPath = props.value(processProperty.getKey());
if (processPropertyPath == null) {
throw new MessageException(processProperty.name() + " property need to be set " + "when using elastic search authentication");
}
Path path = Paths.get(processPropertyPath);
if (!path.toFile().exists()) {
throw new MessageException("Unable to configure: " + processProperty.getKey() + ". " + "File specified in [" + processPropertyPath + "] does not exist");
}
if (!path.toFile().canRead()) {
throw new MessageException("Unable to configure: " + processProperty.getKey() + ". " + "Could not get read access to [" + processPropertyPath + "]");
}
return path.getFileName().toString();
}
Aggregations