pnowojski commented on a change in pull request #8038: [FLINK-11953] Introduce Plugin/Loading system and integrate it with FileSystem URL: https://github.com/apache/flink/pull/8038#discussion_r273133237
########## File path: flink-core/src/main/java/org/apache/flink/core/plugin/DirectoryBasedPluginFinder.java ########## @@ -78,19 +78,17 @@ public DirectoryBasedPluginDescriptorsFactory(Path pluginsRootDir) { private Optional<PluginDescriptor> createPluginDescriptorForSubDirectory(Path subDirectory) { Optional<URL[]> jarURLsFromDirectory = createJarURLsFromDirectory(subDirectory); - if (jarURLsFromDirectory.isPresent()) { - URL[] urls = jarURLsFromDirectory.get(); - // we sort the urls for the benefit of having a stable/reproducible order of jars. - Arrays.sort(urls, Comparator.comparing(URL::toString)); - //TODO: This class could be extended to parse exclude-pattern from a optional text files in the plugin directories. - return Optional.of( - new PluginDescriptor( - subDirectory.getFileName().toString(), - urls, - new String[0])); - } else { - return Optional.empty(); - } + return jarURLsFromDirectory + .map((URL[] urls) -> { + Arrays.sort(urls, Comparator.comparing(URL::toString)); + //TODO: This class could be extended to parse exclude-pattern from a optional text files in the plugin directories. + return Optional.of( + new PluginDescriptor( + subDirectory.getFileName().toString(), + urls, + new String[0])); + }) + .orElse(Optional.empty()); Review comment: I think you could drop `.orElse(...)` line. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services