VersionProps.versionNumbers() incorrectly parses a Java version string because it doesn't skip the separating dots. The current version only works for one digit versions like "9" but will fail for any longer version string like for example "9.0.0.1" with:
at java.lang.NumberFormatException.forInputString(java.base@9.0.0.1-internal/NumberFormatException.java:65)
at java.lang.Integer.parseInt(java.base@9.0.0.1-internal/Integer.java:791)
at java.lang.VersionProps.versionNumbers(java.base@9.0.0.1-internal/VersionProps.java:76)
at java.lang.Runtime.version(java.base@9.0.0.1-internal/Runtime.java:940)
This also breaks the build which uses a newly built jdk for bootstrapping:
Generating lib/classlist
/priv/d046063/OpenJDK/output-jdk9-dev-opt/support/interim-image/bin/java -XX:DumpLoadedClassList=/priv/d046063/OpenJDK/output-jdk9-dev-opt/support/classlist/classlist.tmp \
-cp /priv/d046063/OpenJDK/output-jdk9-dev-opt/support/classlist.jar \
build.tools.classlist.HelloClasslist 2>&1
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.ExceptionInInitializerError
at jdk.internal.loader.URLClassPath$JarLoader.getJarFile(java.base@9.0.0.1-internal/URLClassPath.java:697)
at jdk.internal.loader.URLClassPath$JarLoader.access$600(java.base@9.0.0.1-internal/URLClassPath.java:586)
at jdk.internal.loader.URLClassPath$JarLoader$1.run(java.base@9.0.0.1-internal/URLClassPath.java:642)
at jdk.internal.loader.URLClassPath$JarLoader$1.run(java.base@9.0.0.1-internal/URLClassPath.java:635)
at java.security.AccessController.doPrivileged(java.base@9.0.0.1-internal/Native Method)
at jdk.internal.loader.URLClassPath$JarLoader.ensureOpen(java.base@9.0.0.1-internal/URLClassPath.java:634)
at jdk.internal.loader.URLClassPath$JarLoader.<init>(java.base@9.0.0.1-internal/URLClassPath.java:609)
at jdk.internal.loader.URLClassPath$3.run(java.base@9.0.0.1-internal/URLClassPath.java:389)
at jdk.internal.loader.URLClassPath$3.run(java.base@9.0.0.1-internal/URLClassPath.java:373)
at java.security.AccessController.doPrivileged(java.base@9.0.0.1-internal/Native Method)
at jdk.internal.loader.URLClassPath.getLoader(java.base@9.0.0.1-internal/URLClassPath.java:372)
at jdk.internal.loader.URLClassPath.getLoader(java.base@9.0.0.1-internal/URLClassPath.java:349)
at jdk.internal.loader.URLClassPath.getResource(java.base@9.0.0.1-internal/URLClassPath.java:215)
at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9.0.0.1-internal/BuiltinClassLoader.java:463)
at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9.0.0.1-internal/BuiltinClassLoader.java:460)
at java.security.AccessController.doPrivileged(java.base@9.0.0.1-internal/Native Method)
at jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(java.base@9.0.0.1-internal/BuiltinClassLoader.java:459)
at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(java.base@9.0.0.1-internal/BuiltinClassLoader.java:406)
at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@9.0.0.1-internal/BuiltinClassLoader.java:364)
at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@9.0.0.1-internal/ClassLoaders.java:185)
at java.lang.ClassLoader.loadClass(java.base@9.0.0.1-internal/ClassLoader.java:419)
at sun.launcher.LauncherHelper.loadMainClass(java.base@9.0.0.1-internal/LauncherHelper.java:587)
at sun.launcher.LauncherHelper.checkAndLoadMain(java.base@9.0.0.1-internal/LauncherHelper.java:499)
Caused by: java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(java.base@9.0.0.1-internal/NumberFormatException.java:65)
at java.lang.Integer.parseInt(java.base@9.0.0.1-internal/Integer.java:791)
at java.lang.VersionProps.versionNumbers(java.base@9.0.0.1-internal/VersionProps.java:76)
at java.lang.Runtime.version(java.base@9.0.0.1-internal/Runtime.java:940)
at java.util.jar.JarFile.<clinit>(java.base@9.0.0.1-internal/JarFile.java:156)
... 23 more
make[3]: *** [/priv/d046063/OpenJDK/output-jdk9-dev-opt/support/classlist/classlist] Error 1
make[3]: Leaving directory `/net/usr.work/d046063/OpenJDK/jdk9-dev/jdk/make'
make[2]: *** [generate-classlist] Error 1
make[2]: Leaving directory `/net/usr.work/d046063/OpenJDK/jdk9-dev'
at java.lang.NumberFormatException.forInputString(java.base@9.0.0.1-internal/NumberFormatException.java:65)
at java.lang.Integer.parseInt(java.base@9.0.0.1-internal/Integer.java:791)
at java.lang.VersionProps.versionNumbers(java.base@9.0.0.1-internal/VersionProps.java:76)
at java.lang.Runtime.version(java.base@9.0.0.1-internal/Runtime.java:940)
This also breaks the build which uses a newly built jdk for bootstrapping:
Generating lib/classlist
/priv/d046063/OpenJDK/output-jdk9-dev-opt/support/interim-image/bin/java -XX:DumpLoadedClassList=/priv/d046063/OpenJDK/output-jdk9-dev-opt/support/classlist/classlist.tmp \
-cp /priv/d046063/OpenJDK/output-jdk9-dev-opt/support/classlist.jar \
build.tools.classlist.HelloClasslist 2>&1
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.ExceptionInInitializerError
at jdk.internal.loader.URLClassPath$JarLoader.getJarFile(java.base@9.0.0.1-internal/URLClassPath.java:697)
at jdk.internal.loader.URLClassPath$JarLoader.access$600(java.base@9.0.0.1-internal/URLClassPath.java:586)
at jdk.internal.loader.URLClassPath$JarLoader$1.run(java.base@9.0.0.1-internal/URLClassPath.java:642)
at jdk.internal.loader.URLClassPath$JarLoader$1.run(java.base@9.0.0.1-internal/URLClassPath.java:635)
at java.security.AccessController.doPrivileged(java.base@9.0.0.1-internal/Native Method)
at jdk.internal.loader.URLClassPath$JarLoader.ensureOpen(java.base@9.0.0.1-internal/URLClassPath.java:634)
at jdk.internal.loader.URLClassPath$JarLoader.<init>(java.base@9.0.0.1-internal/URLClassPath.java:609)
at jdk.internal.loader.URLClassPath$3.run(java.base@9.0.0.1-internal/URLClassPath.java:389)
at jdk.internal.loader.URLClassPath$3.run(java.base@9.0.0.1-internal/URLClassPath.java:373)
at java.security.AccessController.doPrivileged(java.base@9.0.0.1-internal/Native Method)
at jdk.internal.loader.URLClassPath.getLoader(java.base@9.0.0.1-internal/URLClassPath.java:372)
at jdk.internal.loader.URLClassPath.getLoader(java.base@9.0.0.1-internal/URLClassPath.java:349)
at jdk.internal.loader.URLClassPath.getResource(java.base@9.0.0.1-internal/URLClassPath.java:215)
at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9.0.0.1-internal/BuiltinClassLoader.java:463)
at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9.0.0.1-internal/BuiltinClassLoader.java:460)
at java.security.AccessController.doPrivileged(java.base@9.0.0.1-internal/Native Method)
at jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(java.base@9.0.0.1-internal/BuiltinClassLoader.java:459)
at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(java.base@9.0.0.1-internal/BuiltinClassLoader.java:406)
at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@9.0.0.1-internal/BuiltinClassLoader.java:364)
at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@9.0.0.1-internal/ClassLoaders.java:185)
at java.lang.ClassLoader.loadClass(java.base@9.0.0.1-internal/ClassLoader.java:419)
at sun.launcher.LauncherHelper.loadMainClass(java.base@9.0.0.1-internal/LauncherHelper.java:587)
at sun.launcher.LauncherHelper.checkAndLoadMain(java.base@9.0.0.1-internal/LauncherHelper.java:499)
Caused by: java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(java.base@9.0.0.1-internal/NumberFormatException.java:65)
at java.lang.Integer.parseInt(java.base@9.0.0.1-internal/Integer.java:791)
at java.lang.VersionProps.versionNumbers(java.base@9.0.0.1-internal/VersionProps.java:76)
at java.lang.Runtime.version(java.base@9.0.0.1-internal/Runtime.java:940)
at java.util.jar.JarFile.<clinit>(java.base@9.0.0.1-internal/JarFile.java:156)
... 23 more
make[3]: *** [/priv/d046063/OpenJDK/output-jdk9-dev-opt/support/classlist/classlist] Error 1
make[3]: Leaving directory `/net/usr.work/d046063/OpenJDK/jdk9-dev/jdk/make'
make[2]: *** [generate-classlist] Error 1
make[2]: Leaving directory `/net/usr.work/d046063/OpenJDK/jdk9-dev'
- relates to
-
JDK-8160000 Runtime.version() cause startup regressions in 9+119
- Closed
-
JDK-8160564 TEST: Add a test to check the implementation of VersionProps.versionNumbers()
- Closed