From: Andreas Beeker Date: Sat, 22 Oct 2016 19:34:47 +0000 (+0000) Subject: Bug 60294 - Add "unknown" ShapeType for 4095 X-Git-Tag: REL_3_16_BETA1~53 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=49572b2ac87eccf4ce3f80d21c11fed67e63d198;p=poi.git Bug 60294 - Add "unknown" ShapeType for 4095 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1766227 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/sl/usermodel/ShapeType.java b/src/java/org/apache/poi/sl/usermodel/ShapeType.java index 91974b79df..b2cb73b0f5 100644 --- a/src/java/org/apache/poi/sl/usermodel/ShapeType.java +++ b/src/java/org/apache/poi/sl/usermodel/ShapeType.java @@ -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; diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java index 720719271c..0cabd81a6d 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java @@ -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 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 index 0000000000..ebcae62656 Binary files /dev/null and b/test-data/slideshow/60294.ppt differ