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

    https://github.com/apache/metron/pull/985#discussion_r180576221
  
    --- Diff: 
metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/dsl/functions/resolver/ClasspathFunctionResolver.java
 ---
    @@ -254,18 +266,24 @@ public void initialize(Context context) {
         Set<String> classes = new HashSet<>();
         Set<Class<? extends StellarFunction>> ret = new HashSet<>();
         for(ClassLoader cl : cls) {
    -      for(Class<?> c : ClassIndex.getAnnotated(Stellar.class, cl)) {
    -        LOG.debug("{}: Found class: {}", cl.getClass().getCanonicalName(), 
c.getCanonicalName());
    -        boolean isAssignable = StellarFunction.class.isAssignableFrom(c);
    -        boolean isFiltered = filterBuilder.apply(c.getCanonicalName());
    -        if( isAssignable && isFiltered ) {
    -          String className = c.getName();
    -          if(!classes.contains(className)) {
    -            LOG.debug("{}: Added class: {}", 
cl.getClass().getCanonicalName(), className);
    -            ret.add((Class<? extends StellarFunction>) c);
    -            classes.add(className);
    +      for(Class<?> c : getStellarClasses(cl)) {
    +        try {
    +          LOG.debug("{}: Found class: {}", 
cl.getClass().getCanonicalName(), c.getCanonicalName());
    +          if (includeClass(c, filterBuilder)) {
    +            String className = c.getName();
    +            if (!classes.contains(className)) {
    +              LOG.debug("{}: Added class: {}", 
cl.getClass().getCanonicalName(), className);
    +              ret.add((Class<? extends StellarFunction>) c);
    +              classes.add(className);
    +            }
               }
             }
    +        catch(Error le) {
    +          //we have had some error loading a stellar function.  This could 
mean that
    +          //the classpath is unstable (e.g. old copies of jars are on the 
classpath).
    +          LOG.error("Skipping class: " + le.getMessage()
    --- End diff --
    
    The exception message might not always contain the class name.  We should 
explicitly log the class name, like we do in the debug statement on line 271.


---

Reply via email to