Handle versions of the form 1.5.0 as well as 1.5.0_05.
This commit is contained in:
@@ -538,7 +538,7 @@ public class Application
|
|||||||
|
|
||||||
// parse the version out of the java.version system property
|
// parse the version out of the java.version system property
|
||||||
String verstr = System.getProperty("java.version");
|
String verstr = System.getProperty("java.version");
|
||||||
Matcher m = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)_(\\d+)").matcher(verstr);
|
Matcher m = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)(_\\d+)?").matcher(verstr);
|
||||||
if (!m.matches()) {
|
if (!m.matches()) {
|
||||||
// if we can't parse the java version we're in weird land and should probably just try
|
// if we can't parse the java version we're in weird land and should probably just try
|
||||||
// our luck with what we've got rather than try to download a new jvm
|
// our luck with what we've got rather than try to download a new jvm
|
||||||
@@ -550,7 +550,7 @@ public class Application
|
|||||||
int one = Integer.parseInt(m.group(1)); // will there ever be a two?
|
int one = Integer.parseInt(m.group(1)); // will there ever be a two?
|
||||||
int major = Integer.parseInt(m.group(2));
|
int major = Integer.parseInt(m.group(2));
|
||||||
int minor = Integer.parseInt(m.group(3));
|
int minor = Integer.parseInt(m.group(3));
|
||||||
int patch = Integer.parseInt(m.group(4));
|
int patch = m.group(4) == null ? 0 : Integer.parseInt(m.group(4).substring(1));
|
||||||
int version = patch + 100 * (minor + 100 * (major + 100 * one));
|
int version = patch + 100 * (minor + 100 * (major + 100 * one));
|
||||||
return version >= _javaVersion;
|
return version >= _javaVersion;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user