Bug 32076

Summary: biff view throws exception.
Product: POI Reporter: as <ash_sha_21>
Component: POIFSAssignee: POI Developers List <dev>
Status: RESOLVED LATER    
Severity: critical    
Priority: P3    
Version: 2.5-FINAL   
Target Milestone: ---   
Hardware: Other   
OS: other   
Attachments: input file for biff view.

Description as 2004-11-05 04:42:34 UTC
I am trying to biff view one file and it threw the following exception.


java.io.IOException: block[ 0 ] already removed
	at org.apache.poi.poifs.storage.BlockListImpl.remove
(BlockListImpl.java:96)
	at org.apache.poi.poifs.storage.BlockAllocationTableReader.fetchBlocks
(BlockAllocationTableReader.java:190)
	at org.apache.poi.poifs.storage.BlockListImpl.fetchBlocks
(BlockListImpl.java:128)
	at org.apache.poi.poifs.filesystem.POIFSFileSystem.processProperties
(POIFSFileSystem.java:405)
	at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>
(POIFSFileSystem.java:102)
	at org.apache.poi.hssf.dev.BiffViewer.run(BiffViewer.java:70)
	at org.apache.poi.hssf.dev.BiffViewer.main(BiffViewer.java:652)
Comment 1 as 2004-11-05 04:45:02 UTC
Created attachment 13334 [details]
input file for biff view.
Comment 2 as 2004-11-08 05:48:19 UTC
guys , i could resolve this problem by putting a hack .Tell me if it is a 
valid solution

 but my assumption that i have resoved the problem as per bug#31979  is 
resolved is wrong..:(

In POIFSFileSystem.java In processProperties method

I added a check for size
              if(size > 0) {
                

                if (property.shouldUseSmallBlocks())
                {
                    document =
                        new POIFSDocument(name, small_blocks
                            .fetchBlocks(startBlock), size);
                }
                else
                {
                    document =
                        new POIFSDocument(name,
                                          big_blocks.fetchBlocks(startBlock),
                                          size);
                }
                
                parent.createDocument(document);
                }
Comment 3 Avik Sengupta 2004-11-18 16:21:45 UTC
Does this file open correctly in Excel? How is this file produced? 

We need to be careful about changes to POIFileSystem, since it might have wider
repurcussions. At the very least, we need a testcase demonstrating the error and
the fix. 

Also I dont understand your reference to bug 31979. Does this patch fix that
one? Lets discuss this on the dev lists... bugzilla is rotten to have a
conversation on.
Comment 4 David Fisher 2008-12-29 14:48:04 UTC
Please try with the latest release and see if this is still trouble. If so then please provide the smallest file that recreates the problem and describe how it was created.
Comment 5 Nick Burch 2010-06-10 11:13:55 UTC
POIFS has had a number of fixes since this bug was opened. As nothing more has been heard in many years, assuming this has now been fixed