Bug 24211

Summary: IOException reading Excel-files included in an ZIP-file
Product: POI Reporter: Volker Tirjan <volker.tirjan>
Component: POIFSAssignee: POI Developers List <dev>
Severity: normal    
Priority: P3    
Version: 2.0-pre3   
Target Milestone: ---   
Hardware: PC   
OS: All   
URL: http://www.bundesbank.de
Attachments: Patch for HeaderBlockReader.java
Patch of RawDataBlock.java

Description Volker Tirjan 2003-10-29 10:08:48 UTC
POIFS tries to read in blocks of 512 bytes. This worked fine reading files from 
the filesystem, but causes trouble when reading Excel-files contained in a ZIP-

ZipFile zip = new ZipFile(completePathToImportfile);
Enumeration zipEntries = zip.entries();
ZipEntry zipEntry = (ZipEntry) zipEntries.nextElement();
InputStream innerFileStream = zip.getInputStream(zipEntry);	
POIFSFileSystem fs = new POIFSFileSystem(innerFileStream);
// IOException occurs!

The read() of java.io.InputStream does not guarantee to provide the full amount 
of requested bytes. It is necessary to repeat the reading until the full block 
is read or eof occured.
Comment 1 Volker Tirjan 2003-10-29 10:10:49 UTC
Created attachment 8798 [details]
Patch for HeaderBlockReader.java
Comment 2 Volker Tirjan 2003-10-29 10:11:37 UTC
Created attachment 8799 [details]
Patch of RawDataBlock.java
Comment 3 Chris Nokleberg 2003-10-29 10:22:37 UTC
An equivalent patch has already been applied, but it did not make it into the
2.0pre3 release. Checkout the REL_2_BRANCH from CVS to get the latest version.

*** This bug has been marked as a duplicate of 13478 ***