Uploaded image for project: 'Commons Sandbox'
  1. Commons Sandbox
  2. SANDBOX-307

UUID URN version 5 generation

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: Nightly Builds
    • Fix Version/s: None
    • Component/s: Id
    • Labels:
      None
    • Environment:

      Linux Ubuntu 8.10
      JDK 1.6.10

      Description

      The following test fail with the message:
      org.junit.ComparisonFailure:
      expected:<...:uuid:be6a1b75-9a58-[5]4a8-972e-791dfdd8815...> but was:<...:uuid:be6a1b75-9a58-[3]4a8-972e-791dfdd8815...>
      at org.junit.Assert.assertEquals(Assert.java:123)
      at org.junit.Assert.assertEquals(Assert.java:145)
      at org.davideling.provauuid.ProvaUUIDTest.testUUID(ProvaUUIDTest.java:25)

      public class UUIDVersion5Test {

      // Linux generated URN using the uuid command:
      // davide@mydebian:~$ uuid -v 5 6ba7b811-9dad-11d1-80b4-00c04fd430c8 http://davideling.org/miaApp/2
      // davide@mydebian:~$ be6a1b75-9a58-54a8-972e-791dfdd8815b
      private static final String LINUX_GENERATED_URN = "urn:uuid:be6a1b75-9a58-54a8-972e-791dfdd8815b";

      // URL UUID namespace
      private static final UUID NAMESPACE = new UUID("6ba7b811-9dad-11d1-80b4-00c04fd430c8");

      // Name
      private static final String NAME = "http://davideling.org/miaApp/2";

      @Test
      public void testUUID() throws Exception

      { UUID uuid = UUID.nameUUIDFromString(NAME, NAMESPACE, UUID.SHA1_ENCODING); assertEquals(LINUX_GENERATED_URN, uuid.toUrn() ); }

      }

      When using the SHA1 algorithm with UUID.nameUUIDFromString the version field have to be 5 as the
      Linux uuid generated URN?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              davideling Davide Ling
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: