mirror of https://github.com/apache/poi.git
ExtractorFactory: Try to close resources also on Errors to avoid keeping files open too long
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1802630 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d687e94d58
commit
94b028eae0
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue