Monday, September 21, 2009

bug in UUID.randomUUID()

Just a curiosity: I was investigating the excellent function in java.util.UUID to generate an unique ID for my application. While I was browsing the source code, I found that there is a bug here :)

from java.util.UUID:
public static UUID randomUUID() {
....
UUID result = new UUID(randomBytes);
return new UUID(randomBytes);
}

See? UUID result is created, but never used. Seems like this bug was discovered in 2004, but remains unfixed in java 6!!

No comments:

Post a Comment