Catastrophic data loss due to jedit silently failing to autosave
Submitted by Tuesday, 7 August, 2007 - 04:39
on
I rely on autosave. I ordinarily don't manually save my text files in jedit at all, until I need to open those files in other programs, since jedit automatically saves my changes. If jedit or my computer crashes, it's no problem, since when I restart jedit, it automatically finds the autosave files and offers to load them.
However, this safety feature recently failed catastrophically. I'd had jedit running for a couple weeks, and had made many changes to some files. Then my computer crashed, and when I restarted it and started jedit back up, I discovered that one of the autosave files, for a file to which which I had been making many changes every day, was empty! I lost a lot of irreplaceable data as a result.
I investigated, and found the problem. I had pasted some text which included an umlaut letter into the file, and jedit couldn't save it using the particular encoding which I had selected (windows-1251). As a result, it wrote a blank autosave file, and from then on, all of the text which I entered was stored only in memory, which was a disaster waiting to happen. I confirmed that this was the problem by creating a new file, pasting the offending letter, and trying to save it; I got this error:
I/O Error
c:\Users\Andrew\Documents\test.txt:
The following I/O operation could not be completed:
Cannot save: java.io.CharConversionException: Failed to encode the character
'ä' (U+E4) at column 1 in line 5 with the encoding "windows-1251".
It's true that that letter can't be encoded in that encoding. However, silently failing to autosave the file is a major fault of jedit. Furthermore, when I paste the offending letter into the file and then wait for the autosave, jedit writes "Input/output complete" in the status bar as usual, making me believe that the autosave was successful!
Automatically switching the autosave encoding to unicode (and notifying me of this fact) would be one solution to the problem. Another would be simply to display an error message alerting me to the fact that the autosave in my chosen encoding failed. But silently failing is absolutely the wrong thing to do.
A text editor's absolute highest priority, with no exceptions, is: never lose (or corrupt) the user's data. Sorry for ranting, but this is a bug which should not be allowed to remain.
It is present in both pre9 and pre10.
However, this safety feature recently failed catastrophically. I'd had jedit running for a couple weeks, and had made many changes to some files. Then my computer crashed, and when I restarted it and started jedit back up, I discovered that one of the autosave files, for a file to which which I had been making many changes every day, was empty! I lost a lot of irreplaceable data as a result.
I investigated, and found the problem. I had pasted some text which included an umlaut letter into the file, and jedit couldn't save it using the particular encoding which I had selected (windows-1251). As a result, it wrote a blank autosave file, and from then on, all of the text which I entered was stored only in memory, which was a disaster waiting to happen. I confirmed that this was the problem by creating a new file, pasting the offending letter, and trying to save it; I got this error:
I/O Error
c:\Users\Andrew\Documents\test.txt:
The following I/O operation could not be completed:
Cannot save: java.io.CharConversionException: Failed to encode the character
'ä' (U+E4) at column 1 in line 5 with the encoding "windows-1251".
It's true that that letter can't be encoded in that encoding. However, silently failing to autosave the file is a major fault of jedit. Furthermore, when I paste the offending letter into the file and then wait for the autosave, jedit writes "Input/output complete" in the status bar as usual, making me believe that the autosave was successful!
Automatically switching the autosave encoding to unicode (and notifying me of this fact) would be one solution to the problem. Another would be simply to display an error message alerting me to the fact that the autosave in my chosen encoding failed. But silently failing is absolutely the wrong thing to do.
A text editor's absolute highest priority, with no exceptions, is: never lose (or corrupt) the user's data. Sorry for ranting, but this is a bug which should not be allowed to remain.
It is present in both pre9 and pre10.