db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r581704 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
Date Wed, 03 Oct 2007 19:45:26 GMT
Author: kahatlen
Date: Wed Oct  3 12:45:25 2007
New Revision: 581704

URL: http://svn.apache.org/viewvc?rev=581704&view=rev
Log:
DERBY-3100: java.lang.NumberFormatException in test lang.TableFunctionTest

Use locale-sensitive number parsing with NumberFormat instead of
Double.parseDouble().

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java?rev=581704&r1=581703&r2=581704&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
Wed Oct  3 12:45:25 2007
@@ -24,6 +24,7 @@
 import java.lang.reflect.*;
 import java.io.*;
 import java.sql.*;
+import java.text.NumberFormat;
 import java.util.ArrayList;
 
 import org.apache.derby.shared.common.reference.JDBC40Translation;
@@ -1650,11 +1651,14 @@
 
             if ( idx < 0 ) { continue; }
 
-            String  remnant = line.substring( idx + tag.length() );
-            double  result = Double.parseDouble( remnant );
+            String remnant = line.substring(idx + tag.length()).trim();
+
+            // Use NumberFormat.parse() instead of Double.parseDouble() to
+            // avoid localization issues (DERBY-3100)
+            Number result = NumberFormat.getInstance().parse(remnant);
             
             println( "Read " + result + " from optimizer output." );
-            return result;
+            return result.doubleValue();
         }
 
         return 0.0;



Mime
View raw message