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

Add tryParse methods to UnsignedBytes, UnsignedInts, and UnsignedLongs. #2180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

leeyikjiun
Copy link

This resolves #1957 by providing the tryParseUnsigned* methods.

@leeyikjiun
Copy link
Author

Okay, I will make the changes. Do I have to close this pull request and create a new one?

@lowasser
Copy link
Contributor

lowasser commented Oct 8, 2015

I don't think so? I think you can just add more changes to this pull request?

@leeyikjiun
Copy link
Author

I can't add the tryParse method for UnsignedBytes as there is no UnsignedByte class to return as a null object.

@lowasser
Copy link
Contributor

lowasser commented Oct 8, 2015

Then probably leave it out -- it's not clear what we should do there.

@leeyikjiun
Copy link
Author

I've found some further inconsistencies. In UnsignedLongs.parseUnsignedLong, a NumberFormatException is thrown if the radix is not within the min or max radix which is consistent with Java's Long.parseLong. However, in Longs.tryParse, an IllegalArgumentException is thrown instead.

I think the new tryParse methods should throw NumberFormatException as well. But what should we do with the old methods?

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.

tryParseUnsigned*
4 participants