harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [drlvm] The Return of the Hidden Classloader, Part II
Date Thu, 08 Feb 2007 12:51:56 GMT
Geir Magnusson Jr. wrote:
> So running classlib tests w/ DRLVM w/ the change to URLClassloader works
> *except* I have one consistent problem.  I get 68 errors, all the same :
> 
> java.util.MissingResourceException: Could not load data
> com.ibm.icu.impl.data.BreakIteratorRules
> ...
> 
> Now, we do hide the bootloader's "com.ibm.icu.", but I think all is well
> there because it's only one single class we're having a problem with. 
> Does anyone have any insight why this one class is problematic?

Do you see who is asking for the load? i.e. by setting a breakpoint
where you throw the CNF exception, then find it's classloader etc...

> The impl module comments for brevity here looks like this :
> 
>    protected synchronized Class<?> loadClass(String className,
>             boolean resolveClass) throws ClassNotFoundException {
> 
>     if (this == getSystemClassLoader()) {
> 
>             int index = className.lastIndexOf('.');
> 
>             if (index > 0) {
>                 String pkgName = className.substring(0, index + 1);
> 
>                 if (pkgName.startsWith("java.") ||
>                         pkgName.startsWith("javax.") ||
>                         pkgName.startsWith("org.ietf.jgss.") ||
>                         pkgName.startsWith("org.omg.") ||
>                         pkgName.startsWith("org.w3c.") ||
>                         pkgName.startsWith("org.xml.sax.")) {
>                     return super.loadClass(className, resolveClass);
>                 }
> 
>                 /* if we get this far, use list of verboten */
> 
>                 String[] verboten = VMUtil.getAppDeniedSysloaderPackages();

The answer isn't going to change at runtime, you could pull it out of
the loop since we want loads to be as fast as possible.

>                 for (String pkg : verboten) {
>                     if (pkgName.startsWith(pkg)) {
>                         throw new ClassNotFoundException();

Add className arg to show which is being denied.

>                     }
>                 }
>             }
>         }
>         return super.loadClass(className, resolveClass);
>     }
> 
> 
> Where VMUtil.getAppDeniedSysloaderPackages()  (a name I will change
> before checkin) returns :
> 
> deniedList =  {
>         "mx4j.",
>         "org.apache.bcel.",
>         "com.ibm.icu.",
>         "com.ibm.icu4jni",
>         "org.apache.xalan",
>         "org.apache.xml",
>         "org.apache.xpath"};

Consider adding all the trailing periods, though in these cases you are
probably safe.

Regards,
Tim

Mime
View raw message