Summary: | An incomplete fix for the NPE bug in ZipFileZipEntrySource.java | ||
---|---|---|---|
Product: | POI | Reporter: | lianggt08 |
Component: | POI Overall | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | critical | CC: | lianggt08 |
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All |
Description
lianggt08
2012-02-14 10:18:23 UTC
I'm not sure that zipArchive should ever be null - how are you triggering this? If the method "close" is called, zipArchive will be null. After that, if the methods "getEntries()" and "getInputStream()" are called, NPE will happen at the code line 44 and 48. Please check the bug issue 51949 at https://issues.apache.org/bugzilla/show_bug.cgi?id=51949 for the method "close": public void close() throws IOException { zipArchive.close(); zipArchive = null; } Thanks. What do you expect from "getEntries()" and "getInputStream()": return null or throw a more sensible exception? I would say that instead of the NPE they should throw IllegalStateException("zip file closed"), the way java.util.ZipFile does. Does it seem the right fix for you? Yegor (In reply to comment #2) > If the method "close" is called, zipArchive will be null. After that, if the > methods "getEntries()" and "getInputStream()" are called, NPE will happen at > the code line 44 and 48. > > Please check the bug issue 51949 at > https://issues.apache.org/bugzilla/show_bug.cgi?id=51949 for the method > "close": > > > public void close() throws IOException { > zipArchive.close(); > zipArchive = null; > } > > > > Thanks. OK. Throwing an IllegalStateException("zip file closed") will be much better. Thanks. |