You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/11/09 07:02:27 UTC

[iotdb] 01/02: [ISSUE-7941] Fix NumberFormatException when JDK version is 17-internal

This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch fix_java_version
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 623bccd2259e163e466736b934e2fa9bbd1d2549
Author: HTHou <hh...@outlook.com>
AuthorDate: Wed Nov 9 15:01:44 2022 +0800

    [ISSUE-7941] Fix NumberFormatException when JDK version is 17-internal
---
 .../src/main/java/org/apache/iotdb/commons/utils/JVMCommonUtils.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/utils/JVMCommonUtils.java b/node-commons/src/main/java/org/apache/iotdb/commons/utils/JVMCommonUtils.java
index a0a80cf33e..1236878082 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/utils/JVMCommonUtils.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/utils/JVMCommonUtils.java
@@ -40,7 +40,8 @@ public class JVMCommonUtils {
    * @return JDK version (int type)
    */
   public static int getJdkVersion() {
-    String[] javaVersionElements = System.getProperty("java.version").split("\\.");
+    String[] javaVersionElements =
+        System.getProperty("java.version").split("-internal")[0].split("\\.");
     if (Integer.parseInt(javaVersionElements[0]) == 1) {
       return Integer.parseInt(javaVersionElements[1]);
     } else {