in src/main/java/org/jetbrains/nativecerts/linux/LinuxTrustedCertificatesUtil.java [66:87]
private static Set<X509Certificate> tryReadFromDirectory(@NotNull Path dir) {
if (!Files.isDirectory(dir)) {
LOGGER.fine("Not reading certificates from " + dir + ": not a directory");
return Collections.emptySet();
}
LOGGER.fine("Reading certificates from " + dir + ": file does not exist");
try (Stream<Path> filesStream = Files.list(dir)) {
List<Path> paths = filesStream.collect(Collectors.toList());
Set<X509Certificate> result = new HashSet<>();
for (Path path : paths) {
if (Files.isRegularFile(path)) {
result.addAll(tryReadFromFile(path));
}
}
return result;
} catch (Throwable t) {
LOGGER.warning(renderExceptionMessage("Unable to read certificates from directory " + dir, t));
return Collections.emptySet();
}
}