|Summary:||Provide a write() method and change semantics of close() to not automatically write|
|Product:||POI||Reporter:||Dominik Stadler <dominik.stadler>|
|Component:||OPC||Assignee:||POI Developers List <dev>|
|Bug Depends on:|
|Bug Blocks:||59252, 59634, 63029|
Description Dominik Stadler 2016-04-07 18:57:14 UTC
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.
Comment 1 Dominik Stadler 2016-04-07 18:58:42 UTC
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)
Comment 2 Nick Burch 2016-04-07 19:03:15 UTC
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!
Comment 3 Andreas Beeker 2018-06-24 21:19:08 UTC
When using write(OutputStream) the currently opened package is also written . How about always working on copy/temporary file and in the case of write()/commit() move it to over the original file?  https://stackoverflow.com/a/50830215/2066598
Comment 4 PJ Fanning 2018-06-25 19:11:05 UTC
Seems like if we want to make this change, this is the right time to do it.
Comment 5 Mark Murphy 2018-06-25 20:06:22 UTC
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.