8389970: StringIndexOutOfBoundsException when a text containing a mnemonic is removed - #2253
Conversation
|
👋 Welcome back eduardsdv! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
The total number of required reviews for this PR has been set to 2 based on the presence of this label: |
|
Thank you for logging the bug and offering to fix it! |
andy-goryachev-oracle
left a comment
There was a problem hiding this comment.
Looks like a good solution.
|
as I commented in the ticket, the mnemonic decorations are not visible on macOS so this issue does not occur there. It still needs to be tested on linux. @arapte could you be the second reviewer please? |
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 updatescontainsMnemonicflag, was not invoked if the text was empty. The value of this flag was stilltruebut the index of the mnemonic character insideMnemonicInfohad 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.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/2253/head:pull/2253$ git checkout pull/2253Update a local copy of the PR:
$ git checkout pull/2253$ git pull https://git.openjdk.org/jfx.git pull/2253/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2253View PR using the GUI difftool:
$ git pr show -t 2253Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/2253.diff
Using Webrev
Link to Webrev Comment