Bug 23326 - Exception while creating a POIFSFileSystem from an InputStream
Summary: Exception while creating a POIFSFileSystem from an InputStream
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 2.0-pre2
Hardware: PC All
: P3 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2003-09-22 11:26 UTC by Frédéric
Modified: 2005-03-20 17:06 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric 2003-09-22 11:26:40 UTC
I have the following exception while creating a POIFSFileSystem from an 
InputStream. This is my code :
public class Test()
InputStream ip = this.getClass().getClassLoader().getResourceAsStream(path);
POIFSFileSystem fileSystem = new POIFSFileSystem(ip);
HSSFWorkbook = new HSSFWorkbook(fileSystem);


java.io.IOException: Unable to read entire block; 1 byte read; expected 512 
        at org.apache.poi.poifs.storage.RawDataBlock.<init>
        at org.apache.poi.poifs.storage.RawDataBlockList.<init>
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>
Comment 1 Frédéric 2003-09-22 11:34:37 UTC
The resource (xls file) is inside the jar file of the application. If the files 
in the jar file is compressed the just describe exception is throw. I try to 
keep the files in the jar file not compressed and no exception are throw. I 
think the problem come from the compression/decompression. Do you have a 
solution or it's a bug ?

Tanks for your answer
Comment 2 Avik Sengupta 2003-10-06 10:36:01 UTC
Well, I imagine that sun's decompression utilities dont play very nicely with
POI's input streams. I doubt we will support this. There is a fix in CVS for
slow input streams (see bug 13478) which you can try by using latest CVS code or
waiting for the next release. However, if that doesnt work, i honestly dont
think this will be high priority.