[kaffe] Suggested patch: kaffe/lang/AppClassLoader.java

Ito Kazumitsu kaz@maczuka.gcd.org
Fri May 30 10:39:01 2003


I suggest the patch attached below should be applied,  but am not brave
enough to do it without hearing your opinions.

Background:
Some implementation of jar produces a jar file whose MANIFEST.MF is broken.
For example, jar 0.92-gcc that comes with GCC of cygwin makes a MANIFEST.MF
which has a byte 0x00 at the end of the file.  When we try to load a class
file from such a jar file, ClassNotFoundException is thrown.  

IMHO, such jar implementation is to blame,  but such bad jar files could
be used without problem until recently.

--- kaffe/lang/AppClassLoader.java.orig	Thu May 29 01:10:46 2003
+++ kaffe/lang/AppClassLoader.java	Fri May 30 22:57:24 2003
@@ -139,7 +139,13 @@
 
 				String pkgName = PackageHelper.getPackageName(ret);
 				if (getPackage(pkgName) == null) {
-					Manifest mf = jar.getManifest();
+					Manifest mf;
+					try {
+						mf = jar.getManifest();
+					}
+					catch (IOException _) {
+						mf = null;
+					}
 
 					if (mf == null) {
 						definePackage(pkgName, null, null, null, null, null, null, null);