Fix two more places where wrong/invalid files can lead to file-handle leaks currently
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1737489 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
205055b83c
commit
e8263f9d8f
@ -429,6 +429,7 @@ public abstract class OPCPackage implements RelationshipSource, Closeable {
|
|||||||
if (this.contentTypeManager == null) {
|
if (this.contentTypeManager == null) {
|
||||||
logger.log(POILogger.WARN,
|
logger.log(POILogger.WARN,
|
||||||
"Unable to call close() on a package that hasn't been fully opened yet");
|
"Unable to call close() on a package that hasn't been fully opened yet");
|
||||||
|
revert();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,8 +247,11 @@ public final class ZipHelper {
|
|||||||
|
|
||||||
// Peek at the first few bytes to sanity check
|
// Peek at the first few bytes to sanity check
|
||||||
FileInputStream input = new FileInputStream(file);
|
FileInputStream input = new FileInputStream(file);
|
||||||
|
try {
|
||||||
verifyZipHeader(input);
|
verifyZipHeader(input);
|
||||||
|
} finally {
|
||||||
input.close();
|
input.close();
|
||||||
|
}
|
||||||
|
|
||||||
// Open as a proper zip file
|
// Open as a proper zip file
|
||||||
return new ZipSecureFile(file);
|
return new ZipSecureFile(file);
|
||||||
|
Loading…
Reference in New Issue
Block a user