]> source.dussan.org Git - poi.git/commitdiff
added unit tests for closed Bug 37684: Unhandled Continue Record Error
authorYegor Kozlov <yegor@apache.org>
Sat, 19 Jan 2008 14:44:07 +0000 (14:44 +0000)
committerYegor Kozlov <yegor@apache.org>
Sat, 19 Jan 2008 14:44:07 +0000 (14:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@613400 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/hssf/data/37684-1.xls [new file with mode: 0755]
src/testcases/org/apache/poi/hssf/data/37684-2.xls [new file with mode: 0755]
src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java

diff --git a/src/testcases/org/apache/poi/hssf/data/37684-1.xls b/src/testcases/org/apache/poi/hssf/data/37684-1.xls
new file mode 100755 (executable)
index 0000000..a59769e
Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/37684-1.xls differ
diff --git a/src/testcases/org/apache/poi/hssf/data/37684-2.xls b/src/testcases/org/apache/poi/hssf/data/37684-2.xls
new file mode 100755 (executable)
index 0000000..b17d0fa
Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/37684-2.xls differ
index 006b60c3dd6c38eaac3c18b356cb113ddb1be024..5993db947d00cc0c26e6a2f78b811e08015f8dca 100644 (file)
@@ -954,6 +954,42 @@ extends TestCase {
         assertTrue("No Exceptions while reading file", true);
 
     }
+
+    /**
+     * Bug 37684  : Unhandled Continue Record Error
+     */
+    public void test37684 () throws Exception {
+        FileInputStream in = new FileInputStream(new File(cwd, "37684-1.xls"));
+        HSSFWorkbook wb = new HSSFWorkbook(in);
+        in.close();
+
+        assertTrue("No exceptions while reading workbook", true);
+
+        //serialize and read again
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        wb.write(out);
+        out.close();
+        assertTrue("No exceptions while saving workbook", true);
+
+        wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+        assertTrue("No exceptions while reading saved stream", true);
+
+
+        in = new FileInputStream(new File(cwd, "37684-2.xls"));
+        wb = new HSSFWorkbook(in);
+        in.close();
+
+        assertTrue("No exceptions while reading workbook", true);
+
+        //serialize and read again
+        out = new ByteArrayOutputStream();
+        wb.write(out);
+        out.close();
+        assertTrue("No exceptions while saving workbook", true);
+
+        wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+        assertTrue("No exceptions while reading saved stream", true);
+    }
 }