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

[HOTFIX] Convert UUIDs to a bytes array #315

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -384,15 +384,23 @@ protected String convertString(Object value) {
throw new IllegalArgumentException("Cannot convert to string: " + value.getClass().getName());
}

protected UUID convertUUID(Object value) {
protected byte[] convertUUID(Object value) {
if (value instanceof String) {
return UUID.fromString((String) value);
return asBytes(UUID.fromString((String) value));
} else if (value instanceof UUID) {
return (UUID) value;
return asBytes((UUID)value);
}
throw new IllegalArgumentException("Cannot convert to UUID: " + value.getClass().getName());
}

protected static byte[] asBytes(UUID uuid) {
byte[] bytes = new byte[16];
java.nio.ByteBuffer.wrap(bytes)
.putLong(uuid.getMostSignificantBits())
.putLong(uuid.getLeastSignificantBits());
return bytes;
}

protected ByteBuffer convertBase64Binary(Object value) {
if (value instanceof String) {
return ByteBuffer.wrap(Base64.getDecoder().decode((String) value));
Expand Down