> This PR fixes the StringIndexOutOfBoundsException, that occurs when an empty 
> text is set to a Labeled, that previously contained a mnemonic.
> 
> The reason for the error is that the ``updateDisplayedText(double, double)``, 
> which also updates ``containsMnemonic`` flag, was not invoked if the text was 
> empty. The value of this flag was still ``true`` but the index of the 
> mnemonic character inside ``MnemonicInfo`` had already been updated to -1. 
> This led to the StringIndexOutOfBoundsException in the line 611.
> 
> I fixed it by moving the call to ``updateDisplayedText(double, double)`` 
> outside the if-clause, so that it is always called when the text is being 
> laid out. This should not affect performance because the method already 
> checks whether recalculation is required. If not, it exits quickly.
> 
> ---------
> - [X] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

eduardsdv has updated the pull request incrementally with one additional commit 
since the last revision:

  8389970: Skip a test on Mac

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

Changes:
  - all: https://git.openjdk.org/jfx/pull/2253/files
  - new: https://git.openjdk.org/jfx/pull/2253/files/8c7286c9..e9f437b7

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=2253&range=04
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=2253&range=03-04

  Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jfx/pull/2253.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/2253/head:pull/2253

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

Reply via email to