We repeatedly get questions/bug-reports related to the automatic saving of changes on close() for the OPCPackage based formats, it seems to be not expected by most users. So we should discuss changing the semantic here to not save on close() by default and ask users to additionally call a new write() method if they need the current behavior. It will be a breaking change, but I think the confusion among users is big enough to warrant this change.
Bug 59252 is related and is probably solved automatically if this one gets implemented. Things to take care of here: * Code-changes * Tests * Javadoc in potentially many places * Documentation on the webpage (with notes about which version changed the behavior)
I think we should probably take a few hours to finish the in-place-write on POIDocument and POIXMLDocument when making this change too - should be easish now that both NPOIFS and OPC support it at the FS level, and would be a good improvement excuse to cover the breaking change!
When using write(OutputStream) the currently opened package is also written [1]. How about always working on copy/temporary file and in the case of write()/commit() move it to over the original file? [1] https://stackoverflow.com/a/50830215/2066598
Seems like if we want to make this change, this is the right time to do it.
Seems to me that I had an issue at one point (XML document) where I wanted to read a template, make changes, and save the output as a regular document, but, it would always update the template in place. I don't know if that would have anything to do with this, but we might want to make sure that we can do that as long as we are making changes here.
*** Bug 62985 has been marked as a duplicate of this bug. ***
*** Bug 65215 has been marked as a duplicate of this bug. ***