properly close all IO streams created in OPCPackage, see Bugzilla 48571

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@902565 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2010-01-24 13:26:19 +00:00
parent 76a0ce511b
commit d49e83fe92
2 changed files with 6 additions and 1 deletions

View File

@ -34,6 +34,7 @@
<changes>
<release version="3.7-SNAPSHOT" date="2010-??-??">
<action dev="POI-DEVELOPERS" type="fix">48571 - properly close all IO streams created in OPCPackage</action>
<action dev="POI-DEVELOPERS" type="fix">48572 - always copy all declared inner classes and interfaces when generating poi-ooxml-schemas</action>
<action dev="POI-DEVELOPERS" type="add">Low Level record support for the ExtRst (phonetic text) part of Unicode Strings. No usermodel access to it as yet though.</action>
<action dev="POI-DEVELOPERS" type="fix">record.UnicodeString has moved to record.common.UnicodeString, to live with the other record-part classes, as it isn't a full record.</action>

View File

@ -367,6 +367,7 @@ public abstract class OPCPackage implements RelationshipSource {
}
} else if (this.output != null) {
save(this.output);
output.close();
}
} finally {
l.writeLock().unlock();
@ -433,8 +434,10 @@ public abstract class OPCPackage implements RelationshipSource {
PackageRelationshipTypes.THUMBNAIL);
// Copy file data to the newly created part
StreamHelper.copyStream(new FileInputStream(path), thumbnailPart
FileInputStream is = new FileInputStream(path);
StreamHelper.copyStream(is, thumbnailPart
.getOutputStream());
is.close();
}
/**
@ -1302,6 +1305,7 @@ public abstract class OPCPackage implements RelationshipSource {
throw new IOException(e.getLocalizedMessage());
}
this.save(fos);
fos.close();
}
/**