[
https://issues.apache.org/jira/browse/CASSANDRA-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12975838#action_12975838
]
Jonathan Ellis commented on CASSANDRA-1910:
-------------------------------------------
probably related: I have seen this error in the test suite --
{noformat}
[junit] Testcase:
testInvalidTimeUUID(org.apache.cassandra.db.marshal.TypeValidationTest): FAILED
[junit] Expected exception: org.apache.cassandra.db.marshal.MarshalException
[junit] junit.framework.AssertionFailedError: Expected exception:
org.apache.cassandra.db.marshal.MarshalException
{noformat}
> validation of time uuid is incorrect
> ------------------------------------
>
> Key: CASSANDRA-1910
> URL: https://issues.apache.org/jira/browse/CASSANDRA-1910
> Project: Cassandra
> Issue Type: Bug
> Components: Core
> Reporter: Dave
> Assignee: Gary Dusbabek
> Priority: Minor
> Fix For: 0.6.9, 0.7.1
>
>
> It appears _TimeUUIDType_ (as of 12/9) is checking the wrong bits when
> validating a time UUID as version 1.
> Per the comment and rfc4122, "_version is bits 4-7 of byte 6_", however
> validate() is actually checking the least significant bits:
> > _if ((slice.get() & 0x0f) != 1)_
> Sample java/hector code:
> {code}
> // displays "version 1" but validation fails
> java.util.UUID uuid1 =
> java.util.UUID.fromString("00000000-0000-1000-0000-000000000000");
> System.out.println(uuid1 + " " + uuid1.version());
> TimeUUIDType.instance.validate(UUIDSerializer.get().toByteBuffer(uuid1));
> // displays "version 2" but validation succeeds
> java.util.UUID uuid2 =
> java.util.UUID.fromString("00000000-0000-2100-0000-000000000000");
> System.out.println(uuid2 + " " + uuid2.version());
> TimeUUIDType.instance.validate(UUIDSerializer.get().toByteBuffer(uuid2));
> {code}
> The issue can be seen with any UUID where the timestamp doesn't start with 1:
> b54adc00-67f9-10d9-9669-0800200c9a66, (timestamp year 1776) version 1 fails
> b54adc00-67f9-12d9-9669-0800200c9a66, (timestamp year 2233) version 1 fails
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.