Skip to content

Commit

Permalink
feat(json-rpc/web3ClientVersion): use java.specification.version for …
Browse files Browse the repository at this point in the history
…jdk version retrieval

  - use `java.specification.version` instead of parsing `java.version`
  - ensure consistent version reporting across different Java releases(jdk10+)
  • Loading branch information
halibobo1205 committed Nov 22, 2024
1 parent 055ef97 commit 6cd1b3d
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6cd1b3d

Please sign in to comment.