From: Yegor Kozlov Date: Sat, 19 Jan 2008 14:44:07 +0000 (+0000) Subject: added unit tests for closed Bug 37684: Unhandled Continue Record Error X-Git-Tag: REL_3_0_3_BETA1~180 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=614ea00c948b9d12748e6e40405b648b4c0de2f0;p=poi.git added unit tests for closed Bug 37684: Unhandled Continue Record Error git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@613400 13f79535-47bb-0310-9956-ffa450edef68 --- 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 index 0000000000..a59769eb39 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 index 0000000000..b17d0fa227 Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/37684-2.xls differ diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index 006b60c3dd..5993db947d 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -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); + } }