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

    https://github.com/apache/storm/pull/2566#discussion_r170418624
  
    --- Diff: storm-client/src/jvm/org/apache/storm/utils/Utils.java ---
    @@ -1505,35 +1508,36 @@ public static StormTopology 
addVersions(StormTopology topology) {
             Map<String, Object> defaultsConf = null;
             Map<String, Object> stormConf = null;
             for (String part: cp) {
    -            File f = new File(part);
    -            if (f.isDirectory()) {
    -                if (defaultsConf == null) {
    -                    defaultsConf = readConfIgnoreNotFound(yaml, new 
File(f, "defaults.yaml"));
    -                }
    -                
    -                if (stormConf == null) {
    -                    stormConf = readConfIgnoreNotFound(yaml, new File(f, 
"storm.yaml"));
    +            String wildcardSuffix = File.separator + "*";
    +            if (part.endsWith(wildcardSuffix)) {
    +                // wildcard is given
    +                // in java classpath, '*' is translated to '*.jar'
    +                File dir = new File(part.substring(0, part.length() - 
wildcardSuffix.length()));
    +                File[] jarFiles = dir.listFiles((dir1, name) -> 
name.endsWith(".jar"));
    +
    +                if (jarFiles != null) {
    --- End diff --
    
    I'm not sure. If jarFiles is null, it looks like we'll end up returning an 
empty config, so I think downstream code will probably break. If that's the 
case, I'd prefer throwing an exception here so it's obvious what went wrong. 
Whether we want to throw a custom exception or just remove the null check and 
get an NPE in the following line makes no difference to me.


---

Reply via email to