Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#48 Make the bufferio operations exception-safe

closed-accepted
Alan Ezust
None
7
2006-11-25
2006-11-15
Kazutoshi Satoda
No

jEdit has serious bugs in bufferio. If an exception is
thrown during the final stream write/read oepration,
following problems occur:
Saving:
The contents of the original file are lost. For
this case, jEdit provides "two-stage save" option.
But if the backup options are also enabled, the
file is moved to backup. Then the original file
seems to disappear. Also the stream is left open.
Loading:
The stream is left open.
This patch will fix these problems.

Discussion

  • Logged In: YES
    user_id=1483238
    Originator: YES

    Here are some additional information about this patch.
    Comments are welcome.

    I noticed this while working to fix some looseness
    about encodings. I need this to be fixed before
    throwing decoding/encoding error from read/write
    operations. But the problem is probably more general
    one. So I made a separated patch first.

    I also noticed that the auto-save operation does not
    see settings such as "two-stage save". Is this
    intended? I personally don't care because I don't use
    the auto-save option. But if I implement strict
    checking about encoding, a dangerous scenario will
    come to mind.
    - Enable auto-save option.
    - Set buffer encoding to US-ASCII.
    - Type some non-ASCII char (this might be an accident)
    Then, auto-saving will be fired and the contents
    of the file will be lost. Should I also implement
    two-stage saving and backuping into the auto-save
    option before throwing decoding/encoding errors?

     
  • Alan Ezust
    Alan Ezust
    2006-11-25

    • assigned_to: nobody --> ezust
    • status: open --> closed-accepted