You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2016/04/02 13:01:56 UTC

svn commit: r1737489 - in /poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc: OPCPackage.java internal/ZipHelper.java

Author: centic
Date: Sat Apr  2 11:01:56 2016
New Revision: 1737489

URL: http://svn.apache.org/viewvc?rev=1737489&view=rev
Log:
Fix two more places where wrong/invalid files can lead to file-handle leaks currently

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java?rev=1737489&r1=1737488&r2=1737489&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java Sat Apr  2 11:01:56 2016
@@ -429,6 +429,7 @@ public abstract class OPCPackage impleme
 		if (this.contentTypeManager == null) {
 		    logger.log(POILogger.WARN,
 		            "Unable to call close() on a package that hasn't been fully opened yet");
+			revert();
 		    return;
 		}
 

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java?rev=1737489&r1=1737488&r2=1737489&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java Sat Apr  2 11:01:56 2016
@@ -247,8 +247,11 @@ public final class ZipHelper {
         
         // Peek at the first few bytes to sanity check
         FileInputStream input = new FileInputStream(file);
-        verifyZipHeader(input);
-        input.close();
+        try {
+            verifyZipHeader(input);
+        } finally {
+            input.close();
+        }
 
         // Open as a proper zip file
         return new ZipSecureFile(file);



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