poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 60128] File left open in ZipPackage when InvalidFormatException are raised
Date Wed, 14 Sep 2016 13:07:25 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=60128

--- Comment #2 from Javen O'Neal <onealj@apache.org> ---
I found a couple spots where opened files were not closed when raising
exceptions. The one mentioned in comment 0, caused by OPCPackage.open not
closing the ZipPackage when pack.getParts() failed is fixed [1].
I found some other cases in the ZipPackage constructors that could fail without
cleaning up their resources. [2]

I committed these changes in r1760702. They will likely be included in the POI
3.15 final release.

This commit is in desperate need of cleanup for someone who knows what they're
doing with Java exception handling. This is admittedly beyond my skills.

Thanks for the test file, code, and stack trace. Got any ideas how we can check
for unclosed resources in our unit tests? In TestZipPackage, we're using
assertTrue(tmpFile.delete()) [3]

[1] OPCPackage.java
https://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java?r1=1760702&r2=1760701&pathrev=1760702
[2] ZipPackage.java
https://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java?r1=1760702&r2=1760701&pathrev=1760702
[3] TestZipPackage.java
https://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestZipPackage.java?r1=1760702&r2=1760701&pathrev=1760702

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message