You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2008/04/29 01:02:33 UTC

DO NOT REPLY [Bug 44898] New: Regression: Cannot remove block

https://issues.apache.org/bugzilla/show_bug.cgi?id=44898

           Summary: Regression: Cannot remove block
           Product: POI
           Version: 3.0
          Platform: PC
        OS/Version: Windows Vista
            Status: NEW
          Severity: major
          Priority: P2
         Component: POIFS
        AssignedTo: dev@poi.apache.org
        ReportedBy: trejkaz@trypticon.org


A couple of files in our own test suite which used to parse fine under 3.0.1
now fail under 3.0.2 with the following error:

java.io.IOException: Cannot remove block[ 2545 ]; out of range
        at
org.apache.poi.poifs.storage.BlockListImpl.remove(BlockListImpl.java:104)
        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:448)
        at
org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:109)


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44898] Regression: Cannot remove block

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44898





--- Comment #11 from Josh Micich <jo...@gildedtree.com>  2009-01-29 11:41:50 PST ---
(In reply to comment #9)
> Fixed in SVN trunk.


svn r653945 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=653945 )added a unit test and improved the error message. This change made
it into 3.1-beta2.

svn r658285 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=658285 )completed the fix for this bug and was available in 3.1-final


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44898] Regression: Cannot remove block

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44898





--- Comment #1 from Trejkaz <tr...@trypticon.org>  2008-04-28 16:14:31 PST ---
Created an attachment (id=21876)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=21876)
Test files (zipped)

Attaching test files in a zip (was too big to upload raw.)


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44898] Regression: Cannot remove block

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44898





--- Comment #4 from Trejkaz <tr...@trypticon.org>  2008-04-29 17:29:03 PST ---
Created an attachment (id=21882)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=21882)
Proposed fix

It is as I thought, removing that one line makes all our files parse correctly.

...I put it on 28239 too, purely by accident.  I don't know if it fixes that
bug yet as I haven't tested it.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44898] Regression: Cannot remove block

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44898





--- Comment #7 from Nick Burch <ni...@torchbox.com>  2008-05-06 08:29:37 PST ---
I don't like the idea of just hiding the EOF

Maybe the right solution is that if we have a short last block, we detect this,
then pad it out to the required 512 byte multiple?


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44898] Regression: Cannot remove block

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44898





--- Comment #2 from Josh Micich <jo...@gildedtree.com>  2008-04-29 11:04:14 PST ---
Looks similar to bug 28239.  Is this a POIFS block size problem?


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44898] Regression: Cannot remove block

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44898


Trejkaz <tr...@trypticon.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #21882|0                           |1
        is obsolete|                            |




--- Comment #6 from Trejkaz <tr...@trypticon.org>  2008-04-29 17:58:33 PST ---
Created an attachment (id=21883)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=21883)
Proposed fix v2

Here's one which fixes the failures in TestRawDataBlock and
TestRawDataBlockList.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44898] Regression: Cannot remove block

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44898


Nick Burch <ni...@torchbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #9 from Nick Burch <ni...@torchbox.com>  2008-05-20 08:42:31 PST ---
Fixed in SVN trunk.

We now have a difference between "stream EoF reached" and "I have data", so
things work correctly now


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44898] Regression: Cannot remove block

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44898





--- Comment #8 from Trejkaz <tr...@trypticon.org>  2008-05-06 16:01:24 PST ---
It isn't really "hiding" the EOF, it's simply moving it to where the file is
actually EOF.

Previously it would be:
  * 512 byte block
  * ...
  * 512 byte block
  * short block (claims to be EOF)

Whatever reads it from the outside said "oh, EOF... so discard the entire
block."

Now it's:
  * 512 byte block
  * ...
  * 512 byte block
  * short block
  * EOF

I'm not really sure what's wrong with representing it how it really is.  But if
you want to pad the file, go ahead... not padding it doesn't seem to have any
drawback either since if it's a short block then the document entry for it
won't result in reading past the end of the data which is actually there.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44898] Regression: Cannot remove block

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44898


Nick Burch <ni...@torchbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sackley@cfl.rr.com




--- Comment #10 from Nick Burch <ni...@torchbox.com>  2008-05-20 08:43:09 PST ---
*** Bug 28239 has been marked as a duplicate of this bug. ***


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44898] Regression: Cannot remove block

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44898





--- Comment #3 from Trejkaz <tr...@trypticon.org>  2008-04-29 17:15:15 PST ---
I saw that other bug, but I thought it might be a different issue as that bug
has been around since 2004, yet this one only started in version 3.0.2.

Did something about the way blocks were loaded change in 3.0.2?  I've had a bit
of a look myself by diffing the poifs package between 3.0.1 and 3.0.2, and the
only change I can see which might cause the issue is:

public RawDataBlock(final InputStream stream, int blockSize)

+               // IOUtils.readFully will always read the
+               //  requested number of bytes, unless it hits
+               //  an EOF
+            _eof = true;

This is in the code which logs a warning instead of throwing an error, if the
final block isn't a multiple of 512... I do recall that being fixed in 3.0.2
but it's possible the way it was fixed causes an error in some files.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44898] Regression: Cannot remove block

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44898





--- Comment #5 from Trejkaz <tr...@trypticon.org>  2008-04-29 17:41:11 PST ---
Before and after my fix, TestRawDataBlock.testShortConstructor is failing.  It
seems to be expecting an IOException, which has been removed since 3.0.2.

Seems someone "fixed" testEmptyConstructor by removing the fail() call but not
testShortConstructor.  But perhaps catching IOException in the unit test is
also a bad idea?


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org