Bug 16700 - Failure creating HSSFWorkbook : file uploaded from client : size more than 64.5 kb
Summary: Failure creating HSSFWorkbook : file uploaded from client : size more than 64...
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 1.5
Hardware: Other All
: P3 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-03 13:11 UTC by vinit_kl
Modified: 2005-03-20 17:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vinit_kl 2003-02-03 13:11:27 UTC
I submit the excel file from the client using IE Explorer 5.5 by the code given 
below:

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

In the servlet (running in Weblogic 6.1) I remove the extra data which comes in 
the HttpServletRequest and have the extract (only the content of the file) in 
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
(),req.getContentType());

//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 error 

java.io.IOException: block[ 63 ] already removed
        at org.apache.poi.poifs.storage.BlockListImpl.remove
(BlockListImpl.java:133)
        at org.apache.poi.poifs.storage.BlockAllocationTableReader.fetchBlocks
(BlockAllocationTableReader.java:227)
        at org.apache.poi.poifs.storage.BlockListImpl.fetchBlocks
(BlockListImpl.java:165)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.processProperties
(POIFSFileSystem.java:441)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>
(POIFSFileSystem.java:139)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:175)
        at lehman.brokerlink.servlets.POIExample.doProcess(POIExample.java:88)
        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
(ServletStubImpl.java:265)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet
(ServletStubImpl.java:200)
        at weblogic.servlet.internal.WebAppServletContext.invokeServlet
(WebAppServletContext.java:2456)
        at weblogic.servlet.internal.ServletRequestImpl.execute
(ServletRequestImpl.java:2039)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

Please note: If I try reading/creating the HSSFWorkbook from a java client by 
reading the same excel file (for which it was earlier throwing error), it does 
not throw any errors.
Comment 1 Andy Oliver 2003-02-03 14:35:57 UTC
post to the mailing list.  I doubt this is a POI bug.