]> source.dussan.org Git - poi.git/commitdiff
ExtractorFactory: Try to close resources also on Errors to avoid keeping files open...
authorDominik Stadler <centic@apache.org>
Fri, 21 Jul 2017 18:19:11 +0000 (18:19 +0000)
committerDominik Stadler <centic@apache.org>
Fri, 21 Jul 2017 18:19:11 +0000 (18:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1802630 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java

index 94a3fc023dd2be02a12be6acd9bc6e13c95f743c..cfe37a03be6caf4b1eb09f1e6c031662c1acc615 100644 (file)
@@ -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;
         }
      }
 
@@ -283,6 +287,11 @@ public class ExtractorFactory {
             // 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;
         }
     }