openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hthom...@apache.org
Subject svn commit: r1295698 - /openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java
Date Thu, 01 Mar 2012 17:43:03 GMT
Author: hthomann
Date: Thu Mar  1 17:43:03 2012
New Revision: 1295698

URL: http://svn.apache.org/viewvc?rev=1295698&view=rev
Log:
OPENJPA-2055: Added code to account for IPv6 addresses.

Modified:
    openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java?rev=1295698&r1=1295697&r2=1295698&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java
(original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java
Thu Mar  1 17:43:03 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;
     }
 



Mime
View raw message