Bug 51949

Summary: ZipFileZipEntrySource - NPE on double close
Product: POI Reporter: Torsten Krah <tkrah>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P2    
Version: 3.8-dev   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

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.