Github user mattyb149 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/907#discussion_r75730484
  
    --- Diff: 
nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/classloader/ClassLoaderUtils.java
 ---
    @@ -21,45 +21,59 @@
     import java.net.MalformedURLException;
     import java.net.URL;
     import java.net.URLClassLoader;
    +import java.util.Arrays;
     import java.util.LinkedList;
     import java.util.List;
    +import java.util.stream.Collectors;
     
     public class ClassLoaderUtils {
     
         public static ClassLoader getCustomClassLoader(String modulePath, 
ClassLoader parentClassLoader, FilenameFilter filenameFilter) throws 
MalformedURLException {
    -        String[] modules = modulePath != null? modulePath.split(",") : 
null;
    -        URL[] classpaths = getURLsForClasspath(modules,filenameFilter);
    -        return createModuleClassLoader(classpaths,parentClassLoader);
    +        // Split and trim the module path(s)
    +        List<String> modules = (modulePath == null)
    +                ? null
    +                : Arrays.stream(modulePath.split(",")).map((path) -> path 
== null ? null : path.trim()).filter((item) -> item != 
null).collect(Collectors.toList());
    --- End diff --
    
    Good point. I changed to use yours (replacing some things with method 
references) and added a unit test around the errors you found.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to