From: Peter Graves <peter@ar...> - 2002-07-03 02:44:07
Bug 576617, reported today against 0.15.3:
Started a new xml file and typed
Received error message of the form "expecting --" and
the editior froze. Would not let me continue typing.
Attempted to close file and reopen. Editior refused to
reopen file. =
Amazingly enough this bug has been around for a long time, going back
to January at least. Obviously it only gets triggered under a rare
combination of circumstances.
The text in the buffer gets long enough to be parsed, so Aelfred takes
a crack at it, and reports an error:
end of input while looking for delimiter (started on line 1)
For some reason, Aelfred throws a SAXParseException, rather than a
java.io.EOFException, which would make more sense; Aelfred does throw
an EOFException if you type, say "<foo bar=3D'baz'". J ignores
EOFExceptions, because they normally occur when you're not done typing
yet, but because it's a SAXParseException, j displays the
aforementioned error message and tries to place the caret at the
location of the error.
Aelfred is notoriously inaccurate at pinpointing the exact location of
anything, and in this case Aelfred reports an offset of 18, even
though there are only 11 characters in the buffer. Unfortunately, j
0.15.3 doesn't check this, and so dot gets placed beyond the end of
the line, where the next character you type triggers an assertion
failure in insertChar().
This bug is fixed in tonight's development snapshot:
http://armedbear.org/j-jar.zip (just j.jar)
The new code does sanity checking on the location Aelfred reports and
corrects it if it's too weird.
In addition, insertChar() now simply adjusts dot if it happens to be
in an impossible location and calls Debug.bug(), which logs the error
and carries on, rather than Debug.assertTrue(false), which causes the
editor to hang.
Long term, it might be better to replace Aelfred with XP, which is
much more accurate about reporting locations; Aelfred is smaller, and
that seemed like an advantage at the time.
Sorry for the inconvenience.