]> source.dussan.org Git - poi.git/commitdiff
bug 60158: add failing test cases for AIOOBE on VBAMacroReader
authorJaven O'Neal <onealj@apache.org>
Wed, 21 Sep 2016 01:03:12 +0000 (01:03 +0000)
committerJaven O'Neal <onealj@apache.org>
Wed, 21 Sep 2016 01:03:12 +0000 (01:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1761652 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java
test-data/document/60158.docm [new file with mode: 0644]

index 2d98a4f38da8e174798f65e335f8fecfb153d3a4..6693a522757ecff46f17f9aa98e836c8db113b3e 100644 (file)
@@ -262,6 +262,10 @@ public class TestVBAMacroReader {
         reader.close();
     }
     
+    private void skipTest(Throwable e) {
+        assumeTrue("This test currently fails." + e.getLocalizedMessage(), false);
+    }
+    
     // This test is written as expected-to-fail and should be rewritten
     // as expected-to-pass when the bug is fixed.
     @Test
@@ -273,11 +277,23 @@ public class TestVBAMacroReader {
             if (e.getMessage().matches("Module offset for '.+' was never read.")) {
                 //e.printStackTrace();
                 // NPE when reading module.offset in VBAMacroReader.readMacros (approx line 258)
-                assumeTrue("This test currently fails. See stdout.", false);
+                skipTest(e);
             } else {
                 // something unexpected failed
                 throw e;
             }
         }
     }
+    
+    // This test is written as expected-to-fail and should be rewritten
+    // as expected-to-pass when the bug is fixed.
+    @Test
+    public void bug60158() throws IOException {
+        try {
+            fromFile(POIDataSamples.getDocumentInstance(), "60158.docm");
+            fail("This test passes now. Please update the unit test and bug 59858.");
+        } catch (ArrayIndexOutOfBoundsException e) {
+            skipTest(e);
+        }
+    }
 }
diff --git a/test-data/document/60158.docm b/test-data/document/60158.docm
new file mode 100644 (file)
index 0000000..2b7908f
Binary files /dev/null and b/test-data/document/60158.docm differ