This is the mail archive of the
mailing list for the Mauve project.
FYI: GapContent test fix
- From: "Roman Kennke" <roman dot kennke at aicas dot com>
- To: mauve-patches at sources dot redhat dot com
- Date: Thu, 02 Feb 2006 10:50:39 +0000
- Subject: FYI: GapContent test fix
- Bounce-to: "Roman Kennke" <email@example.com>
In the test for GapContent.insertString() we have tested the insertion of
a string at the index after the last character. There was a comment in
it saying that it is a bug in the JDK to not throw a
BadLocationException. However, AFAICS this is not the case. Suppose you
have the following content:
and now call GapContent.insertString(7, "XYZ"), then this will (quite
logically IMO) append this:
There is no need to throw a BadLocationException here. What might have
caused confusion here is the fact that the GapContent usually has a
trailing \n character, and normal insertion from an AbstractDocument
never inserts after the \n, but this is an implementation detail of the
document and not GapContent.
I checked in the appended patch to fix this problem.
2006-02-02 Roman Kennke <firstname.lastname@example.org>
(testGeneral): Fixed boundary case to pass with the JDK.
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/text/GapContent/insertString.java,v
retrieving revision 1.3
diff -u -r1.3 insertString.java
--- gnu/testlet/javax/swing/text/GapContent/insertString.java 24 Jan 2006 17:18:56 -0000 1.3
+++ gnu/testlet/javax/swing/text/GapContent/insertString.java 2 Feb 2006 10:44:05 -0000
@@ -215,19 +215,17 @@
- // insert at index of last character + 1 - the API docs say this should
- // raise a BadLocationException, but JDK1.5.0_06 doesn't (I reported this
- // to Sun as a bug in their implementation, will add a bug ID if one is assigned)
- pass = false;
+ // Insert at index of last character + 1. This appends the new string to
+ // the existing string.
catch (BadLocationException e)
- pass = true;
+ pass = false;
+ harness.check(gc.length(), 10);
// insert at index of last character + 2
pass = false;