-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
6u24
-
x86
-
windows_7
FULL PRODUCT VERSION :
1.6.0_22
ADDITIONAL OS VERSION INFORMATION :
Windows 7
A DESCRIPTION OF THE PROBLEM :
Found that UUID.compareTo() was producing results inconsistent other UUID comparison implementations including the rfc4122 sample implementation. Examined source:
public int compareTo(UUID val) {
// The ordering is intentionally set up so that the UUIDs
// can simply be numerically compared as two numbers
return (this.mostSigBits < val.mostSigBits ? -1 :
(this.mostSigBits > val.mostSigBits ? 1 :
(this.leastSigBits < val.leastSigBits ? -1 :
(this.leastSigBits > val.leastSigBits ? 1 :
0))));
}
It appears that, because mostSigBits and leastSigBits are stored as java longs, that this is a signed comparison when these values should be compared unsigned.
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Perform bytewise comparison of UUID value.
1.6.0_22
ADDITIONAL OS VERSION INFORMATION :
Windows 7
A DESCRIPTION OF THE PROBLEM :
Found that UUID.compareTo() was producing results inconsistent other UUID comparison implementations including the rfc4122 sample implementation. Examined source:
public int compareTo(UUID val) {
// The ordering is intentionally set up so that the UUIDs
// can simply be numerically compared as two numbers
return (this.mostSigBits < val.mostSigBits ? -1 :
(this.mostSigBits > val.mostSigBits ? 1 :
(this.leastSigBits < val.leastSigBits ? -1 :
(this.leastSigBits > val.leastSigBits ? 1 :
0))));
}
It appears that, because mostSigBits and leastSigBits are stored as java longs, that this is a signed comparison when these values should be compared unsigned.
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Perform bytewise comparison of UUID value.
- relates to
-
JDK-8351406 Allow UUID proper comparison
-
- Open
-