in src/main/java/org/opensearch/commons/rest/SecureRestClientBuilder.java [256:285]
private String resolve(final String originalFile, final Path configPath) {
String path = null;
if (originalFile != null && originalFile.length() > 0) {
path = configPath.resolve(originalFile).toAbsolutePath().toString();
log.debug("Resolved {} to {} against {}", originalFile, path, configPath.toAbsolutePath().toString());
}
if (path == null || path.length() == 0) {
throw new OpenSearchException("Empty file path for " + originalFile);
}
if (Files.isDirectory(Paths.get(path), LinkOption.NOFOLLOW_LINKS)) {
throw new OpenSearchException("Is a directory: " + path + " Expected a file for " + originalFile);
}
if (!Files.isReadable(Paths.get(path))) {
throw new OpenSearchException(
"Unable to read "
+ path
+ " ("
+ Paths.get(path)
+ "). Please make sure this files exists and is readable regarding to permissions. Property: "
+ originalFile
);
}
if ("".equals(path)) {
path = null;
}
return path;
}