diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2014-05-14 21:14:16 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2014-05-14 21:14:16 +0000 |
commit | 95712b5661f305ba91783d0d2d36fcd7caa6ba65 (patch) | |
tree | 568212573f7d2da9a98dcc89d450a1aed8f9ee33 /src/ooxml/java/org/apache/poi/openxml4j | |
parent | 8a1411bda1eb74d92fd04ac5a861489812c64381 (diff) | |
download | poi-95712b5661f305ba91783d0d2d36fcd7caa6ba65.tar.gz poi-95712b5661f305ba91783d0d2d36fcd7caa6ba65.zip |
Bug 56468 - Writing a workbook more than once corrupts the file
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1594721 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache/poi/openxml4j')
-rw-r--r-- | src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java | 5 | ||||
-rw-r--r-- | src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java index 5cc894f7de..e210be6f67 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java @@ -599,7 +599,10 @@ public abstract class OPCPackage implements RelationshipSource, Closeable { throw new IllegalArgumentException("relationshipType"); ArrayList<PackagePart> retArr = new ArrayList<PackagePart>(); for (PackageRelationship rel : getRelationshipsByType(relationshipType)) { - retArr.add(getPart(rel)); + PackagePart part = getPart(rel); + if (part != null) { + retArr.add(part); + } } return retArr; } diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java index 9ac8fd17fa..a352a8d1f6 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java @@ -37,7 +37,6 @@ import org.apache.poi.openxml4j.opc.internal.MemoryPackagePart; import org.apache.poi.openxml4j.opc.internal.PartMarshaller; import org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager; import org.apache.poi.openxml4j.opc.internal.ZipHelper; -import org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller; import org.apache.poi.openxml4j.opc.internal.marshallers.ZipPartMarshaller; import org.apache.poi.openxml4j.util.ZipEntrySource; import org.apache.poi.openxml4j.util.ZipFileZipEntrySource; @@ -444,9 +443,8 @@ public final class ZipPackage extends Package { this.getPartsByRelationshipType(PackageRelationshipTypes.CORE_PROPERTIES_ECMA376).size() == 0 ) { logger.log(POILogger.DEBUG,"Save core properties part"); - // We have to save the core properties part ... - new ZipPackagePropertiesMarshaller().marshall( - this.packageProperties, zos); + // Add core properties to part list ... + addPackagePart(this.packageProperties); // ... and to add its relationship ... this.relationships.addRelationship(this.packageProperties .getPartName().getURI(), TargetMode.INTERNAL, |