Skip to content

Fix major Java version parsing#176

Merged
headius merged 1 commit into
jnr:masterfrom
pepijnve:issue_175
Feb 5, 2026
Merged

Fix major Java version parsing#176
headius merged 1 commit into
jnr:masterfrom
pepijnve:issue_175

Conversation

@pepijnve

Copy link
Copy Markdown
Contributor

The current parsing logic in the constructor of Platform incorrectly splits the java version string. A value like 25.0.1 is split using the regex [^0-9.]. Since that regex does not match any character in the version string, the string is not split into parts. The code then tries to parse 25.0.1 as an integer which fails. As a consequence the returned major version number is the default value of 8 instead.

This PR makes the parsing logic more robust by using a regex to extract the major version number instead of string splitting.

@headius headius merged commit 18042ed into jnr:master Feb 5, 2026
@headius headius added this to the 1.3.15 milestone Feb 5, 2026
@headius

headius commented Feb 5, 2026

Copy link
Copy Markdown
Member

Thank you!

headius added a commit that referenced this pull request Mar 9, 2026
Not sure if these are running anywhere yet due to build issues.

See #176

See #184
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants