forked from StarOpenSource/Engine
JvmInformation#getJavaVersion may now crash
This commit is contained in:
parent
cc3cd52d22
commit
5c1fba4ef6
1 changed files with 9 additions and 1 deletions
|
@ -19,6 +19,9 @@
|
||||||
|
|
||||||
package de.staropensource.sosengine.base.data.info;
|
package de.staropensource.sosengine.base.data.info;
|
||||||
|
|
||||||
|
import de.staropensource.sosengine.base.logging.Logger;
|
||||||
|
import de.staropensource.sosengine.base.types.CodePart;
|
||||||
|
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
|
@ -52,7 +55,12 @@ public final class JvmInformation {
|
||||||
version = version.substring(0, version.indexOf("."));
|
version = version.substring(0, version.indexOf("."));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Integer.parseInt(version);
|
try {
|
||||||
|
return Integer.parseInt(version);
|
||||||
|
} catch (NumberFormatException exception) {
|
||||||
|
Logger.crash(new LogIssuer(JvmInformation.class, CodePart.ENGINE), "Could not parse Java version: Integer conversion failed for string \"" + version + "\"");
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue