Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5064537

UUID.nameUUID(String, UUID) method to correspond to declaration in IETF

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Understanding:
      Fix Understood
    • CPU:
      x86
    • OS:
      windows_2000

      Description

      Name: js151677 Date: 06/17/2004


      FULL PRODUCT VERSION :
      jdk-1_5_0-beta3-bin-b55-solaris-sparc-apidocs-09_jun_2004

      ADDITIONAL OS VERSION INFORMATION :
      All / Generic

      A DESCRIPTION OF THE PROBLEM :
      This is a follow up to previously filed report: "internal review ID of: 275617"

      I've confirmed with Rich Salz (IETF author of http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-03.txt) that the spirit of UUID#nameUUIDfromString() and UUID#nameUUIDfromBytes() signature is a name, *AND* a namespace UUID.

      The following is part of the email conversation
      --------------------------------------------------------------
      TR>I had a few questions regarding the version 3 UUID:

      TR> 1) Sun's new java jdk 1.5 beta has introduced a UUID class. Javadocs url: http://java.sun.com/j2se/1.5.0/docs/api/java/util/UUID.html
      My question is that unless I'm misunderstanding the draft-mealling-uuid-urn-03.txt document, Sun's name based UUID has an incorrect method signature. They have UUID.nameUUIDFromString(String) - I've filed a bug report with Sun's bug parade suggesting the correct signature is a String and a UUID. Unless I'm way off, the IETF draft suggests a name _and_ a UUID for the namespace for such a method?

      RS> You are correct, the function maps (uuid,string) to (uuid).
      For example, suppose you want to assign a uuid to every host in DNS?

      REGRESSION. Last worked in version tiger-beta2

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected signatures of:

      static UUID nameUUIDFromBytes(byte[] name, UUID namespace)
                Static factory to retrieve a type 3 (name based) UUID based on the specified byte array.
      static UUID nameUUIDFromString(String name, UUID namespace)
                Static factory to retrieve a type 3 (name based) UUID based on the specified String.

      ACTUAL -
      Need second parameter - a namespace UUID of these methods is missing:

      static UUID nameUUIDFromBytes(byte[] name)
                Static factory to retrieve a type 3 (name based) UUID based on the specified byte array.
      static UUID nameUUIDFromString(String name)
                Static factory to retrieve a type 3 (name based) UUID based on the specified String.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/id/src/test/org/apache/commons/id/uuid/UUIDTest.java?view=markup
      See junit test case method testNameUUIDFromString()

        See also
      http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-03.txt
      Appendix A - Sample Implementation

      IMPORTANT - During testing of the Apache commons-id implementation I found a bug in the Appendix A - Sample Implementation from Mealling URN 03. The sample C code has a "no assignment made" error in the lton/hton function calls. The result is differing outputs on little endian and big endian systems. Changing the code to actually make an assignment during these calls yields the following corrected Appendix B:

      Appendix B. Appendix B - Sample output of utest.c

          uuid_create(): e74453f0-bdf6-11d8-999b-c3a6ad2ff088
          uuid_compare(u,u): 0
          uuid_compare(u, NameSpace_DNS): 1
          uuid_compare(NameSpace_DNS, u): -1
          uuid_create_from_name(): 3d813cbb-47fb-32ba-91df-831e1593ac29

      ---------- END SOURCE ----------
      (Incident Review ID: 280341)
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jssunw Jitender S (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: