Author: centic
Date: Fri Jul 21 18:19:11 2017
New Revision: 1802630

URL: http://svn.apache.org/viewvc?rev=1802630&view=rev
Log:
ExtractorFactory: Try to close resources also on Errors to avoid keeping files 
open too long

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java?rev=1802630&r1=1802629&r2=1802630&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java 
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java Fri 
Jul 21 18:19:11 2017
@@ -167,6 +167,10 @@ public class ExtractorFactory {
             // ensure file-handle release
             IOUtils.closeQuietly(fs);
             throw e;
+        } catch (Error e) {
+            // ensure file-handle release
+            IOUtils.closeQuietly(fs);
+            throw e;
         }
      }
 
@@ -282,6 +286,11 @@ public class ExtractorFactory {
             // ensure that we close the package again if there is an error 
opening it, however
             // we need to revert the package to not re-write the file via 
close(), which is very likely not wanted for a TextExtractor!
             pkg.revert();
+            throw e;
+        } catch (Error e) {
+            // ensure that we close the package again if there is an error 
opening it, however
+            // we need to revert the package to not re-write the file via 
close(), which is very likely not wanted for a TextExtractor!
+            pkg.revert();
             throw e;
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to