Here is the getZipEntry
method (as of 1.7.0_10):
private ZipEntry getZipEntry(String name, long jzentry) {
ZipEntry e = new ZipEntry();
e.flag = getEntryFlag(jzentry); // get the flag first
if (name != null) {
e.name = name;
} else {
byte[] bname = getEntryBytes(jzentry, JZENTRY_NAME);
if (!zc.isUTF8() && (e.flag & EFS) != 0) {
e.name = zc.toStringUTF8(bname, bname.length);
} else {
e.name = zc.toString(bname, bname.length); // Line 529
}
}
/* snip */
return e;
}
The only reason a NullPointerException
would be thrown on this line would be if e
, zc
, or bname
were null
.
e
cannot be null
because it is clearly instantiated in this method.
zc
cannot be null
:
public ZipFile(File file, int mode, Charset charset) throws IOException
{
/* snip */
this.zc = ZipCoder.get(charset);
/* snip */
}
static ZipCoder get(Charset charset) {
return new ZipCoder(charset);
}
Which means that bname
must be null
, which is going to be pretty hard to debug. getEntryBytes
is a native
method:
private static native byte[] getEntryBytes(long jzentry, int type);
This is how I would proceed:
- Figure out if it's that particular zip file or all zip files. If it's that particular zip file, try remaking it.
- Update your version of Java, it's possible that there was a bug with
getEntryBytes
that was fixed - Submit a bug report to Oracle