DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11744>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11744

write of empty document corrupts file

           Summary: write of empty document corrupts file
           Product: POI
           Version: 1.5.1
          Platform: Other
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: POIFS
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Problem observed with 1.5.1, 1.7.0, and nightly build 1.8.0-dev-20020813. 

POIFS does not "write" an empty document stream correctly (i.e. a document that
is zero bytes in length).  Failure is observed when trying to read the document
in the form of an IOException with the message of either "Cannot remove block[ 0
]; out of range" or "block[ 0 ] already removed".

Example method to reproduce:

    // construct a new POIFSFileSystem with an empty document
    POIFSFileSystem fs = new POIFSFileSystem();
    fs.getRoot().createDocument("Foo", new ByteArrayInputStream(new byte[0]));
    
    // save the document into a byte array
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    fs.writeFilesystem(out);

    // now try to read the POIFSFileSystem from that byte array.  
    new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray()));


This was recently posted on poi-dev, but has been added here to make sure the
bug is tracked and not forgotten about.  The post on poi-dev has much more
detail than what's here.  See: 
http://www.mail-archive.com/poi-dev%40jakarta.apache.org/msg03105.html

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to