]> source.dussan.org Git - poi.git/commitdiff
properly close all IO streams created in OPCPackage, see Bugzilla 48571
authorYegor Kozlov <yegor@apache.org>
Sun, 24 Jan 2010 13:26:19 +0000 (13:26 +0000)
committerYegor Kozlov <yegor@apache.org>
Sun, 24 Jan 2010 13:26:19 +0000 (13:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@902565 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/status.xml
src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java

index cea82874342653c42909ec0c572114e8ed91bb86..f8ee55fdde9fa2a8a597e7f6c2aafacb73fd16ec 100644 (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>
index e67055838d348826aa29387406f7cedd989563b5..fe2c3e279939d58e2c47b61712ff3d7ef95992d4 100644 (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();
        }
 
        /**