I am also facing a similar problem ... But I am trying to read Outlook 2007 pst file which is not supported. Actually 3.0.2 scratchpad throws invalid header, for experimentation I hard coded the value found in pst files as one of the allowed header values. I wonder if this is due to the fact that 2007 onwards MS is storing values as unicode. I have not gone too far with the debugging yet.
On Feb 17, 2008 12:30 PM, Jari Niskala <[EMAIL PROTECTED]> wrote: > Hi, > > > > First of all, let me just thank all the contributors to this wonderful > project! > > > > My problem scenario occurs when I'm trying to read a MS Project file, then > modify it and finally write its contents to another file using the > POIFSFileSystem. > > > > However, even with just reading, then writing the contents I am getting > this > exception: > > > > java.io.IOException: block[ 0 ] already removed > > at > org.apache.poi.poifs.storage.BlockListImpl.remove(BlockListImpl.java:97) > > at > org.apache.poi.poifs.storage.BlockAllocationTableReader.fetchBlocks > (BlockAll > ocationTableReader.java:190) > > at > org.apache.poi.poifs.storage.BlockListImpl.fetchBlocks(BlockListImpl.java > :12 > 9) > > at > org.apache.poi.poifs.filesystem.POIFSFileSystem.processProperties > (POIFSFileS > ystem.java:404) > > at > org.apache.poi.poifs.filesystem.POIFSFileSystem.processProperties > (POIFSFileS > ystem.java:392) > > at > org.apache.poi.poifs.filesystem.POIFSFileSystem.processProperties > (POIFSFileS > ystem.java:392) > > at > org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>( > POIFSFileSystem.java: > 103) > > > > > > Here is the code that is causing this problem: > > > > // Read the file > > FileInputStream is = new FileInputStream (input); > > POIFSFileSystem fs = new POIFSFileSystem (is); > > // Write the file > > FileOutputStream os = new FileOutputStream(output); > > fs.writeFilesystem(os); > > os.flush(); > > os.close(); > > is.close(); > > // Read the file again > > is = new FileInputStream (output); > > fs = new POIFSFileSystem (is); > > > > > > I've also tried to do this more manually, creating a separate > POIFSFileSystem and iterating through the original filesystem, creating > documents and directories. Same result. > > > > If you have any ideas on this let me know. Thank you for your time. > > > > Best regards, > > Jari Niskala > > > >
