]> source.dussan.org Git - poi.git/commitdiff
Add a disabled test for bug #44501, which still remains, plus fix a generics warning
authorNick Burch <nick@apache.org>
Thu, 28 Jan 2010 12:28:29 +0000 (12:28 +0000)
committerNick Burch <nick@apache.org>
Thu, 28 Jan 2010 12:28:29 +0000 (12:28 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@904062 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hdgf/chunks/Chunk.java
src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java
test-data/diagram/44501.vsd [new file with mode: 0644]

index 595ca9ad928d5337d82283983e860337fbbd0875..fc880d5db30cd30f8ef90b82ccfcf9e7925a5a6d 100644 (file)
@@ -116,7 +116,7 @@ public final class Chunk {
 
                // Loop over the definitions, building the commands
                //  and getting their values
-               ArrayList commands = new ArrayList();
+               ArrayList<Command> commands = new ArrayList<Command>();
                for(int i=0; i<commandDefinitions.length; i++) {
                        int type = commandDefinitions[i].getType();
                        int offset = commandDefinitions[i].getOffset();
@@ -232,7 +232,7 @@ public final class Chunk {
                }
 
                // Save the commands we liked the look of
-               this.commands = (Command[])commands.toArray(
+               this.commands = commands.toArray(
                                                        new Command[commands.size()] );
 
                // Now build up the blocks, if we had a command that tells
index 67a4141768c410b8497f39a4b27e40873cc4dc34..3a571b8edcdb599a33a2667e6181d20368356ee8 100644 (file)
@@ -77,4 +77,17 @@ public final class TestHDGFCore extends TestCase {
                hdgf = new HDGFDiagram(fs);
                assertNotNull(hdgf);
        }
+       
+       /**
+        * Tests that we can open a problematic file that triggers
+        *  an ArrayIndexOutOfBoundsException when processing the
+        *  chunk commands.
+        * @throws Exception
+        */
+       public void DISABLEDtestAIOOB() throws Exception {
+      fs = new POIFSFileSystem(_dgTests.openResourceAsStream("44501.vsd"));
+
+      HDGFDiagram hdgf = new HDGFDiagram(fs);
+      assertNotNull(hdgf);
+       }
 }
diff --git a/test-data/diagram/44501.vsd b/test-data/diagram/44501.vsd
new file mode 100644 (file)
index 0000000..51de23a
Binary files /dev/null and b/test-data/diagram/44501.vsd differ