From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30361 invoked by alias); 2 Feb 2006 11:09:14 -0000 Received: (qmail 30351 invoked by uid 22791); 2 Feb 2006 11:09:13 -0000 X-Spam-Check-By: sourceware.org Received: from outmail128176.authsmtp.co.uk (HELO outmail128176.authsmtp.co.uk) (62.13.128.176) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 02 Feb 2006 11:09:10 +0000 Received: from [10.10.20.30] (host217-37-65-246.in-addr.btopenworld.com [217.37.65.246]) (authenticated bits=0) by squirrel.dmpriest.net.uk (8.13.3/8.13.3/Kp) with ESMTP id k12B96oa039701; Thu, 2 Feb 2006 11:09:06 GMT (envelope-from david.gilbert@object-refinery.com) Message-ID: <43E1EA00.8000307@object-refinery.com> Date: Thu, 02 Feb 2006 11:09:00 -0000 From: David Gilbert User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051026) MIME-Version: 1.0 To: Roman Kennke CC: mauve-patches@sources.redhat.com Subject: Re: FYI: GapContent test fix References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Server-Quench: 53fc1b4d-93dc-11da-84c5-001185d377ca X-Authentic-SMTP: 61633132333134.squirrel.dmpriest.net.uk:1.47/Kp X-Powered-By: AuthSMTP - http://www.authsmtp.com - Authenticated SMTP Mail Relay X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system! X-IsSubscribed: yes Mailing-List: contact mauve-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-patches-owner@sourceware.org X-SW-Source: 2006/txt/msg00099.txt.bz2 Hi Roman, The API docs describe the first parameter (where) as: |"where| - the starting position >= 0, < length()" ...and in this particular test I've used length(), so I'd expect the BadLocationException to be thrown. To back this up further, the exact same test on StringContent *does* throw the exception. I didn't hear back from Sun yet on the bug report (apart from the automated response), but I do expect that they'll accept it and fix it eventually. Anyway, I'll let you know when I hear from them. Regards, Dave Roman Kennke wrote: >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: > >ABCDEFG > >and now call GapContent.insertString(7, "XYZ"), then this will (quite >logically IMO) append this: > >ABCDEFGXYZ > >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 > > * gnu/testlet/javax/swing/text/GapContent/insertString.java > (testGeneral): Fixed boundary case to pass with the JDK. > >/Roman > > >------------------------------------------------------------------------ > >Index: gnu/testlet/javax/swing/text/GapContent/insertString.java >=================================================================== >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 @@ > } > harness.check(gc.length(), 7); > >- // 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. > try > { > gc.insertString(7, "XYZ"); > } > catch (BadLocationException e) > { >- pass = true; >+ pass = false; > } >- harness.check(pass); >+ harness.check(gc.length(), 10); > > // insert at index of last character + 2 > pass = false; > >