]> source.dussan.org Git - poi.git/commitdiff
testcases for still unfixed bugs
authorAvik Sengupta <avik@apache.org>
Tue, 16 Jan 2007 15:52:31 +0000 (15:52 +0000)
committerAvik Sengupta <avik@apache.org>
Tue, 16 Jan 2007 15:52:31 +0000 (15:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@496739 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/hssf/data/37684.xls [new file with mode: 0644]
src/testcases/org/apache/poi/hssf/data/41139.xls [new file with mode: 0644]
src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java

diff --git a/src/testcases/org/apache/poi/hssf/data/37684.xls b/src/testcases/org/apache/poi/hssf/data/37684.xls
new file mode 100644 (file)
index 0000000..3aecf07
Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/37684.xls differ
diff --git a/src/testcases/org/apache/poi/hssf/data/41139.xls b/src/testcases/org/apache/poi/hssf/data/41139.xls
new file mode 100644 (file)
index 0000000..e4925fe
Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/41139.xls differ
index 71fe866cafd430861df0860811bd9f4858114510..ef1e410c46fbcf46f0a997e8e312859ca32452d7 100644 (file)
@@ -16,6 +16,9 @@
 ==================================================================== */
 package org.apache.poi.hssf.usermodel;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
 import java.io.FileInputStream;
 
 import junit.framework.TestCase;
@@ -38,6 +41,8 @@ public class TestUnfixedBugs extends TestCase {
 
        }
        
+       protected String cwd = System.getProperty("HSSF.testdata.path");
+       
         
         /* ArrayIndexOutOfBound in BOFRecord */  
         public void test28772() throws java.io.IOException {
@@ -47,5 +52,64 @@ public class TestUnfixedBugs extends TestCase {
        HSSFWorkbook wb = new HSSFWorkbook(in);
        assertTrue("Read book fine!" , true);
    }
+        
+        /**
+            * Bug 37684: Unhandled Continue Record Error
+            * 
+            * BUT NOW(Jan07): It triggers bug 41026!!
+            * 
+            * java.lang.ArrayIndexOutOfBoundsException: 30
+         at org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate.rowHasCells(ValueRecordsAggregate.java:219)
+            */
+           public void test37684() throws Exception {
+               FileInputStream in = new FileInputStream(new File(cwd, "37684.xls"));
+               HSSFWorkbook wb = new HSSFWorkbook(in);
+               in.close();
+
+               HSSFSheet sheet = wb.getSheetAt( 0 );
+               assertNotNull(sheet);
+
+               assertTrue("No Exceptions while reading file", true);
+
+               //serialize and read again
+               ByteArrayOutputStream out = new ByteArrayOutputStream();
+               wb.write(out);
+               out.close();
+
+               wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+               assertTrue("No Exceptions while reading file", true);
+
+           }
+           
+           /**
+            * Bug 41139: Constructing HSSFWorkbook is failed,threw threw ArrayIndexOutOfBoundsException for creating UnknownRecord
+            * 
+            * BUT NOW (Jan07): It throws the following in write!!
+            * java.lang.RuntimeException: Coding Error: This method should never be called. This ptg should be converted
+         at org.apache.poi.hssf.record.formula.AreaNPtg.writeBytes(AreaNPtg.java:54)
+         at org.apache.poi.hssf.record.formula.Ptg.serializePtgStack(Ptg.java:384)
+         at org.apache.poi.hssf.record.NameRecord.serialize(NameRecord.java:544)
+         at org.apache.poi.hssf.model.Workbook.serialize(Workbook.java:757)
+         at org.apache.poi.hssf.usermodel.HSSFWorkbook.getBytes(HSSFWorkbook.java:952)
+         at org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:898)
+
+            */
+           public void test41139() throws Exception {
+               FileInputStream in = new FileInputStream(new File(cwd, "41139.xls"));
+               HSSFWorkbook wb = new HSSFWorkbook(in);
+               in.close();
+
+               assertTrue("No Exceptions while reading file", true);
+
+               //serialize and read again
+               ByteArrayOutputStream out = new ByteArrayOutputStream();
+               wb.write(out);
+               out.close();
+
+               wb = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+               assertTrue("No Exceptions while reading file", true);
+
+           }
+
        
 }