poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1769220 - in /poi: site/src/documentation/content/xdocs/ trunk/src/integrationtest/org/apache/poi/ trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ trunk/src/ooxml/testcases/org/apache/poi/xslf/ trunk/test-data/slideshow/
Date Thu, 10 Nov 2016 22:54:07 GMT
Author: kiwiwings
Date: Thu Nov 10 22:54:07 2016
New Revision: 1769220

URL: http://svn.apache.org/viewvc?rev=1769220&view=rev
Log:
Bug 59273 - Unable to create pptx file by potx file using Apache POI

Added:
    poi/trunk/test-data/slideshow/bug59273.potx   (with props)
Modified:
    poi/site/src/documentation/content/xdocs/status.xml
    poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java

Modified: poi/site/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/status.xml?rev=1769220&r1=1769219&r2=1769220&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/status.xml (original)
+++ poi/site/src/documentation/content/xdocs/status.xml Thu Nov 10 22:54:07 2016
@@ -64,6 +64,7 @@
         <summary-item>Examples to encrypt temp files in SXSSF</summary-item>
       </summary>
       <actions>
+        <action dev="PD" type="add" fixes-bug="59273" module="XSLF,OOXML">Unable to
create pptx file by potx file using Apache POI</action>
         <action dev="PD" type="add" fixes-bug="github-42" module="SS Common">Add setFormattingRanges()
to interface ConditionalFormatting</action>
         <action dev="PD" type="add" fixes-bug="60321" module="SXSSF examples">Examples:
encrypt temp files created when unzipping or zipping an SXSSF workbook</action>
         <action dev="PD" type="fix" fixes-bug="60337" module="XWPF">Table row isRepeatingHeader
and isCantSplit throw NPE</action>

Modified: poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java?rev=1769220&r1=1769219&r2=1769220&view=diff
==============================================================================
--- poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java (original)
+++ poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java Thu Nov 10 22:54:07 2016
@@ -91,6 +91,7 @@ public class TestAllFiles {
         HANDLERS.put(".ppsm", new XSLFFileHandler());
         HANDLERS.put(".ppsx", new XSLFFileHandler());
         HANDLERS.put(".thmx", new XSLFFileHandler());
+        HANDLERS.put(".potx", new XSLFFileHandler());
 
         // Outlook
         HANDLERS.put(".msg", new HSMFFileHandler());

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java?rev=1769220&r1=1769219&r2=1769220&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java Thu Nov 10 22:54:07
2016
@@ -1654,7 +1654,13 @@ public abstract class OPCPackage impleme
             if (packagePart.getContentType().equals(oldContentType)) {
                 PackagePartName partName = packagePart.getPartName();
                 contentTypeManager.addContentType(partName, newContentType);
+                try {
+                    packagePart.setContentType(newContentType);
+                } catch (InvalidFormatException e) {
+                    throw new OpenXML4JRuntimeException("invalid content type - "+newContentType,
e);
+                }
                 success = true;
+                this.isDirty = true;
             }
         }
         return success;

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java?rev=1769220&r1=1769219&r2=1769220&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java Thu Nov 10 22:54:07
2016
@@ -31,10 +31,7 @@ import java.awt.geom.AffineTransform;
 import java.awt.geom.Rectangle2D;
 import java.awt.image.BufferedImage;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.OutputStream;
 import java.net.URI;
 import java.util.Collection;
 
@@ -43,6 +40,7 @@ import javax.imageio.ImageIO;
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.POIXMLDocumentPart;
 import org.apache.poi.POIXMLDocumentPart.RelationPart;
+import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.sl.draw.DrawPaint;
 import org.apache.poi.sl.usermodel.PaintStyle;
 import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
@@ -52,8 +50,6 @@ import org.apache.poi.sl.usermodel.Pictu
 import org.apache.poi.sl.usermodel.ShapeType;
 import org.apache.poi.sl.usermodel.VerticalAlignment;
 import org.apache.poi.xslf.extractor.XSLFPowerPointExtractor;
-import org.apache.poi.xslf.usermodel.DrawingParagraph;
-import org.apache.poi.xslf.usermodel.DrawingTextBody;
 import org.apache.poi.xslf.usermodel.XMLSlideShow;
 import org.apache.poi.xslf.usermodel.XSLFAutoShape;
 import org.apache.poi.xslf.usermodel.XSLFHyperlink;
@@ -541,4 +537,23 @@ public class TestXSLFBugs {
         newPptx.close();
         srcPptx.close();
     }
+
+    @Test
+    public void bug59273() throws IOException {
+        XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("bug59273.potx");
+        ppt.getPackage().replaceContentType(
+            XSLFRelation.PRESENTATIONML_TEMPLATE.getContentType(), 
+            XSLFRelation.MAIN.getContentType()
+        );
+
+        XMLSlideShow rwPptx = XSLFTestDataSamples.writeOutAndReadBack(ppt);
+        OPCPackage pkg = rwPptx.getPackage();
+        int size = pkg.getPartsByContentType(XSLFRelation.MAIN.getContentType()).size();
+        assertEquals(1, size);
+        size = pkg.getPartsByContentType(XSLFRelation.PRESENTATIONML_TEMPLATE.getContentType()).size();
+        assertEquals(0, size);
+        
+        rwPptx.close();
+        ppt.close();
+    }
 }

Added: poi/trunk/test-data/slideshow/bug59273.potx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/slideshow/bug59273.potx?rev=1769220&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/slideshow/bug59273.potx
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message