Hi,

2016-03-24 18:02 GMT+02:00 Johan Compagner <jcompag...@servoy.com>:
>
> Hi,
>
> we now get this exception:
>
> java.lang.StringIndexOutOfBoundsException: String index out of range: 3
>    at java.lang.String.charAt(String.java:658)
>    at
>
org.apache.catalina.loader.WebappClassLoaderBase.filter(WebappClassLoaderBase.java:2780)
>    at
>
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1253)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>    at org.mozilla.javascript.Kit.classOrNull(Kit.java:89)
>    at
>
org.mozilla.javascript.NativeJavaPackage.getPkgProperty(NativeJavaPackage.java:154)
>    at
> org.mozilla.javascript.NativeJavaPackage.get(NativeJavaPackage.java:111)
>    at
>
org.mozilla.javascript.NativeJavaTopPackage.init(NativeJavaTopPackage.java:119)
>

Check this [1]
Tomcat 8.0.33 just passed the vote [2]

Regards,
Violeta


[1] https://bz.apache.org/bugzilla/show_bug.cgi?id=58999
[2] http://marc.info/?l=tomcat-dev&m=145883995817915&w=2

>
> that is because WebappClassLoaderBase.filter() is really changed in this
> release and assumes:
>
>   } else if (name.startsWith("org")) {
>             /* 3 == length("org") */
>             ch = name.charAt(3);
>
> that when it gets "org" it can get the 4 the (position 3) char
> That bombs out now
>
> This is because NativeJavaPackage tries to load anything that it gets
> through its get method so it does try "org" until it sees somethign that
is
> a class. (so org.xxx then org.xxx.Yyy will be seen as a class)
>
> I guess that code could be written with a simple length check in that if
> above
> or write it a bit different and have something like:
>
>  } else if (isClassName && name.startsWith("org.apache.")) {
>               /* 11 == length("org.apache.") */
>               if (name.startsWith("tomcat.jdbc.", 11)) {
>                   return false;
>               }
>               if (name.startsWith("el.", 11) ||
>                   name.startsWith("catalina.", 11) ||
>                   name.startsWith("jasper.", 11) ||
>                   name.startsWith("juli.", 11) ||
>                   name.startsWith("tomcat.", 11) ||
>                   name.startsWith("naming.", 11) ||
>                   name.startsWith("coyote.", 11)) {
>                   return true;
>               }
>           } else if (!isClassName && name.startsWith("org/apache/")) {
>                 /* 11 == length("org/apache/") */
>                 if (name.startsWith("tomcat/jdbc/", 11)) {
>                     return false;
>                 }
>                 if (name.startsWith("el/", 11) ||
>                     name.startsWith("catalina/", 11) ||
>                     name.startsWith("jasper/", 11) ||
>                     name.startsWith("juli/", 11) ||
>                     name.startsWith("tomcat/", 11) ||
>                     name.startsWith("naming/", 11) ||
>                     name.startsWith("coyote/", 11)) {
>                     return true;
>                 }
>         }
>
> *that seems a bit shorter and should do the same.*
>
> --
> Johan Compagner
> Servoy

Reply via email to