Bug 51949 - ZipFileZipEntrySource - NPE on double close
Summary: ZipFileZipEntrySource - NPE on double close
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.8-dev
Hardware: PC Linux
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-04 13:19 UTC by Torsten Krah
Modified: 2011-10-05 21:29 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Torsten Krah 2011-10-04 13:19:22 UTC
ZipFileZipEntrySource.close:

	public void close() throws IOException {
		zipArchive.close();
		zipArchive = null;
	}

If close is called twice, this will result in an NPE. Calling close more than once should not fail, checking for null will prevent this.

Tested with poi 3.8-beta4 used in Tika-0.10.

StackTrace:

java.lang.NullPointerException: null
	at org.apache.poi.openxml4j.util.ZipFileZipEntrySource.close(ZipFileZipEntrySource.java:37) ~[poi-ooxml-3.8-beta4.jar:3.8-beta4]
	at org.apache.poi.openxml4j.opc.ZipPackage.revertImpl(ZipPackage.java:344) ~[poi-ooxml-3.8-beta4.jar:3.8-beta4]
	at org.apache.poi.openxml4j.opc.OPCPackage.revert(OPCPackage.java:396) ~[poi-ooxml-3.8-beta4.jar:3.8-beta4]
	at org.apache.poi.openxml4j.opc.OPCPackage.close(OPCPackage.java:360) ~[poi-ooxml-3.8-beta4.jar:3.8-beta4]
Comment 1 Nick Burch 2011-10-05 21:29:42 UTC
Fixed in r1179452.