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

Java bindings: Versionstamp::getUserVersion() does not return back user version if greater than 0x00FF #761

Closed
alecgrieser opened this Issue Sep 11, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@alecgrieser
Copy link
Contributor

alecgrieser commented Sep 11, 2018

There is an order-of-operations error in the unpackUserVersion code. In particular it's this:

public static int unpackUserVersion(byte[] bytes, int pos) {
return ((int)bytes[pos] & 0xff << 8) | ((int)bytes[pos + 1] & 0xff);
}

There should be parentheses around the first value so that the & 0xff gets applied before the left shift.

This was spotted originally in the forums, and I moved it over to issues: https://forums.foundationdb.org/t/java-bindings-bug-in-versionstamp-getuserversion/685

@gauravvnera

This comment has been minimized.

Copy link

gauravvnera commented Sep 11, 2018

thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment