Update ClassFinder and PackageBasedActionConfigBuilder to avoid loading 
unnecessary classes in package scan, avoid spurious warnings and other benefits
-------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: WW-3234
                 URL: https://issues.apache.org/struts/browse/WW-3234
             Project: Struts 2
          Issue Type: Improvement
          Components: Plugin - Convention
    Affects Versions: 2.1.7
            Reporter: Brian Ferris


By default, the PackageBasedActionConfigBuilder used in the Convention plugin 
uses the ClassFinder utility class from XWorks to look for potential action 
classes on the classpath.  The behavior of the ClassFinder is to scan every 
.class file on the classpath and attempt to load it.  Once all classes have 
been loaded, the PackageBasedActionConfigBuilder evaluates each loaded class to 
see if it is an action (is in the right package?  does it have the proper name? 
 does it implement Action?).

While this works fine, the process of loading EVERY classes on the classpath 
can produce a ton of error messages as the ClassFinder attempts to load classes 
that potentially have unsatisfied dependencies or other issues.  While these 
are non-fatal messages, they tend to initially confuse users (like me!).  See a 
couple examples I found Googling:

http://www.mail-archive.com/[email protected]/msg85317.html
http://www.mail-archive.com/[email protected]/msg00048.html
http://article.gmane.org/gmane.comp.jakarta.struts.user/168495

I can give more justifications why this is annoying if needed, but even better, 
here's a patch to fix the issue.  It's a little tricky because it requires a 
patch to ClassFinder (which is in xworks... hopefully you guys can deal with 
that?) and to PackageBasedActionConfigBuilder.  The patch to ClassFinder allows 
specifying an optional class name filter to prevent the load of classes.  The 
patch to PackageBasedActionConfigBuilder constructs an appropriate filter from 
the various package hints specified in the class.  All together, we get the 
exact same class loading behavior without all those annoying error messages.

Thoughts?


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to