Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Refactor Java version output in web3_clientVersion #2679

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

rmoreliovlabs
Copy link
Contributor

@rmoreliovlabs rmoreliovlabs commented Aug 12, 2024

Update Java Version Reporting in web3_clientVersion RPC Call

Description

Currently, the web3_clientVersion() RPC call always returns a hardcoded Java version string, such as Java1.8, in the client version string (e.g., RskJ/6.3.1/Linux/Java1.8/ARROWHEAD-27cba5598). We need to update this functionality to return the actual Java major version in the format Java<MAJOR_VERSION> (e.g., Java8, Java17, etc.)

Motivation and Context

Providing the real Java major version in the web3_clientVersion RPC call will enhance accuracy and help users and developers better understand the Java environment in use. This improvement is crucial for debugging and ensuring compatibility with various Java versions.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • Tests for the changes have been added (for bug fixes / features)
  • Requires Activation Code (Hard Fork)
  • Other information:

@rmoreliovlabs rmoreliovlabs force-pushed the web3-client-java-version-fix branch from a2caf4a to 8564a27 Compare August 12, 2024 15:19
@rmoreliovlabs rmoreliovlabs force-pushed the web3-client-java-version-fix branch from 50d1e4e to e823855 Compare August 13, 2024 19:29
Copy link

Copy link
Contributor

@fmacleal fmacleal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


public static String getFormattedJavaVersion(){
String javaVersion = System.getProperty("java.specification.version");
String javaMajorVersion = javaVersion.replace("1.", "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want we could add a check that the provided result has the format 1.x, but it is a minor thing.

@Vovchyk Vovchyk merged commit 78a6dc0 into master Sep 16, 2024
9 of 10 checks passed
@Vovchyk Vovchyk deleted the web3-client-java-version-fix branch September 16, 2024 08:13
@aeidelman aeidelman added this to the Arrowhead 6.4.0 milestone Oct 30, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants