bug in ZipInputStream

Erik Poupaert erik.poupaert@chello.be
Sun Dec 15 17:30:00 GMT 2002

>>>>> If you have a small, self-contained example program, go ahead and
submit it.  I can at least try it out against 3.3 and see whether it
is fixed.

I'm using gcj-3.2-20021210-1.tar.gz onder minGW, win2K. I just took the
xml-apis.jar file from the Ant distribution, renamed it to xml-apis.zip and
tried the following program:

The following program doesn't work:

import java.util.zip.*;
import java.io.*;

public class TestZipInputStream
	public static void main(String args[]) throws Exception
		ZipInputStream zipInputStream=new ZipInputStream(new
			ZipEntry zipEntry=zipInputStream.getNextEntry();
				System.out.println(zipEntry.isDirectory() + " " + zipEntry.getName());

If I compile it with javac, it works. With gcj, it doesn't. I get:
true META-INF/
 "Exception in thread "main" java.util.zip.ZipException: bad/missing magic
number at end of .zip entry

He reads correctly the directory entries at the beginning of the zipfile,
but as soon as a non-directory entry shows up, it fails.

By the way, I've tried it on a zip with only directory entries, and that
works fine.

More information about the Java mailing list