Bug#904493: Cause of the error found, proposal of solution
wzabolot at elektron.elka.pw.edu.pl
wzabolot at elektron.elka.pw.edu.pl
Tue Jul 24 21:06:16 BST 2018
The source of the problem is obviously the implementation of the
getJavaVersion function (in Utils.Java).
It does not accept Java 11 that reports its version as a two character
string "11":
/**
* Returns the main version number of the current JRE, e.g.
* 1.4 for version 1.4.2_03
*/
public static double getJavaVersion() {
String vm_version = System.getProperty("java.version");
if (vm_version == null)
return Double.NaN;
if (vm_version.startsWith("1.4.2"))
return 1.42;
else
vm_version = vm_version.substring(0, 3);
try {
return Double.parseDouble(vm_version);
} catch (Exception e) {
return Double.NaN;
}
}
I'd suggest modification of the above function so, that truncates the
string at the second point (if it exists) and then converts the string
to the number.
Regards,
Wojtek
More information about the pkg-java-maintainers
mailing list