This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
[Bug] ZipFile.entries() returns null for bad zip-file
- From: Martin Egholm Nielsen <martin at egholm-nielsen dot dk>
- To: java at gcc dot gnu dot org
- Date: Wed, 18 Oct 2006 11:50:09 +0200
- Subject: [Bug] ZipFile.entries() returns null for bad zip-file
Hi there,
Not knowing if this bug has been fixed, or is a bug at all - maybe it's
a feature born from poor method specification.
Nevertheless, invoking "ZipFile.entries()" on a ZipFile-instance
representing a corrupt zip-file (any file not being a valid zip-file),
returns null, whereas I would expect an empty enumeration instead...
This is with my ancient 3.4.5 libgcj, however searching bugzilla didn't
reveal an existing report for this (could be a result from merging the
bug-database between Classpath and GCJ?!)
--- 8< 8< 8< ---
import java.io.IOException;
import java.util.zip.ZipFile;
public class Provoke
{
public static void main(String[] args) throws IOException
{
ZipFile zf = new ZipFile("badfile.zip");
System.out.println("entries: " + zf.entries());
} // main
} // Provoke