]> source.dussan.org Git - poi.git/commitdiff
Bug 60294 - Add "unknown" ShapeType for 4095
authorAndreas Beeker <kiwiwings@apache.org>
Sat, 22 Oct 2016 19:34:47 +0000 (19:34 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Sat, 22 Oct 2016 19:34:47 +0000 (19:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1766227 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/sl/usermodel/ShapeType.java
src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
test-data/slideshow/60294.ppt [new file with mode: 0644]

index 91974b79dfc8fca82571bbc150ada16dc83f53e4..b2cb73b0f51305d193dcd3d7928cf024021dc49a 100644 (file)
@@ -307,6 +307,11 @@ public enum ShapeType {
     }
     
     public static ShapeType forId(int id, boolean isOoxmlId){
+        // exemption for #60294
+        if (!isOoxmlId && id == 0x0FFF) {
+            return NOT_PRIMITIVE;
+        }
+        
         for(ShapeType t : values()){
             if((isOoxmlId && t.ooxmlId == id) ||
                (!isOoxmlId && t.nativeId == id)) return t;
index 720719271c881225ec20a738014a779f73bb394d..0cabd81a6db935ab86ca5fe8a3dfe9a9121c87c7 100644 (file)
@@ -75,6 +75,7 @@ import org.apache.poi.sl.usermodel.PaintStyle;
 import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
 import org.apache.poi.sl.usermodel.PictureData.PictureType;
 import org.apache.poi.sl.usermodel.Placeholder;
+import org.apache.poi.sl.usermodel.ShapeType;
 import org.apache.poi.sl.usermodel.Slide;
 import org.apache.poi.sl.usermodel.SlideShow;
 import org.apache.poi.sl.usermodel.SlideShowFactory;
@@ -1008,4 +1009,15 @@ public final class TestBugs {
         }
         return null;
     }
+
+    /**
+     * Bug 60294: Add "unknown" ShapeType for 4095
+     */
+    @Test
+    public void bug60294() throws IOException {
+        HSLFSlideShow ppt = open("60294.ppt");
+        List<HSLFShape> shList = ppt.getSlides().get(0).getShapes();
+        assertEquals(ShapeType.NOT_PRIMITIVE, ((HSLFAutoShape)shList.get(2)).getShapeType());
+        ppt.close();
+    }
 }
diff --git a/test-data/slideshow/60294.ppt b/test-data/slideshow/60294.ppt
new file mode 100644 (file)
index 0000000..ebcae62
Binary files /dev/null and b/test-data/slideshow/60294.ppt differ