Bug 24211 - IOException reading Excel-files included in an ZIP-file
Summary: IOException reading Excel-files included in an ZIP-file
Status: RESOLVED DUPLICATE of bug 13478
Alias: None
Product: POI
Classification: Unclassified
Component: POIFS (show other bugs)
Version: 2.0-pre3
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL: http://www.bundesbank.de
Depends on:
Reported: 2003-10-29 10:08 UTC by Volker Tirjan
Modified: 2005-03-20 17:06 UTC (History)
0 users

Patch for HeaderBlockReader.java (1.00 KB, patch)
2003-10-29 10:10 UTC, Volker Tirjan
Details | Diff
Patch of RawDataBlock.java (1.34 KB, patch)
2003-10-29 10:11 UTC, Volker Tirjan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 ***