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

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #6 from [email protected] 2010-04-28 18:29:19 EDT ---
(In reply to comment #3)
> This should now be fixed in svn trunk
> 
> However, we do still need a smaller file with 4k blocks!

sorry to be late, I was on leave for a week.
I got svn trunk Checked out revision 939073 and it fails on 512b and 4Kb block
ole documents.
See results of test with poi-3.6-20091214.jar and poi-3.7-SNAPSHOT-20100428.jar
on 512b and 4K block documents.

poi-3.6-20091214.jar                 512_BlockOLE.ole  =>  Ok
poi-3.6-20091214.jar                   4K_BlockOLE.ole  => Fails

java.io.IOException: Cannot remove block[ 178 ]; out of range[ 0 - 23 ]
    at org.apache.poi.poifs.storage.BlockListImpl.remove(BlockListImpl.java:98)
    at
org.apache.poi.poifs.storage.SmallDocumentBlockList.remove(SmallDocumentBlockList.java:30)
    at
org.apache.poi.poifs.storage.BlockAllocationTableReader.fetchBlocks(BlockAllocationTableReader.java:191)
    at
org.apache.poi.poifs.storage.BlockListImpl.fetchBlocks(BlockListImpl.java:123)
    at
org.apache.poi.poifs.storage.SmallDocumentBlockList.fetchBlocks(SmallDocumentBlockList.java:30)
    at
org.apache.poi.poifs.filesystem.POIFSFileSystem.processProperties(POIFSFileSystem.java:534)
    at
org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:176)
    at POIFSDmp.zviDocumentParse(POIFSDmp.java:101)
       ...

poi-3.7-SNAPSHOT-20100428.jar    512_BlockOLE.ole  =>   Fails

java.lang.NullPointerException
    at POIFSDmp.dumpRootThumbnail(POIFSDmp.java:264)
    at POIFSDmp.directoryParse(POIFSDmp.java:152)
    at POIFSDmp.zviDocumentParse(POIFSDmp.java:105)
       ...


poi-3.7-SNAPSHOT-20100428.jar    4K_BlockOLE.ole   =>   Fails

java.lang.ArrayIndexOutOfBoundsException: 16
    at
org.apache.poi.poifs.storage.DocumentBlock.getDataInputBlock(DocumentBlock.java:170)
    at
org.apache.poi.poifs.filesystem.POIFSDocument.getDataInputBlock(POIFSDocument.java:284)
    at
org.apache.poi.poifs.filesystem.DocumentInputStream.getDataInputBlock(DocumentInputStream.java:117)
    at
org.apache.poi.poifs.filesystem.DocumentInputStream.readFully(DocumentInputStream.java:255)
    at
org.apache.poi.poifs.filesystem.DocumentInputStream.read(DocumentInputStream.java:152)
    at
org.apache.poi.poifs.filesystem.DocumentInputStream.read(DocumentInputStream.java:134)
    at POIFSDmp.directoryParse(POIFSDmp.java:126)
    at POIFSDmp.zviDocumentParse(POIFSDmp.java:105)
       ...


----Code-----
               ...
100        POIFSFileSystem fs = null;
101       fs = new POIFSFileSystem(stream);
102        DirectoryEntry dir = fs.getRoot();
103        // dir is an instance of DirectoryEntry ...
104
105        directoryParse(0, dir);
106    }
107        

108    private static void directoryParse(int n , DirectoryEntry dir) throws
java.io.IOException {
109        String dirName = dir.getName();
110        for (Iterator iter = dir.getEntries(); iter.hasNext(); ) {
111            Entry entry = (Entry) iter.next();
112            if (entry instanceof DirectoryEntry) {
113            // .. recurse into this directory
114                dirName = entry.getName();
115                directoryParse( n++, (DirectoryEntry) entry);
116            }
117           else if (entry instanceof DocumentEntry) {
118            // entry is a document, which you can read
119                String docName = entry.getName();
120                String path = getPath(entry);
121                if (DEBUG) System.out.print(path);
122                DocumentInputStream dis = new
DocumentInputStream((DocumentNode) entry);
123                int numBytes = dis.available();
124                if (DEBUG) System.out.println ("("+numBytes+")");
125                byte[] data = new byte [numBytes];
126                dis.read(data);

--------------

The corresponding ole test files 512_BlockOLE.ole, 4K_BlockOLE.ole.zip are
attached, 4K_BlockOLE.ole.zip should be unzipped.

-- 
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to