You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by "Dhanore, Prakash (SUPP)" <pr...@gesupply.com> on 2003/10/07 15:40:11 UTC
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
Re: Error occurred: Invalid header signature; read
3255307777713450495, expected -2226271756974174256
Posted by Avik Sengupta <av...@apache.org>.
While I dont know whats the context of your code, and so cant be sure,
but i think your solution is too trivial. An http request contains many
different things. You CANNOT just pass it to any app and expect a well
formed file stream to emerge! Use a proper utility to retrieve the file
from the request. Search google for a servlet based file upload utility.
On Tue, 2003-10-07 at 19:10, Dhanore, Prakash (SUPP) wrote:
> 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
Re: Error occurred: Invalid header signature; read
3255307777713450495, expected -2226271756974174256
Posted by "Andrew C. Oliver" <ac...@apache.org>.
On 10/8/03 6:22 PM, "Michael Zalewski" <za...@optonline.net> wrote:
>
> 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.
>
Umm...why should POI parse your mime or any other encoding for you? I'd
probably reject any patches to that effect as its "everything but the
kitchen sink"... A tight scope keeps the project alive.
-andy
> -----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
>
--
Andrew C. Oliver
http://www.superlinksoftware.com/poi.jsp
Custom enhancements and Commercial Implementation for Jakarta POI
http://jakarta.apache.org/poi
For Java and Excel, Got POI?
The views expressed in this email are those of the author and are almost
definitely not shared by the Apache Software Foundation, its board or its
general membership. In fact they probably most definitively disagree with
everything espoused in the above email.
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org
RE: Error occurred: Invalid header signature; read
3255307777713450495, expected -2226271756974174256
Posted by Michael Zalewski <za...@optonline.net>.
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