2016-03-11 19:54 GMT+03:00  <ma...@apache.org>:
> Author: markt
> Date: Fri Mar 11 16:54:04 2016
> New Revision: 1734592
>
> URL: http://svn.apache.org/viewvc?rev=1734592&view=rev
> Log:
> Speed up ImportHandler some more.
>
> Modified:
>     tomcat/trunk/java/javax/el/ImportHandler.java
>
> Modified: tomcat/trunk/java/javax/el/ImportHandler.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/ImportHandler.java?rev=1734592&r1=1734591&r2=1734592&view=diff
> ==============================================================================
> --- tomcat/trunk/java/javax/el/ImportHandler.java (original)
> +++ tomcat/trunk/java/javax/el/ImportHandler.java Fri Mar 11 16:54:04 2016
> @@ -191,8 +191,23 @@ public class ImportHandler {
>      private Class<?> findClass(String name, boolean throwException) {
>          Class<?> clazz;
>          ClassLoader cl = Thread.currentThread().getContextClassLoader();
> +        String path = name.replace(".", "/");

You wanted to call replace(char, char) above, but you are using
(String, String) version using regexps.

The dot regexp matches any character...

>          try {
> -             clazz = cl.loadClass(name);
> +            /* Given that findClass() has to be called for every imported
> +             * package and that getResource() is a lot faster then 
> loadClass()
> +             * for resources that don't exist, the overhead of the 
> getResource()
> +             * for the case where the class does exist is a lot less than the
> +             * overhead we save by not calling loadClass().
> +             */
> +            if (cl.getResource(path) == null) {
> +                return null;
> +            }
> +        } catch (ClassCircularityError cce) {
> +            // May happen under a security manager. Ignore it and try loading
> +            // the class normally.
> +        }
> +        try {
> +            clazz = cl.loadClass(name);
>          } catch (ClassNotFoundException e) {
>              return null;
>          }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>

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

Reply via email to