https://bz.apache.org/bugzilla/show_bug.cgi?id=61065

            Bug ID: 61065
           Summary: ImportHandler is using the wrong key to cache resolved
                    classes
           Product: Tomcat 8
           Version: 8.0.17
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: EL
          Assignee: dev@tomcat.apache.org
          Reporter: jag...@arima.eu
  Target Milestone: ----

The method resolveClass from ImportHandler class uses a Map to cache the
classes it resolves using their simple name as key.

  Class<?> result = clazzes.get(name);

It has two methods to resolve a class. 
If we use the package name to import our class (my.package.*), it stores it in
the cache using the simple name (correct):

  clazzes.put(name, result);
  //
http://svn.apache.org/viewvc/tomcat/tc8.0.x/tags/TOMCAT_8_0_16/java/javax/el/ImportHandler.java?revision=1680308&view=markup#l180

But when we import the class in the jsp (my.package.Class), it stores it using
its full class name (incorrect):

  clazzes.put(className, clazz);
  //
http://svn.apache.org/viewvc/tomcat/tc8.0.x/tags/TOMCAT_8_0_16/java/javax/el/ImportHandler.java?revision=1680308&view=markup#l160

Classes resolved like this are always a miss in the cache.

So, when importing packages (<%@ page import="my.package.*" %>) the cache will
work as expected.
But if we import the class (<%@ page import="my.package.Class" %>) we will
always get a miss on the cache.

You can find this problem in versions 8.0.16 and up.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to