[kaffe] Suggested patch: kaffe/lang/AppClassLoader.java
Helmer Krämer
hkraemer at freenet.de
Fri May 30 11:16:01 PDT 2003
On Sat, 31 May 2003 02:41:04 +0900
Ito Kazumitsu <kaz at maczuka.gcd.org> wrote:
Hi,
> 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.
I wouldn't patch the AppClassLoader, but rather something somewhere
in java.util.jar. If you don't do it there, you'll get the same
problem when trying to use such a jar with the URLClassLoader and
its subclasses (and everyone else who wants to use the manifest).
So I would try something like this, dunno whether that works,
though :(
--- java/util/jar/Manifest.java 19 Feb 2002 00:48:12 -0000 1.6
+++ java/util/jar/Manifest.java 30 May 2003 18:13:21 -0000
@@ -164,6 +164,15 @@
// Update state
switch (state) {
case ST_START:
+ /* ouch. accept manifests that have a 0x00 at the end */
+ if (c == 0x00) {
+ int t = p.read();
+ if (t == -1) {
+ throw new EOFException();
+ }
+ p.unread (t);
+ }
+
if (c == '\n') {
if (attr.size() == 0) {
continue; // initial blank line
Greetings,
Helmer
More information about the kaffe
mailing list