Bug 27458 - VMClassLoader.getBootPackages does not work with endorsed jars
Summary: VMClassLoader.getBootPackages does not work with endorsed jars
Status: ASSIGNED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: unspecified
: P3 major
Target Milestone: ---
Assignee: Olivier Jolly
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-06 17:19 UTC by Edwin Steiner
Modified: 2006-08-09 12:09 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2006-05-06 17:23:57


Attachments
example patch fixing the problem in CACAO's VMClassLoader.java (489 bytes, patch)
2006-05-06 17:22 UTC, Edwin Steiner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Edwin Steiner 2006-05-06 17:19:38 UTC
VMClassLoader.getBootPackages only looks at the first URL returned by
getResources. This is a problem in case this first entry is the
META-INF/INDEX.LIST of an endorsed jar instead of glibj.zip. In this
case the boot packages are not found.

The following is a patch against VMClassLoader.java of CACAO that solves
the problem by reading the package lists of all URLs returned by
getResources:

Index: src/lib/vm/reference/java/lang/VMClassLoader.java
===================================================================
--- src/lib/vm/reference/java/lang/VMClassLoader.java   (revision 4867)
+++ src/lib/vm/reference/java/lang/VMClassLoader.java   (working copy)
@@ -265,12 +265,15 @@
    */
   private static String[] getBootPackages()
   {
-    URL indexList = getResource("META-INF/INDEX.LIST");
-    if (indexList != null)
-      {
+       Enumeration urls = getResources("META-INF/INDEX.LIST");
+       Set packageSet = new HashSet();
+
+    while (urls.hasMoreElements())
+         {
+        URL indexList = (URL) urls.nextElement();
+
         try
           {
-            Set packageSet = new HashSet();
             String line;
             int lineToSkip = 3;
             BufferedReader reader = new BufferedReader(
@@ -289,15 +292,12 @@
                   lineToSkip--;
               }
             reader.close();
-            return (String[]) packageSet.toArray(new String[packageSet.size()]);
           }
         catch (IOException e)
           {
-            return new String[0];
           }
-      }
-    else
-      return new String[0];
+         }
+       return (String[]) packageSet.toArray(new String[packageSet.size()]);
   }
Comment 1 Edwin Steiner 2006-05-06 17:22:36 UTC
Created attachment 11390 [details]
example patch fixing the problem in CACAO's VMClassLoader.java
Comment 2 Audrius Meškauskas 2006-08-09 06:51:14 UTC
This prevents the work of Classpath with JOnAS J2EE server. GNU Classpath CORBA classes cannot load the plugged in JacORB implementation because the JacORB classes are in the endorsed jar. Setting severity to major, JOnAS is an important application and this bug is a blocker for it.

This was discussed at http://forge.objectweb.org/tracker/index.php?func=detail&aid=305915&group_id=26&atid=100026
on the ObjectWeb.
Comment 3 Olivier Jolly 2006-08-09 12:09:24 UTC
I am not sure the JacORB bug is related to this one.
The current bug is about the fact that META-INF/INDEX.LIST is not found if the boot classpath contains a META-INF/INDEX.LIST entry which is not the one of the glibj.zip. Not finding this entry means that the ClassLoader.getPackage(String) returns null for core packages (like "java.lang" e.g.).
I can eventually handle this bug this week end, but I'm not certain it is the one which is linked to the failure or JacORB.