Bug 45290 - java.io.IOException: block[ 44 ] already removed from org.apache.poi.poifs.storage.BlockListImpl.remove
Summary: java.io.IOException: block[ 44 ] already removed from org.apache.poi.poifs.st...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POIFS (show other bugs)
Version: 3.0-FINAL
Hardware: PC Windows XP
: P1 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-26 13:50 UTC by Dmitry Goldenberg
Modified: 2008-11-13 08:50 UTC (History)
1 user (show)



Attachments
the doc (23.00 KB, application/vnd.ms-excel)
2008-06-26 13:51 UTC, Dmitry Goldenberg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Goldenberg 2008-06-26 13:50:41 UTC
I am getting this exception on one specific document from a customer. The origin of this document is unclear.

We're running POI 3.0.1 Final.

Has this issue been resolved since?

I know other folks have reported something similar before, e.g. 
https://issues.apache.org/bugzilla/show_bug.cgi?id=32076

Please advise.
Thanks.
Comment 1 Dmitry Goldenberg 2008-06-26 13:51:51 UTC
Created attachment 22182 [details]
the doc

This is the document that I'm seeing the behavior on.
Comment 2 Dmitry Goldenberg 2008-06-26 13:53:12 UTC
Here is the stack trace:

java.io.IOException: block[ 44 ] already removed
	at org.apache.poi.poifs.storage.BlockListImpl.remove(BlockListImpl.java:97)
	at org.apache.poi.poifs.storage.BlockAllocationTableReader.fetchBlocks(BlockAllocationTableReader.java:190)
	at org.apache.poi.poifs.storage.BlockListImpl.fetchBlocks(BlockListImpl.java:129)
	at org.apache.poi.poifs.filesystem.POIFSFileSystem.processProperties(POIFSFileSystem.java:412)
	at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:103)
Comment 3 Nick Burch 2008-06-27 02:15:45 UTC
I'm pretty sure this was fixed a while back.

Please try with 3.1-BETA2, or 3.1 final when that comes out (hopefully next week)
Comment 4 Poul Bildsøe 2008-08-28 04:00:50 UTC
Just as a comment. If have seen this error once when I was trying to load an xls-file that (wrongly) has been placed in CVS with ASCII substitution. As soon as the file was converted to binary the error disappeared.
Comment 5 Dmitry Goldenberg 2008-10-31 11:51:21 UTC
Folks,
I just verified and I am still seeing this exception with 3.2 FINAL.

We really would like to see this fixed since we have a customer that keeps asking about it :)

And I'd love to contribute to the fix but unfortunately the "block[ 44 ] already removed" error is not informative enough for me to do anything about it.

Anyone?

Thanks!
Comment 6 Nick Burch 2008-11-02 20:18:20 UTC
I was pretty sure we had fixed this in svn months and months ago :(

Can you confirm that the excel file attached to the bug triggers it?
Comment 7 Dmitry Goldenberg 2008-11-03 04:59:01 UTC
Nick,

Yes, this indeed is the case; I'm seeing the behavior on the attached file, using 3.2 FINAL.

Here is the stack trace:

java.io.IOException: block[ 44 ] already removed
	at org.apache.poi.poifs.storage.BlockListImpl.remove(BlockListImpl.java:97)
	at org.apache.poi.poifs.storage.BlockAllocationTableReader.fetchBlocks(BlockAllocationTableReader.java:190)
	at org.apache.poi.poifs.storage.BlockListImpl.fetchBlocks(BlockListImpl.java:130)
	at org.apache.poi.poifs.filesystem.POIFSFileSystem.processProperties(POIFSFileSystem.java:530)
	at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:176)

- Dmitry
Comment 8 Nick Burch 2008-11-12 07:39:38 UTC
Ah, this is a subtly different error message to the one in bug #44898

Some digging deep into poifs is probably needed
Comment 9 Nick Burch 2008-11-12 10:25:11 UTC
Your file seems really odd - the block containing the header information is then listed at the end of the normal blocks list.

So, poifs pulls out the header block to process, then sets off along the data block list, hits a reference to the header block that's already been handled, and gets in a huff

I've just committed a workaround to svn, where if the block is already gone and it's the header block, then consider the data blocks section done. Hopefully that'll fix it for you, but there does seem to be something very odd about the file. Do you happen to know how it was created?
Comment 10 Dmitry Goldenberg 2008-11-12 10:33:56 UTC
Nick,

No idea really how this file was created. It came from a customer and I believe they had been googling for test files.

Could you point me at the the files that contain your fix? Is this off 3.2 FINAL?

Thanks for the quick turnaround!