You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2018/11/20 14:15:14 UTC

svn commit: r1847004 - in /poi/trunk: src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java test-data/slideshow/missing-blip-fill.pptx

Author: fanningpj
Date: Tue Nov 20 14:15:14 2018
New Revision: 1847004

URL: http://svn.apache.org/viewvc?rev=1847004&view=rev
Log:
[bug-62929] add null check for blip fill. Thanks to Mate Borcsok

Added:
    poi/trunk/test-data/slideshow/missing-blip-fill.pptx   (with props)
Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java?rev=1847004&r1=1847003&r2=1847004&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java Tue Nov 20 14:15:14 2018
@@ -170,16 +170,25 @@ public class XSLFPictureShape extends XS
     
     @SuppressWarnings("WeakerAccess")
     protected String getBlipLink(){
-        String link = getBlip().getLink();
-        if (link.isEmpty()) return null;
-        return link;
+        CTBlip blip = getBlip();
+        if (blip != null) {
+            String link = blip.getLink();
+            if (link.isEmpty()) return null;
+        return link;} else {
+            return null;
+        }
     }
 
     @SuppressWarnings("WeakerAccess")
     protected String getBlipId(){
-        String id = getBlip().getEmbed();
-        if (id.isEmpty()) return null;
-        return id;
+        CTBlip blip = getBlip();
+        if (blip != null) {
+            String id = getBlip().getEmbed();
+            if (id.isEmpty()) return null;
+            return id;
+        } else {
+            return null;
+        }
     }
 
     @Override

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=1847004&r1=1847003&r2=1847004&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 Tue Nov 20 14:15:14 2018
@@ -17,12 +17,7 @@
 package org.apache.poi.xslf;
 
 import static org.apache.poi.POITestCase.assertContains;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
 import java.awt.Color;
 import java.awt.Dimension;
@@ -94,6 +89,25 @@ public class TestXSLFBugs {
     private static final POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 
     @Test
+    public void bug62929() throws Exception {
+        try(XMLSlideShow ss1 = XSLFTestDataSamples.openSampleDocument("missing-blip-fill.pptx")) {
+            assertEquals(1, ss1.getSlides().size());
+
+            XSLFSlide slide = ss1.getSlides().get(0);
+
+            assertEquals(slide.getShapes().size(), 1);
+
+            XSLFPictureShape picture = (XSLFPictureShape)slide.getShapes().get(0);
+
+            assertEquals(picture.getShapeId(), 662);
+            assertFalse(picture.isExternalLinkedPicture());
+            assertNull(picture.getPictureData());
+            assertNull(picture.getPictureLink());
+            assertNull(picture.getClipping());
+        }
+    }
+
+    @Test
     public void bug62736() throws Exception {
         XMLSlideShow ss1 = XSLFTestDataSamples.openSampleDocument("bug62736.pptx");
 

Added: poi/trunk/test-data/slideshow/missing-blip-fill.pptx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/slideshow/missing-blip-fill.pptx?rev=1847004&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/slideshow/missing-blip-fill.pptx
------------------------------------------------------------------------------
--- svn:mime-type (added)
+++ svn:mime-type Tue Nov 20 14:15:14 2018
@@ -0,0 +1 @@
+application/vnd.openxmlformats-officedocument.presentationml.presentation



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