LANG-1384: Fix NPE when version >= 11

The fix is likely to be insufficient if the version naming scheme changes.
This commit is contained in:
Gilles Sadowski 2018-03-08 13:17:00 +01:00
parent 0820c4c895
commit cb686673a7
2 changed files with 3 additions and 0 deletions

View File

@ -191,6 +191,8 @@ static JavaVersion get(final String nom) {
if (Float.parseFloat(nom.substring(firstComma + 1, end)) > .9f) {
return JAVA_RECENT;
}
} else if (v > 10) {
return JAVA_RECENT;
}
return null;
}

View File

@ -59,6 +59,7 @@ public void testGetJavaVersion() {
assertEquals("1.10 failed", JAVA_RECENT, get("1.10"));
// assertNull("2.10 unexpectedly worked", get("2.10"));
assertEquals("Wrapper method failed", get("1.5"), getJavaVersion("1.5"));
assertEquals("Unhandled", JAVA_RECENT, get("11")); // LANG-1384
}
@Test