AtomicFileOutputStream does not overwrite file if exception occurred during write#9067
Conversation
… on issues during saving
|
If you have now autosave and normal saving at the same time you will get an exception due to the File lock because of this condition: |
|
Please also note:
|
Co-authored-by: Christoph <siedlerkiller@gmail.com> Co-authored-by: ThiloteE <73715071+ThiloteE@users.noreply.github.com>
…cation of save actions Co-authored-by: Christoph <siedlerkiller@gmail.com> Co-authored-by: ThiloteE <73715071+ThiloteE@users.noreply.github.com>
| */ | ||
| public AtomicFileOutputStream(Path path, boolean keepBackup) throws IOException { | ||
| super(Files.newOutputStream(getPathOfTemporaryFile(path))); | ||
| // Files.newOutputStream(getPathOfTemporaryFile(path)) leads to a "sun.nio.ch.ChannelOutputStream", which does not offer "lock" |
There was a problem hiding this comment.
No, the comment is indeed useful because it makes clear why we chose the old io and not the nio one
This refines the
AtomicFileOutputStreamto not overwrite a file if an exception occurred during write. This is done by introducing a flagerrorDuringWriteand handling that in theclose()method.CHANGELOG.mddescribed in a way that is understandable for the average user (if applicable)