Author: rjung
Date: Mon Jan 25 14:47:05 2016
New Revision: 1726632

URL: http://svn.apache.org/viewvc?rev=1726632&view=rev
Log:
Fix class loader decision on the delegation for
class loading and resource lookup and make it
faster too.

This is the first in a series of changes in
WebappClassLoaderBase.filter().

Filtering for resources without a dot in their
name is broken due to checking for a dot.

The check was needed in older versions of
that code which did prefix comparisons.
The current code using regexps does no
longer need the check. For any class loading
or resource lookup with a dot in the name
(mostly always the case) it will only slow
down the filtering.

Modified:
    tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: 
tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java?rev=1726632&r1=1726631&r2=1726632&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java Mon 
Jan 25 14:47:05 2016
@@ -2786,21 +2786,12 @@ public abstract class WebappClassLoaderB
         if (name == null)
             return false;
 
-        // Looking up the package
-        String packageName = null;
-        int pos = name.lastIndexOf('.');
-        if (pos != -1)
-            // Package names in the filters include the last '.'
-            packageName = name.substring(0, pos + 1);
-        else
-            return false;
-
-        packageTriggersPermit.reset(packageName);
+        packageTriggersPermit.reset(name);
         if (packageTriggersPermit.lookingAt()) {
             return false;
         }
 
-        packageTriggersDeny.reset(packageName);
+        packageTriggersDeny.reset(name);
         if (packageTriggersDeny.lookingAt()) {
             return true;
         }

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1726632&r1=1726631&r2=1726632&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Jan 25 14:47:05 2016
@@ -64,6 +64,10 @@
         Correct a thread safety issue in the filtering of session attributes
         based on the implementing class name of the value object. (markt)
       </fix>
+      <fix>
+        Fix class loader decision on the delegation for class loading and
+        resource lookup and make it faster too. (rjung)
+      </fix>
     </changelog>
   </subsection>
 </section>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to