On Mon, 5 Dec 2016, Maxime GUERREIRO wrote:
I'm trying to remove a directory structure from a Composite Document
File V2 Document file,
and my code is working in every cases I could test except one.
Here it is: https://gist.github.com/mguerreiro/7023cab737917e936ac40857cdc12035
sampleCall is the call I'm using.
My issue is that when trying to nuke "Macros", I have a stale
directory entry named "VBA".
I can't find it using Apache POI's API: it doesn't seem to detect
orphans (why would it, after all?), so I can't remove them manually
either.
I've tried writing a unit test, based on your code, but I can't reproduce
the issue. See RecursiveDelete() of TestNPOIFSFileSystem
The only thing I will say - NPOIFSFileSystem will only ever extend files,
never shrink them. It doesn't zero-out removed bits either, just zaps the
references.
We've talked about adding a "defrag" mode to it, but not for a while. The
only way to fully get the space back from deleted entries / un-used blocks
is to copy (EntryUtils helps) from the open NPOIFS into a brand new one,
then save that. If you want to fully zap something nasty, you probably
want to take that route.
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]