You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2017/05/03 16:05:07 UTC

[Bug 61065] New: ImportHandler is using the wrong key to cache resolved classes

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: jagoba@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61065] ImportHandler is using the wrong key to cache resolved classes

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61065

Violeta Georgieva <vi...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Violeta Georgieva <vi...@apache.org> ---
Hi,

Thanks for the report.
The fix was committed in:
- trunk for 9.0.0.M21 onwards
- 8.5.x for 8.5.15 onwards
- 8.0.x for 8.0.44 onwards

Regards,
Violeta

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