Merge pull request #439 from Stzx/master

Improvement JavaVersion get method
This commit is contained in:
Bruno P. Kinoshita 2019-08-25 10:54:10 +12:00 committed by GitHub
commit e610367507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -194,7 +194,9 @@ static JavaVersion getJavaVersion(final String nom) {
* version is unknown
*/
static JavaVersion get(final String nom) {
if ("0.9".equals(nom)) {
if (nom == null) {
return null;
} else if ("0.9".equals(nom)) {
return JAVA_0_9;
} else if ("1.1".equals(nom)) {
return JAVA_1_1;
@ -223,9 +225,6 @@ static JavaVersion get(final String nom) {
} else if ("13".equals(nom)) {
return JAVA_13;
}
if (nom == null) {
return null;
}
final float v = toFloatVersion(nom);
if ((v - 1.) < 1.) { // then we need to check decimals > .9
final int firstComma = Math.max(nom.indexOf('.'), nom.indexOf(','));