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;
}
|