This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.* | |
import java.util.UUID | |
// java.util.UUID.fromString doesn't enforce string representation of UUID https://www.ietf.org/rfc/rfc4122.txt | |
// It requires 4 '-' to present with any hex numbers in between. So it treats 1-1-1-1-1 as a valid UUID | |
// I don't think it's valid string representation of UUID. RFC4122 also doesn't think so | |
// Open JDK bug: https://bugs.openjdk.java.net/browse/JDK-8216407 | |
// That's why we have our own UUID parser here | |
// Taken from here https://github.com/openjdk/jdk/blob/f485171ce8c7e9c9d7d2c24e1807efaa6ff137e8/src/java.base/share/classes/java/util/UUID.java#L212-L259 | |
// But without "wrong" part |