Skip to content
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

Give hint about missing null representation in error message #6757

Merged
merged 1 commit into from
Oct 24, 2019

Conversation

Legioth
Copy link
Member

@Legioth Legioth commented Oct 23, 2019

A binding doesn't have an automatic null representation configured if a
converter is also defined. This may cause surprises with fields that
don't accept null values, e.g. TextField.

The easiest fix in this situation is to explicitly define a null
representation. This patch adds an error message that reminds the
developer about the existence of that feature so that they wouldn't have
to make more elaborate workarounds.

Fixes #6746


This change is Reviewable

A binding doesn't have an automatic null representation configured if a
converter is also defined. This may cause surprises with fields that
don't accept null values, e.g. TextField.

The easiest fix in this situation is to explicitly define a null
representation. This patch adds an error message that reminds the
developer about the existence of that feature so that they wouldn't have
to make more elaborate workarounds.

Fixes #6746
Copy link
Contributor

@denis-anisimov denis-anisimov left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1.
Reviewable status: 1 unresolved discussion, 0 of 1 LGTMs obtained (waiting on @denis-anisimov)


flow-data/src/main/java/com/vaadin/flow/data/binder/Binder.java, line 1221 at r1 (raw file):

%s

quote it please . Sometimes it's hard to distinguish a proper name in the sentence.
Quotes helps.

Copy link
Member Author

@Legioth Legioth left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 unresolved discussion, 0 of 1 LGTMs obtained (waiting on @denis-anisimov)


flow-data/src/main/java/com/vaadin/flow/data/binder/Binder.java, line 1221 at r1 (raw file):

Previously, denis-anisimov (Denis) wrote…
%s

quote it please . Sometimes it's hard to distinguish a proper name in the sentence.
Quotes helps.

Isn't it clear enough without quotes when using the fully qualified name (getName()) instead of the simple name (getSimpleName())?

Copy link
Contributor

@denis-anisimov denis-anisimov left a comment

Choose a reason for hiding this comment

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

Reviewable status: all discussions resolved, 0 of 1 LGTMs obtained


flow-data/src/main/java/com/vaadin/flow/data/binder/Binder.java, line 1221 at r1 (raw file):

Previously, Legioth (Leif Åstrand) wrote…

Isn't it clear enough without quotes when using the fully qualified name (getName()) instead of the simple name (getSimpleName())?

Ah, right. It's getName not a simple name. My imagination .....

Copy link
Contributor

@denis-anisimov denis-anisimov left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! all discussions resolved, 1 of 1 LGTMs obtained

@denis-anisimov denis-anisimov merged commit 3e30650 into master Oct 24, 2019
@denis-anisimov denis-anisimov deleted the missingNullRepresentationMessage branch October 24, 2019 08:38
TatuLund added a commit to vaadin/framework that referenced this pull request Oct 24, 2019
Addresses: #9000

Addresses:  #11109

These changes are adopted from vaadin/flow#4138 and vaadin/flow#6757
ujoni pushed a commit that referenced this pull request Nov 7, 2019
A binding doesn't have an automatic null representation configured if a
converter is also defined. This may cause surprises with fields that
don't accept null values, e.g. TextField.

The easiest fix in this situation is to explicitly define a null
representation. This patch adds an error message that reminds the
developer about the existence of that feature so that they wouldn't have
to make more elaborate workarounds.

Fixes #6746

(cherry picked from commit 3e30650)
ujoni pushed a commit that referenced this pull request Nov 7, 2019
A binding doesn't have an automatic null representation configured if a
converter is also defined. This may cause surprises with fields that
don't accept null values, e.g. TextField.

The easiest fix in this situation is to explicitly define a null
representation. This patch adds an error message that reminds the
developer about the existence of that feature so that they wouldn't have
to make more elaborate workarounds.

Fixes #6746

(cherry picked from commit 3e30650)
@ujoni ujoni added this to the 1.0 Maintenance milestone Nov 7, 2019
ujoni pushed a commit that referenced this pull request Nov 7, 2019
A binding doesn't have an automatic null representation configured if a
converter is also defined. This may cause surprises with fields that
don't accept null values, e.g. TextField.

The easiest fix in this situation is to explicitly define a null
representation. This patch adds an error message that reminds the
developer about the existence of that feature so that they wouldn't have
to make more elaborate workarounds.

Fixes #6746

(cherry picked from commit 3e30650)
@ujoni ujoni removed this from the 1.0 Maintenance milestone Nov 7, 2019
ujoni pushed a commit that referenced this pull request Nov 7, 2019
A binding doesn't have an automatic null representation configured if a
converter is also defined. This may cause surprises with fields that
don't accept null values, e.g. TextField.

The easiest fix in this situation is to explicitly define a null
representation. This patch adds an error message that reminds the
developer about the existence of that feature so that they wouldn't have
to make more elaborate workarounds.

Fixes #6746

(cherry picked from commit 3e30650)
Ansku pushed a commit to vaadin/framework that referenced this pull request Nov 13, 2019
* Cherry picks of Binder fixes in Flow

Addresses: #9000

Addresses:  #11109

These changes are adopted from vaadin/flow#4138 and vaadin/flow#6757
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

StringToIntegerConverter makes TextField throw NullPointerException on null Integer value
3 participants