<Swing Dev> [9] Review request for 8151015: JTextArea.insert() does not behave as expected with invalid position

Semyon Sadetsky semyon.sadetsky at oracle.com
Thu Apr 7 10:20:01 UTC 2016


Hi Phil,

I have found one failed test. My fix adds extra <p> element in the 
HTMLDocument after insert operation.
Looks like the HTMLDocument  ignores the implied character in the 
GapContent while the PlainDocument assume that it exists.
Both classes use the same GapContent code.
So, the fix need to be amended. The solution is to move the length check 
to the AbstractDocument which logic assumes that implied character is 
used in its content (see AbstractDocument#getLength() for example).

The updated webrev: http://cr.openjdk.java.net/~ssadetsky/8151015/webrev.01/
This webrev passes open and closed javax/swing/text/**/* tests.

Also bug4496801.java test is moved to open.

--Semyon

On 3/29/2016 10:24 PM, Phil Race wrote:
> There is actually a test for the previous bug - called 
> bug4496801.java, but it is in closed.
>
> I suggest it be opened as part of this fix.
>
> Also run any (all) related Swing regression tests that might cover 
> this area.
>
> I am a little nervous that since the original fix was 13 years ago 
> that some
> code out there may rely on the 'incorrect' fix by now ..
>
> -phil.
>
>
> On 03/21/2016 07:47 AM, Sergey Bylokhov wrote:
>> Should the test also cover the html based string(and cover the 
>> changes in HTMLDocument)?
>>
>> On 16.03.16 21:06, Alexander Scherbatiy wrote:
>>>
>>> The fix looks good to me.
>>>
>>> Just a small comment: if it is a new test it probably should not 
>>> contain
>>> 1998 year in the copyright.
>>>
>>> Thanks,
>>> Alexandr.
>>>
>>> On 14/03/16 20:48, Semyon Sadetsky wrote:
>>>> Hello,
>>>>
>>>> Please review fix for JDK9:
>>>>
>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8151015
>>>> webrev: http://cr.openjdk.java.net/~ssadetsky/8151015/webrev.00/
>>>>
>>>> It is regression of 4496801. The fix for 4496801 was wrong and the
>>>> correct fix should be taking into account the implied character at the
>>>> end of the document. Reverting 4496801 fixes 8151015. Also the correct
>>>> fix for 4496801 is provided.
>>>>
>>>> --Semyon
>>>
>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20160407/464e6b6b/attachment.html>


More information about the swing-dev mailing list