[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Re: RFR: 8303026: [TextField] IOOBE on setting text with control characters that replaces existing t
From:       Andy Goryachev <angorya () openjdk ! org>
Date:       2023-02-22 16:05:42
Message-ID: YB0g5DpP5-5Imnk1xhur1ttOGaPqNs6Hzs0wrYkapjA=.ac789caf-71d1-4cd1-91b7-c8c3f439fbaf () github ! com
[Download RAW message or body]

On Wed, 22 Feb 2023 11:08:14 GMT, Jose Pereda <jpereda@openjdk.org> wrote:

> > This PR fixes a regression after \
> > [JDK-8212102](https://bugs.openjdk.org/browse/JDK-8212102). 
> > When a TextField control has some previous content, and new text with only \
> > invalid characters (0x7F, new line, tabs, <0x20) is set, \
> > `TextInputControl::filterInput` is used to strip them out, and the new text has \
> > length 0. 
> > During the refactoring in JDK-8212102, the checks:
> > 
> > int length = txt.length();
> > if (end > start + length) end = length;
> > if (start > length-1) start = end = 0;
> > 
> > were removed. 
> > 
> > In this particular case, when the new filtered text has length 0, we need those \
> > checks, so start and end are set to 0, and txt.substring(start, end) doesn't \
> > throw the IOOBE anymore. 
> > A test is added to verify this scenario. It fails with the proposed patch, passes \
> > with it.
> 
> Jose Pereda has updated the pull request incrementally with one additional commit \
> since the last revision: 
> add curly braces

the fix is verified with the MonkeyTester application.

-------------

Marked as reviewed by angorya (Committer).

PR: https://git.openjdk.org/jfx/pull/1043


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic