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

#753 - MaterialValueBox now has a new attribute called #returnBlankAsNull #758

Merged
merged 1 commit into from
Jan 4, 2018

Conversation

jzaruba
Copy link
Contributor

@jzaruba jzaruba commented Dec 23, 2017

With this attribute set to true calling #getvalue() returns null when the (already implemented) blank-validator recognizes the value as blank

…ed `#returnBlankAsNull`, with this attribute set to `true` calling `#getvalue()` returns `null` when the (already implemented) blank-validator recognizes the value blank
@kevzlou7979 kevzlou7979 changed the title #753 - MaterialValueBox now has a new attribute called `#returnBlankA… #753 - MaterialValueBox now has a new attribute called #returnBlankAsNull Jan 3, 2018
@kevzlou7979
Copy link
Contributor

Thanks for this contribution. Will write a simple test case for this.

@kevzlou7979 kevzlou7979 self-assigned this Jan 3, 2018
@kevzlou7979 kevzlou7979 added this to the 2.1 milestone Jan 3, 2018
@kevzlou7979 kevzlou7979 changed the base branch from release_2.1 to release_2.0.1 January 4, 2018 07:32
@kevzlou7979 kevzlou7979 changed the base branch from release_2.0.1 to release_2.1 January 4, 2018 07:32
@kevzlou7979 kevzlou7979 merged commit d9fab0f into GwtMaterialDesign:release_2.1 Jan 4, 2018
@kevzlou7979
Copy link
Contributor

Hi @jzaruba , We found some regressions with your commit from this PR #757 and we have an issue with getInternalValue() together with the addBlankItemIfNeeded() and removeBlankItemIfNeeded(). So we need your update with these regression.

@kevzlou7979
Copy link
Contributor

Here's the log output.

image

@jzaruba
Copy link
Contributor Author

jzaruba commented Jan 22, 2018

i am gonna look into it

@jzaruba
Copy link
Contributor Author

jzaruba commented Jan 23, 2018

Hello again :)

Up to a certain point the value comparison in MaterialListValueBox.getIndex(T) was done by Objects.equals(Object, Object). Then it got changed to a NPE-prone MaterialListValueBox.getValue(int).equals(Object).
Then the MaterialListValueBoxTest.testAllowBlanks test got introduced in another branche. (At this point it had to fail upon calling MaterialListValueBox.setValue(null) if run with the new value comparing.)
Then I created those two MRs of mine. (One of those MRs changed the comparison to MaterialListValueBox.getValueInternal(int).equals(Object).)

Check out this merge a89aa2f that took place on 31.10.2017 at 00:48. This is, IMO, where the MaterialListValueBox.setAllowBlank(boolean) feature meets the NPE-prone value comparing.

When the above mentioned test invokes MaterialListValueBox.getIndex(null) we run into null.equals(Object). If we revert the comparison back to Objects.equals(Object, Object) again we should be OK.

Was there any particular reason for abandoning the null-safe Objects.equals? Or am I missing something?

Cheers
Jarda

@kevzlou7979
Copy link
Contributor

kevzlou7979 commented Jan 24, 2018

Hi @jzaruba ,

Yeah between those PR I get the latest changes from yours (i.e getValueInternal) instead of the Objecs.equals(Object, Object). The test passed using the Objects.equals(Object, Object). I think we can move on to this.

Best Regards,
Mark

kevzlou7979 added a commit that referenced this pull request Jan 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants