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

UUID.fromString() is too lax

XMLWordPrintable

    • x86_64
    • windows_10

      ADDITIONAL SYSTEM INFORMATION :
      64-bit Windows 10. Java runtime: Azul Zulu; Zulu 11.29+3 686fa9062e1b ; corresponding to JRE 11.0.2

      A DESCRIPTION OF THE PROBLEM :
      An invalid (too short) UUID string is parsed successfully, i.e., without exception.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Call UUID.fromString on a too short string, for example UUID.fromString("fecf3e99-0422-4936-9b9e-348a7e1fa5");

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Throws exception.
      ACTUAL -
      fromString("fecf3e99-0422-4936-9b9e-348a7e1fa5") succeeds and constructs an UUID object with the value fecf3e99-0422-4936-9b9e-00348a7e1fa5 (note the leading 00 in the last group).

      CUSTOMER SUBMITTED WORKAROUND :
      Manual check that the lengt of input string equals to 36 before calling UUID.fromString().

      FREQUENCY : always


            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: