From 6cd1b3d26bebf16ca7fb407758f667fad4bd6c55 Mon Sep 17 00:00:00 2001 From: halibobo1205 Date: Thu, 25 Jul 2024 15:43:56 +0800 Subject: [PATCH] feat(json-rpc/web3ClientVersion): use java.specification.version for jdk version retrieval - use `java.specification.version` instead of parsing `java.version` - ensure consistent version reporting across different Java releases(jdk10+) --- .../org/tron/core/services/jsonrpc/TronJsonRpcImpl.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/framework/src/main/java/org/tron/core/services/jsonrpc/TronJsonRpcImpl.java b/framework/src/main/java/org/tron/core/services/jsonrpc/TronJsonRpcImpl.java index 0ca57a3b98c..7104ecc4346 100644 --- a/framework/src/main/java/org/tron/core/services/jsonrpc/TronJsonRpcImpl.java +++ b/framework/src/main/java/org/tron/core/services/jsonrpc/TronJsonRpcImpl.java @@ -24,7 +24,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; -import java.util.regex.Matcher; import java.util.regex.Pattern; import lombok.Getter; import lombok.extern.slf4j.Slf4j; @@ -226,15 +225,11 @@ public static void handleLogsFilter(LogsFilterCapsule logsFilterCapsule) { @Override public String web3ClientVersion() { - Pattern shortVersion = Pattern.compile("(\\d\\.\\d).*"); - Matcher matcher = shortVersion.matcher(System.getProperty("java.version")); - matcher.matches(); - return String.join("/", Arrays.asList( "TRON", "v" + Version.getVersion(), System.getProperty("os.name"), - "Java" + matcher.group(1))); + "Java" + System.getProperty("java.specification.version"))); } @Override