This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
RE: bug in ZipInputStream
- From: "Erik Poupaert" <erik dot poupaert at chello dot be>
- To: <tromey at redhat dot com>
- Cc: <java at gcc dot gnu dot org>
- Date: Mon, 16 Dec 2002 02:28:36 +0100
- Subject: RE: bug in ZipInputStream
>>>>> 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
FileInputStream("xml-apis.zip"));
while(zipInputStream.available()==1)
{
ZipEntry zipEntry=zipInputStream.getNextEntry();
if(zipEntry!=null)
{
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/
false META-INF/MANIFEST.MF
"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.