-
Notifications
You must be signed in to change notification settings - Fork 541
8286552: TextFormatter: UpdateValue/UpdateText is called, when no ValueConverter is set #794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8286552: TextFormatter: UpdateValue/UpdateText is called, when no ValueConverter is set #794
Conversation
… no valueConverter is set
|
👋 Welcome back mhanl! A progress list of the required criteria for merging this PR into |
Webrevs
|
There was a problem hiding this 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.
modules/javafx.controls/src/main/java/javafx/scene/control/TextFormatter.java
Outdated
Show resolved
Hide resolved
modules/javafx.controls/src/main/java/javafx/scene/control/TextFormatter.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@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: 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
Please see this link for an up-to-date comparison between the source branch of this pull request and the 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 |
|
/sponsor |
|
@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. |
A common reason for using the
TextFormatteris the need for afilter.Therefore, the following constructor is typically used:
public TextFormatter(@NamedArg("filter") UnaryOperator<Change> filter) { ... }With that, no
valueConverteris set in theTextFormatter.When a
TextFieldwill commit his value,TextFormatter.updateValue(...)is called.Since
valueConverteris null, an NPE is thrown and catched inside it andTextFormatter.updateText()is called (which will callTextInputControl.updateText(...)), which won't do anything either sincevalueConverteris still not set (=null).A minor improvement here is to just skip
TextFormatter.updateValue(...)and thereforeTextFormatter.updateText()(->TextInputControl.updateText(...)), since this methods won't do anything without avalueConverter.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
TextFormatterfunctionalities, which pass before and after.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/794/head:pull/794$ git checkout pull/794Update a local copy of the PR:
$ git checkout pull/794$ git pull https://git.openjdk.java.net/jfx pull/794/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 794View PR using the GUI difftool:
$ git pr show -t 794Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/794.diff