https://issues.apache.org/bugzilla/show_bug.cgi?id=48261

           Summary: Can't open an Excel 97 file with POI
           Product: POI
           Version: 3.5-FINAL
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: critical
          Priority: P2
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Created an attachment (id=24586)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24586)
The excel file that cannot be opened with POI

With that code :

FileInputStream in = new FileInputStream("not_work.xls");
HSSFWorkbook w = new HSSFWorkbook(in);

It generate an exception :

Warning, incorrectly terminated empty data blocks in POIFS block listing
(should end at -2, ended at 0)
Warning, incorrectly terminated empty data blocks in POIFS block listing
(should end at -2, ended at 0)
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at
org.apache.poi.poifs.storage.DocumentBlock.getDataInputBlock(DocumentBlock.java:162)
    at
org.apache.poi.poifs.filesystem.POIFSDocument.getDataInputBlock(POIFSDocument.java:253)
    at
org.apache.poi.poifs.filesystem.DocumentInputStream.getDataInputBlock(DocumentInputStream.java:117)
    at
org.apache.poi.poifs.filesystem.DocumentInputStream.<init>(DocumentInputStream.java:75)
    at
org.apache.poi.poifs.filesystem.DirectoryNode.createDocumentInputStream(DirectoryNode.java:131)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:273)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:200)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:316)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:297)
    at Main.main(Main.java:10)


For Excel 97 (and Excel 2007) I can open the file and with all data.

Note : I tested with POI 2.0, POI 3.0-RC4, POI 3.1 and POI 3.2 and the result
is :

Exception in thread "main" java.io.IOException: block[ 0 ] already removed
    at org.apache.poi.poifs.storage.BlockListImpl.remove(BlockListImpl.java:97)
    at
org.apache.poi.poifs.storage.BlockAllocationTableReader.fetchBlocks(BlockAllocationTableReader.java:190)
    at
org.apache.poi.poifs.storage.BlockListImpl.fetchBlocks(BlockListImpl.java:130)
    at
org.apache.poi.poifs.storage.SmallBlockTableReader.getSmallDocumentBlocks(SmallBlockTableReader.java:61)
    at
org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:176)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:312)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:293)
    at Main.main(Main.java:12)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to