db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1581777 - /db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java
Date Wed, 26 Mar 2014 10:09:20 GMT
Author: kahatlen
Date: Wed Mar 26 10:09:20 2014
New Revision: 1581777

URL: http://svn.apache.org/r1581777
Log:
DERBY-6518: JVMInfo should not use parseFloat() to parse java.specification.version

Change the parse logic so that it recognizes that version 1.10 is greater than 1.9.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java?rev=1581777&r1=1581776&r2=1581777&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/JVMInfo.java Wed Mar
26 10:09:20 2014
@@ -120,8 +120,20 @@ public abstract class JVMInfo
 
             try {
 
-                if (Float.parseFloat(javaVersion) > 1.8f)
+                // 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) {
             }
         }



Mime
View raw message