poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vinit Khandelwal <vini...@sonata-software.com>
Subject Failure in creating HSSFWorkbook when file uploaded from client a nd sixe of excel file GT 64.5 kb
Date Tue, 04 Feb 2003 04:08:53 GMT
Please find the query description below:

I submit the excel file from the client using IE Explorer 5.5 by the code

<form action="http://xxx/POIExample" method="post" enctype="multipart/form-
  <input size="70" type="file" name="spreadsheet" />
  <input type="submit" value="Upload File" />

In the servlet (running in Weblogic 6.1) I remove the extra data which comes
the HttpServletRequest and have the extract (only the content of the file)
the String "file": 

Then I use the following code to create the workbook

//the parse method returns the content of the excel file which was uploaded
1. String file = parse(req.getInputStream(),req.getContentLength

//this line creates the ByteArrayInputStream
2. ByteArrayInputStream is = new ByteArrayInputStream(file.getBytes());

//then try to create the workbook
3. HSSFWorkbook wb = new HSSFWorkbook(is);

If i upload the excel file from the client which is less than 64.5 kb, the 
HSSFWorkbook gets created successfully and I am able to read data.

But if the excel file size is greater than 64.5 kb it throws an exception

java.io.IOException: block[ 63 ] already removed
        at org.apache.poi.poifs.storage.BlockListImpl.remove
        at org.apache.poi.poifs.storage.BlockListImpl.fetchBlocks
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.processProperties
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
        at lehman.brokerlink.servlets.POIExample.doPost(POIExample.java:26)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet
        at weblogic.servlet.internal.WebAppServletContext.invokeServlet
        at weblogic.servlet.internal.ServletRequestImpl.execute
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

Please do let me know why this kind of exception may be getting thrown
 and/or how to rectify this.

Thanks in advance.
Disclaimer: The information in this e-mail and any attachments is
confidential / privileged. It is intended solely for the addressee or
addressees. If you are not the addressee indicated in this message, you may
not copy or deliver this message to anyone. In such case, you should destroy
this message and kindly notify the sender by reply email. Please advise
immediately if you or your employer does not consent to Internet email for
messages of this kind.

View raw message