commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r949223 - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/SystemUtils.java test/java/org/apache/commons/lang3/SystemUtilsTest.java
Date Fri, 28 May 2010 16:33:23 GMT
Author: ggregory
Date: Fri May 28 16:33:23 2010
New Revision: 949223

URL: http://svn.apache.org/viewvc?rev=949223&view=rev
Log:
(LANG-624) SystemUtils.getJavaVersionAsFloat throws StringIndexOutOfBoundsException on Android
runtime/Dalvik VM. Oops, fix return type.

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java?rev=949223&r1=949222&r2=949223&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java Fri
May 28 16:33:23 2010
@@ -1669,7 +1669,7 @@ public class SystemUtils {
      * 
      * @return the version, for example 131 for Java 1.3.1
      */
-    static float toJavaVersionInt(String version) {
+    static int toJavaVersionInt(String version) {
         return toVersionInt(toJavaVersionIntArray(version, JAVA_VERSION_TRIM_SIZE));
     }
 

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java?rev=949223&r1=949222&r2=949223&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
Fri May 28 16:33:23 2010
@@ -207,22 +207,22 @@ public class SystemUtilsTest extends Tes
     }
 
     public void testJavaVersionAsInt() {
-        assertEquals(0, SystemUtils.toJavaVersionInt(null), 0.000001f);
-        assertEquals(0, SystemUtils.toJavaVersionInt(""), 0.000001f);
-        assertEquals(0, SystemUtils.toJavaVersionInt("0"), 0.000001f);
-        assertEquals(110, SystemUtils.toJavaVersionInt("1.1"), 0.000001f);
-        assertEquals(120, SystemUtils.toJavaVersionInt("1.2"), 0.000001f);
-        assertEquals(130, SystemUtils.toJavaVersionInt("1.3.0"), 0.000001f);
-        assertEquals(131, SystemUtils.toJavaVersionInt("1.3.1"), 0.000001f);
-        assertEquals(140, SystemUtils.toJavaVersionInt("1.4.0"), 0.000001f);
-        assertEquals(141, SystemUtils.toJavaVersionInt("1.4.1"), 0.000001f);
-        assertEquals(142, SystemUtils.toJavaVersionInt("1.4.2"), 0.000001f);
-        assertEquals(150, SystemUtils.toJavaVersionInt("1.5.0"), 0.000001f);
-        assertEquals(160, SystemUtils.toJavaVersionInt("1.6.0"), 0.000001f);
-        assertEquals(131, SystemUtils.toJavaVersionInt("JavaVM-1.3.1"), 0.000001f);
-        assertEquals(131, SystemUtils.toJavaVersionInt("1.3.1 subset"), 0.000001f);
+        assertEquals(0, SystemUtils.toJavaVersionInt(null));
+        assertEquals(0, SystemUtils.toJavaVersionInt(""));
+        assertEquals(0, SystemUtils.toJavaVersionInt("0"));
+        assertEquals(110, SystemUtils.toJavaVersionInt("1.1"));
+        assertEquals(120, SystemUtils.toJavaVersionInt("1.2"));
+        assertEquals(130, SystemUtils.toJavaVersionInt("1.3.0"));
+        assertEquals(131, SystemUtils.toJavaVersionInt("1.3.1"));
+        assertEquals(140, SystemUtils.toJavaVersionInt("1.4.0"));
+        assertEquals(141, SystemUtils.toJavaVersionInt("1.4.1"));
+        assertEquals(142, SystemUtils.toJavaVersionInt("1.4.2"));
+        assertEquals(150, SystemUtils.toJavaVersionInt("1.5.0"));
+        assertEquals(160, SystemUtils.toJavaVersionInt("1.6.0"));
+        assertEquals(131, SystemUtils.toJavaVersionInt("JavaVM-1.3.1"));
+        assertEquals(131, SystemUtils.toJavaVersionInt("1.3.1 subset"));
         // This used to return 0f in [lang] version 2.5:
-        assertEquals(130, SystemUtils.toJavaVersionInt("XXX-1.3.x"), 0.000001f);
+        assertEquals(130, SystemUtils.toJavaVersionInt("XXX-1.3.x"));
     }
 
     public void testJavaVersionAtLeastFloat() {



Mime
View raw message