-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
validating the date format, add test case, since NumberFormatExceptio… #2538
Conversation
…n extends IllegalArgumentException, it is only necessary to write IllegalArgumentException.
Sorry everyone, I make a mistake when I solve conflict. So I close first pr, and make a new pr. I am so sorry for my mistake. |
@Carpe-Wang why did you close this PR? I think you can just run Sorry though for the trouble; in the meantime while your PR was open checks had been added which verify that the code is properly formatted, which are now causing the build failure. |
Because, I thought this submission was fairly straightforward, but it seemed to have been overlooked by the collaborators, so I closed it. I have now reopened it and am reviewing and addressing the areas that may have caused issues. |
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.
Thanks!
Technically the current GsonBuilder
implementation also allows blank strings as 'no-pattern':
if (datePattern != null && !datePattern.trim().isEmpty()) { |
But I am not sure if that is something we have to keep supporting and if anyone really relies on this (especially since it was not publicly documented).
@eamonnmcmanus, would it make sense to run the changes of this PR against the Google tests to be safe anyway?
Edit: Nevermind new SimpleDateFormat(...)
actually considers empty and blanks strings as valid, so it is still possible to use them.
I've already done that, and it didn't show up any problems. |
Thanks for this contribution! |
It's my honor. By the way out of curiosity, what do I need to do to become a contributor to this project? What more effort is required? |
Well, you already are a contributor, since you've just contributed this PR. Perhaps I'm not understanding the question? |
I think the people in that box are chosen automatically by GitHub based on who has contributed the most. If you open up where it says "+ 132 contributors" you should see everyone else. I don't see you there yet, but probably it only gets updated every so often. |
google#2538) * validating the date format, add test case, since NumberFormatException extends IllegalArgumentException, it is only necessary to write IllegalArgumentException. * Apply code formatting with Spotless --------- Co-authored-by: Carpe-Wang <[email protected]>
validating the date format, add test case and since NumberFormatException extends IllegalArgumentException, it is only necessary to write IllegalArgumentException.
Purpose
public GsonBuilder setDateFormat(String pattern)
input pattern is invalid.public class ISO8601Utils
Checklist
null
@since $next-version$
(
$next-version$
is a special placeholder which is automatically replaced during release)TestCase
)mvn clean verify javadoc:jar
passes without errors