diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java index a9028a638..dbb26ac9d 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/UUIDGenerator.java @@ -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; }