Improvement JavaVersion get method
When nom is null, return directly without unnecessary judgment.
This commit is contained in:
parent
add397b177
commit
c2b082b54a
|
@ -194,7 +194,9 @@ public enum JavaVersion {
|
||||||
* version is unknown
|
* version is unknown
|
||||||
*/
|
*/
|
||||||
static JavaVersion get(final String nom) {
|
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;
|
return JAVA_0_9;
|
||||||
} else if ("1.1".equals(nom)) {
|
} else if ("1.1".equals(nom)) {
|
||||||
return JAVA_1_1;
|
return JAVA_1_1;
|
||||||
|
@ -223,9 +225,6 @@ public enum JavaVersion {
|
||||||
} else if ("13".equals(nom)) {
|
} else if ("13".equals(nom)) {
|
||||||
return JAVA_13;
|
return JAVA_13;
|
||||||
}
|
}
|
||||||
if (nom == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final float v = toFloatVersion(nom);
|
final float v = toFloatVersion(nom);
|
||||||
if ((v - 1.) < 1.) { // then we need to check decimals > .9
|
if ((v - 1.) < 1.) { // then we need to check decimals > .9
|
||||||
final int firstComma = Math.max(nom.indexOf('.'), nom.indexOf(','));
|
final int firstComma = Math.max(nom.indexOf('.'), nom.indexOf(','));
|
||||||
|
|
Loading…
Reference in New Issue