Skip to content

Conversation

@Maran23
Copy link
Member

@Maran23 Maran23 commented May 10, 2022

A common reason for using the TextFormatter is the need for a filter.
Therefore, the following constructor is typically used:
public TextFormatter(@NamedArg("filter") UnaryOperator<Change> filter) { ... }

With that, no valueConverter is set in the TextFormatter.

When a TextField will commit his value, TextFormatter.updateValue(...) is called.
Since valueConverter is null, an NPE is thrown and catched inside it and TextFormatter.updateText() is called (which will call TextInputControl.updateText(...)), which won't do anything either since valueConverter is still not set (=null).

A minor improvement here is to just skip TextFormatter.updateValue(...) and therefore TextFormatter.updateText() (-> TextInputControl.updateText(...)), since this methods won't do anything without a valueConverter.
With that change, no exception (NPE) is thrown and catched, and therefore also exception breakpoints are not called (can be annoying ;)).
This will also slightly increase the performance, as throwing exceptions is a (minor) bottleneck.

Added tests for all TextFormatter functionalities, which pass before and after.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (1 review required, with at least 1 reviewer)

Issue

  • JDK-8286552: TextFormatter: UpdateValue/UpdateText is called, when no ValueConverter is set

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/794/head:pull/794
$ git checkout pull/794

Update a local copy of the PR:
$ git checkout pull/794
$ git pull https://git.openjdk.java.net/jfx pull/794/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 794

View PR using the GUI difftool:
$ git pr show -t 794

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/794.diff

@bridgekeeper
Copy link

bridgekeeper bot commented May 10, 2022

👋 Welcome back mhanl! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Ready for review label May 10, 2022
@mlbridge
Copy link

mlbridge bot commented May 10, 2022

Webrevs

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix and tests look good, with a couple requested changes.

@kevinrushforth kevinrushforth self-requested a review May 13, 2022 12:24
Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openjdk
Copy link

openjdk bot commented May 13, 2022

@Maran23 This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8286552: TextFormatter: UpdateValue/UpdateText is called, when no ValueConverter is set

Reviewed-by: kcr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 1 new commit pushed to the master branch:

  • 6c6545f: 8285217: [Android] Window's screen is not updated after native screen was disposed

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@kevinrushforth) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Ready to be integrated label May 13, 2022
@Maran23
Copy link
Member Author

Maran23 commented May 13, 2022

/integrate

@openjdk openjdk bot added the sponsor Ready to sponsor label May 13, 2022
@openjdk
Copy link

openjdk bot commented May 13, 2022

@Maran23
Your change (at version bb15772) is now ready to be sponsored by a Committer.

@kevinrushforth
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented May 13, 2022

Going to push as commit 81e1cc3.
Since your change was applied there has been 1 commit pushed to the master branch:

  • 6c6545f: 8285217: [Android] Window's screen is not updated after native screen was disposed

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 13, 2022
@openjdk openjdk bot closed this May 13, 2022
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review sponsor Ready to sponsor labels May 13, 2022
@openjdk
Copy link

openjdk bot commented May 13, 2022

@kevinrushforth @Maran23 Pushed as commit 81e1cc3.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@Maran23 Maran23 deleted the 8286552-text-formatter-value-converter branch August 4, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants