]> source.dussan.org Git - poi.git/commitdiff
fixed bug 41384: Array index wrong in record creation tags/REL_3_0_RC2@523660
authorYegor Kozlov <yegor@apache.org>
Wed, 21 Mar 2007 14:04:32 +0000 (14:04 +0000)
committerYegor Kozlov <yegor@apache.org>
Wed, 21 Mar 2007 14:04:32 +0000 (14:04 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@520893 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hslf/record/Record.java
src/scratchpad/testcases/org/apache/poi/hslf/data/41384.ppt [new file with mode: 0644]
src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java [new file with mode: 0644]

index 6d925f452994c1529a77d29c6ea9cc063133c517..7094d3db318998076dc46f58aeecd9c7e034bf42 100644 (file)
@@ -129,7 +129,7 @@ public abstract class Record
                                // Record was horribly corrupt
                        }
                        pos += 8;
-                       pos += rlen;
+                       pos += rleni;
                }
 
                // Turn the vector into an array, and return
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/data/41384.ppt b/src/scratchpad/testcases/org/apache/poi/hslf/data/41384.ppt
new file mode 100644 (file)
index 0000000..7a206ec
Binary files /dev/null and b/src/scratchpad/testcases/org/apache/poi/hslf/data/41384.ppt differ
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
new file mode 100644 (file)
index 0000000..cfc3c95
--- /dev/null
@@ -0,0 +1,53 @@
+\r
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+package org.apache.poi.hslf.usermodel;\r
+\r
+import junit.framework.TestCase;\r
+import org.apache.poi.hslf.HSLFSlideShow;\r
+import org.apache.poi.hslf.model.Picture;\r
+\r
+import java.io.*;\r
+\r
+/**\r
+ * Testcases for bugs entered in bugzilla\r
+ * the Test name contains the bugzilla bug id\r
+ *\r
+ * @author Yegor Kozlov\r
+ */\r
+public class TestBugs extends TestCase {\r
+    protected String cwd = System.getProperty("HSLF.testdata.path");\r
+\r
+    /**\r
+     * Bug 41384: Array index wrong in record creation\r
+     */\r
+    public void test41384() throws Exception {\r
+        FileInputStream is = new FileInputStream(new File(cwd, "41384.ppt"));\r
+        HSLFSlideShow hslf = new HSLFSlideShow(is);\r
+        is.close();\r
+\r
+        SlideShow ppt = new SlideShow(hslf);\r
+        assertTrue("No Exceptions while reading file", true);\r
+\r
+        assertEquals(1, ppt.getSlides().length);\r
+\r
+        PictureData[] pict = ppt.getPictureData();\r
+        assertEquals(2, pict.length);\r
+        assertEquals(Picture.JPEG, pict[0].getType());\r
+        assertEquals(Picture.JPEG, pict[1].getType());\r
+    }\r
+}\r