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

fix convert of Boolean #846 #922

Merged

Conversation

btkobayashirun
Copy link
Contributor

Please review #846.

@coveralls
Copy link

coveralls commented Oct 3, 2019

Coverage Status

Coverage increased (+0.002%) to 98.998% when pulling 74640e0 on issues/846_change_fquery_specification into 62d27be on development/5.6.0.

Copy link
Contributor

@yoshikawaa yoshikawaa left a comment

Choose a reason for hiding this comment

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

@btkobayashirun Please consider.

map.putAll(formattingBoolean(name, value));
return true;
}
}
if (value == null) {
String resetKey = "_" + key;
map.put(resetKey, "");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should be as follows.
Because map.put(resetKey, ""); and formattingBoolean#map.put(name, ""); has the same role.
It Makes easier to understand with WebDataBinder#getEmptyValue.

String key = StringUtils.isEmpty(prefix) ? name : prefix + "." + name;
if (value == null) {
  String resetKey =   determineResetKey(key, sourceType);
  map.put(resetKey, "");
  return true;
}
// omit

// Determine whether to convert null value to field marker.
private String determineResetKey(String key, TypeDescriptor sourceType) {
  // Should not convert Boolean null value to field marker.
  // WebDataBinder bind boolean & Boolean field marker as same false value.
  if (Boolean.class == sourceType.getType()) {
    return key;
  }
  return "_" + key;
}

How do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with you.

Only null check for sourceType is added to the implementation.
5556457

Copy link
Contributor

@btyanagawamg btyanagawamg left a comment

Choose a reason for hiding this comment

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

@takahashihrzg

Please merge .

@takahashihrzg takahashihrzg merged commit 1263c4c into development/5.6.0 Oct 18, 2019
@takahashihrzg takahashihrzg deleted the issues/846_change_fquery_specification branch October 18, 2019 11:45
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.

5 participants