Bug 31310 - Error reading header signature
Summary: Error reading header signature
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.5-FINAL
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2004-09-20 14:20 UTC by Bob Demers
Modified: 2005-10-03 11:53 UTC (History)
0 users

excel file crashing on (554.52 KB, application/octet-stream)
2004-09-20 14:22 UTC, Bob Demers
Invalid Header Test Case (1.77 KB, text/plain)
2005-10-03 19:33 UTC, Shawn Clowater

Note You need to log in before you can comment on or make changes to this bug.
Description Bob Demers 2004-09-20 14:20:25 UTC
Here is the error from reading an excel document:

java.io.IOException: Invalid header signature; read 7888090397404325948, expecte
d -2226271756974174256
        at org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockRead
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSyste

I have an excel document but not sure how to upload here...
Comment 1 Bob Demers 2004-09-20 14:22:46 UTC
Created attachment 12803 [details]
excel file crashing on
Comment 2 Glen Stampoultzis 2004-09-21 12:54:18 UTC
What did you use to create this file?  I've never seen this occur on a
non-corrupt file before.
Comment 3 Shawn Clowater 2005-10-03 19:33:04 UTC
Created attachment 16573 [details]
Invalid Header Test Case
Comment 4 Shawn Clowater 2005-10-03 19:33:44 UTC
I encountered the same type of problem while using the getBytes() of the 

From the Javadoc, 

Method getBytes - get the bytes of just the HSSF portions of the XLS file.
Use this to construct a POI POIFSFileSystem yourself.

However, when I feed it to to POIFSFileSystem I get the invalid header error.  
I've attached a VERY simple test case that create a workbook with a single 
sheet and it fails when using getBytes() but it will create a readable excel 
spreadsheet and can be contstructed using the ByteArrayOutputStream.toByeArray
() method.
Comment 5 Andy Oliver 2005-10-03 19:53:26 UTC
The attached file is XML not an XLS BIFF file (not a bug).  The below question
is an incorrect API usage formed as a bug but its really a question (which
should be asked on the list).