You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by mi...@apache.org on 2014/10/03 17:47:06 UTC
svn commit: r1629234 -
/db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java
Author: mikem
Date: Fri Oct 3 15:47:05 2014
New Revision: 1629234
URL: http://svn.apache.org/r1629234
Log:
DERBY-6518: JVMInfo should not use parseFloat() to parse java.specification.version
backported change #1581777 from trunk to 10.10 branch, some manual changes
were necessary as logic did not exactly apply to 10.10 vs 10.11 version.
Change the parse logic so that it recognizes that version 1.10 is greater than 1.9.
Modified:
db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java
Modified: db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java?rev=1629234&r1=1629233&r2=1629234&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java (original)
+++ db/derby/code/branches/10.10/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java Fri Oct 3 15:47:05 2014
@@ -174,16 +174,28 @@ public abstract class JVMInfo
}
else
{
- // aussme our lowest support unless the java spec
- // is greater than our highest level.
- id = J2SE_14;
-
- try {
-
- if (Float.parseFloat(javaVersion) > 1.8f)
+ // Assume our lowest support unless the java spec
+ // is greater than our highest level.
+ id = J2SE_14;
+
+ try {
+
+ // Extract major and minor version out of the spec version.
+ String[] ver = javaVersion.split("[.]");
+ int major = ver.length >= 1 ? Integer.parseInt(ver[0]) : 0;
+ int minor = ver.length >= 2 ? Integer.parseInt(ver[1]) : 0;
+
+ // The highest level currently supported is 1.8. Use that
+ // level if the spec version is greater than or equal to it.
+ final int highestMajor = 1;
+ final int highestMinor = 8;
+ if (major > highestMajor ||
+ (major == highestMajor && minor >= highestMinor)) {
id = J2SE_18;
- } catch (NumberFormatException nfe) {
- }
+ }
+
+ } catch (NumberFormatException nfe) {
+ }
}
}