poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Zalewski <zalew...@optonline.net>
Subject RE: Error occurred: Invalid header signature; read 3255307777713450495, expected -2226271756974174256
Date Wed, 08 Oct 2003 23:22:44 GMT
How interesting:

Plug 3255307777713450495 into Windows calculator applet. Then do View |
Scientific, and select Hex.

Out comes 2D2D2D2D2D2D2DFF, which are the first eight bytes you send to POI,
claiming that it is the start of an Excel file. But of course, Excel files
(and all OLE Doc files) begin with E11AB1A1E011CFD0 ( which
is -2226271756974174256 in decimal)

I am betting that you did use MIME encoding to submit the uploaded file
(enctype=""multipart/form-data" on the FORM element in the page that sends
the file). But you never parsed the MIME message sent by the form.

The problem is that only a portion of the request input stream contains the
uploaded Excel file. You need to break out that portion, and pass only the
Excel bytes to POI. The bad news is that POI gives you no help to do this.
The good news is that you can use other Open Source software, such as the
FileUpload component in http://jakarta.apache.org/commons, to help you with
multipart form data decoding.

-----Original Message-----
From: Dhanore, Prakash (SUPP) [mailto:prakash.dhanore@gesupply.com]
Sent: Tuesday, October 07, 2003 9:40 AM
To: poi-dev@jakarta.apache.org
Subject: Error occurred: Invalid header signature; read 3255307777713450495,
expected -2226271756974174256

Hi,
I am trying to upload the excel file and I am getting error below. One of
the FAQ says that I have to remove the header information from the
HTTPRequest object but I am not sure how to remove that. I am using weblogic
6.1.
This is the code generating this error:
          InputStream fin = request.getInputStream();
          BlockingInputStream bis = new BlockingInputStream(fin);
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          int ch= -1;
          baos.write(ch);
          while ((ch=bis.read()) > -1){
            baos.write(ch);
          }
          byte[] inputBytes = baos.toByteArray();
          POIFSFileSystem fs= new POIFSFileSystem(new
ByteArrayInputStream(inputBytes));
          HSSFWorkbook wb = new HSSFWorkbook(request.getInputStream());
Error occurred: Invalid header signature; read 3255307777713450495,
expected -2226271756974174256

Thanks,
Prakash


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org


Mime
View raw message