Bug 14493 - POI --- Invalid Header signature
Summary: POI --- Invalid Header signature
Alias: None
Product: POI
Classification: Unclassified
Component: POIFS (show other bugs)
Version: 1.5.1
Hardware: All Linux
: P3 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2002-11-12 22:30 UTC by Monica
Modified: 2005-03-11 16:38 UTC (History)
0 users

Excel file that reproduces this bug - fails when I use HSSFWorkbook (9.01 KB, application/octet-stream)
2005-03-11 23:51 UTC, Abhijat Vatsyayan
Java code to use with the Excel file I attached (1.43 KB, text/plain)
2005-03-11 23:52 UTC, Abhijat Vatsyayan

Note You need to log in before you can comment on or make changes to this bug.
Description Monica 2002-11-12 22:30:56 UTC
I am using an Excel 2000 file. POI works perfectly on a Linux env. When I try 
to use the same thing on a solaris box, it comes back with "An Invalid Header 
Signature" Error.
Comment 1 Andy Oliver 2002-11-12 22:32:47 UTC
Does it happen in 1.5.x?  (1.0.2 was a looooong time ago)
Comment 2 Monica 2002-11-27 18:55:30 UTC
Happens with 1.5.1 also
Comment 3 Andy Oliver 2002-11-27 19:09:23 UTC
attach us a file that exhibits this problem.  The minimum amount of code
necessary to reproduce it.  Ensure that your file loads in excel (that no one
has CR/LF converted it by accident while ftping in ASC mode).  Also try with a
nightly build to ensure that this isn't a "default encoding" problem (which was
recently fixed but I can probably give you a workaround for 1.5.1).  Also what
version of Solaris?  And I'm asuming this is Soalris Solaris and not x86 Solaris.
Comment 4 Monica 2002-12-16 20:14:03 UTC
Invalid header signature; read 4547016314657521471, expected -
gets generated for J2SE v 1.4.1

Worked OK with  J2SE v 1.2.2

Comment 5 Andy Oliver 2003-07-24 13:46:59 UTC
Has anyone else seen this?  This looks like an Endian problem but that makes no
sense.  Can we see some files/code?
Comment 6 quitejack 2003-11-17 06:38:44 UTC
Hi, I got this error while reading a file into POIFSFileSystem by using POI. The
platform is Win2000, jdk1.3.1 MS Excel could open this file, but failed with POI

java.io.IOException: Invalid header signature; read 3546922463590896708, expecte
d -2226271756974174256
        at org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockRead
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSyste
        at excel2xml.readExcelFilesFromDir(excel2xml.java:54)
        at excel2xml.main(excel2xml.java:210)
Comment 7 Avik Sengupta 2003-11-17 06:47:51 UTC
Nothing has happened on this bug since no files were attached. Nothing is likely
to happen unless example files are attached. It is not possible to debug a file
open problem without seeing the file!
Comment 8 Perry Tew 2004-01-16 04:41:21 UTC
I encountered this same error.  I was using an excel document as a template for
generating an excel report via the web.  The webserver threw the same exception
so I copied the template from my build tree to /tmp and stripped down my jsp
page to a bare essentials java class and it worked. So, I then executed a diff
on my xls file in my build directory and the one deployed by weblogic and they

I'm using ANT to handle my building and packaging.  I mistakenly added filtering
 to a copy task that included my excel files.  That was enough to corrupt my xls
files.   After splitting out the xls files from the filtered copy task all is well.

Well, I just wanted to comment on my mistake to hopefully help others down the road.
Comment 9 Avik Sengupta 2004-11-18 14:58:47 UTC
Almost every case of "Invalid Header Signatures" that we've seen on the POI
lists has been due to operator error, feeding the wrong or corrupted file to
POI. Examples have included trying to read CSV files, or files getting corrupted
in webserver response.  Perry Tew's anectode above explains another such
scenario. This is all the more likely in this bug, as the description talks
about code working in one env, and not another. Moreover, no file has been
attached to this bug, making it impossible to debug. Hence marking invalid. 
Comment 10 Abhijat Vatsyayan 2005-03-11 23:51:19 UTC
Created attachment 14465 [details]
Excel file that reproduces this bug -  fails when I use HSSFWorkbook 

This file opens when I use Microsoft Excel 2000 (9.0.2720) but fails when I use
HSSFWorkbook. I  have read issues regarding  xl files being created  using web
responses etc. and this indeed is a file which was generated by a web
application (and downloaded). However this file opens when I use Microsoft
Excel 2000.
Comment 11 Abhijat Vatsyayan 2005-03-11 23:52:41 UTC
Created attachment 14466 [details]
Java code  to use with the Excel file I  attached
Comment 12 Abhijat Vatsyayan 2005-03-11 23:55:26 UTC
Comment on attachment 14465 [details]
Excel file that reproduces this bug -  fails when I use HSSFWorkbook 

java version used - JDK1.4.2. OS - Linux
poi file name - 
Comment 13 Abhijat Vatsyayan 2005-03-11 23:58:29 UTC
I have added an xl file that opens in Microsoft Excel 2000 (9.0.2720)  but  
throws exception - 

java.io.IOException: Invalid header signature; read 8026294563841076540, 
expected -2226271756974174256
        at org.apache.poi.poifs.storage.HeaderBlockReader.<init>
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
        at test.msxl.ReadXL.readWB(ReadXL.java:25)
        at test.msxl.ReadXL.main(ReadXL.java:48)

Using JDK1.4.2  on Linux . 
Comment 14 Abhijat Vatsyayan 2005-03-12 01:38:43 UTC
OK.. here is more information The file  is really HTML and NOT XL . . so sorry 
about all the posts .