mirror of
https://github.com/SKCraft/Launcher.git
synced 2024-11-24 12:16:28 +01:00
Fix Java version parser to tolerate missing minor version
Some (all?) Java 17 release files don't have the minor version present, so a previous assumption no longer holds.
This commit is contained in:
parent
9bd7df4d3c
commit
cd063304fb
@ -33,11 +33,7 @@ public class JavaRuntime implements Comparable<JavaRuntime> {
|
|||||||
|
|
||||||
String[] parts = version.split("\\.");
|
String[] parts = version.split("\\.");
|
||||||
|
|
||||||
if (parts.length < 2) {
|
if (parts[0].equals("1") && parts.length > 1) {
|
||||||
throw new IllegalArgumentException("Invalid Java runtime version: " + version);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parts[0].equals("1")) {
|
|
||||||
return Integer.parseInt(parts[1]);
|
return Integer.parseInt(parts[1]);
|
||||||
} else {
|
} else {
|
||||||
return Integer.parseInt(parts[0]);
|
return Integer.parseInt(parts[0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user