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

Changed header encoding from toHexString() to toString() #28

Merged
merged 1 commit into from
Jul 21, 2014

Conversation

srapp
Copy link

@srapp srapp commented Jul 21, 2014

We started noticing some NumberFormatExceptions showing up in our local development after pulling the changes from #26. Digging into it, it looks like we have some weirdness in Java to thank for that. Looking at the definition of Long.toHexString(), it makes an assumption that the long value provided is nonnegative, which isn't something we can guarantee. When a negative number is provided, the resulting encoded hex is generates too large of a number when parsed by Long.parseLong(). Instead, it seems like we should use an overload of Long.toString(), specifying the radix of 16. I've updated a test to cover this corner case.

@kristofa
Copy link
Member

Good catch. Change #26 is new and was apparently not sufficiently tested yet. Thanks for fixing this so quickly!

kristofa added a commit that referenced this pull request Jul 21, 2014
Changed header encoding from toHexString() to toString()
@kristofa kristofa merged commit 2652628 into openzipkin:master Jul 21, 2014
@srapp srapp deleted the negativeHex branch July 21, 2014 20:39
@klette
Copy link
Contributor

klette commented Jul 28, 2014

Ouch, my bad. Thanks for the fix :)

@srapp
Copy link
Author

srapp commented Jul 28, 2014

No worries! 😃

@joeslice joeslice mentioned this pull request Oct 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants