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

Runtime.Version.parse() fails with 0 as the last character

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      openjdk version "21.0.2" 2024-01-16 LTS
      OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
      OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode, sharing)


      A DESCRIPTION OF THE PROBLEM :
      When trying to parse a version that ends with 0, i.e.

      Runtime.Version.parse("1.0.0");

      I get "java.lang.IllegalArgumentException: Invalid version string: '1.0.0'"

      This has worked before, although not sure in which version exactly.

      REGRESSION : Last worked in version 11

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      See "source code"

      javac .\Test.java
      java Test

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Valid java.lang.Runtime.Version instance
      ACTUAL -
      Exception in thread "main" java.lang.IllegalArgumentException: Invalid version string: '1.0.0'
              at java.base/java.lang.Runtime$Version.parse(Runtime.java:1122)
              at Test.main(Test.java:3)

      ---------- BEGIN SOURCE ----------
      public class Test {
          public static void main(String[] args) {
              Runtime.Version.parse("1.0.0");
          }
      }

      ---------- END SOURCE ----------

      FREQUENCY : always


            tongwan Andrew Wang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: