openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hthom...@apache.org
Subject svn commit: r1179900 - /openjpa/branches/2.1.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java
Date Thu, 06 Oct 2011 23:34:54 GMT
Author: hthomann
Date: Thu Oct  6 23:34:54 2011
New Revision: 1179900

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

Modified:
    openjpa/branches/2.1.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java

Modified: openjpa/branches/2.1.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java?rev=1179900&r1=1179899&r2=1179900&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java
(original)
+++ openjpa/branches/2.1.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java
Thu Oct  6 23:34:54 2011
@@ -115,10 +115,16 @@ public class UUIDGenerator {
         } catch (IOException ioe) {
             throw new NestableRuntimeException(ioe);
         }
-
+        
         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