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