Author: hthomann
Date: Thu Mar 1 19:27:26 2012
New Revision: 1295754
URL: http://svn.apache.org/viewvc?rev=1295754&view=rev
Log:
OPENJPA-2055: Added code to account for IPv6 addresses.
Modified:
openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java
Modified:
openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java
URL:
http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java?rev=1295754&r1=1295753&r2=1295754&view=diff
==============================================================================
---
openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java
(original)
+++
openjpa/branches/2.2.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java
Thu Mar 1 19:27:26 2012
@@ -118,7 +118,13 @@ public class UUIDGenerator {
IP = new byte[6];
RANDOM.nextBytes(IP);
- System.arraycopy(ip, 0, IP, 2, ip.length);
+
+ //OPENJPA-2055: account for the fact that 'getAddress'
+ //may return an IPv6 address which is 16 bytes wide.
+ for( int i = 0 ; i < ip.length; ++i ) {
+ IP[2+(i%4)] ^= ip[i];
+ }
+
type1Initialized = true;
}