[Mulgara-svn] r1383 - trunk/src/jar/resolver/java/org/mulgara/resolver

pag at mulgara.org pag at mulgara.org
Tue Dec 2 01:10:13 UTC 2008


Author: pag
Date: 2008-12-01 17:10:12 -0800 (Mon, 01 Dec 2008)
New Revision: 1383

Modified:
   trunk/src/jar/resolver/java/org/mulgara/resolver/OrderByRowComparator.java
Log:
Correctly dealing with numbers that end in d or f

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/OrderByRowComparator.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/OrderByRowComparator.java	2008-12-01 20:30:09 UTC (rev 1382)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/OrderByRowComparator.java	2008-12-02 01:10:12 UTC (rev 1383)
@@ -354,12 +354,13 @@
 
         // if it smells like a numeric (and not a DateTime)
         if (((ch >= '0' && ch <= '9') || ch == '.' || ch == '+' || ch == '-') && text.indexOf('T') < 0) {
-          // The floating parser accepts numbers ending in d or f, but we don't 
-          ch = text.charAt(text.length() - 1);
+          // The floating parser accepts numbers ending in d or f, but we don't
+          String num = text.trim();
+          ch = num.charAt(num.length() - 1);
           if (ch != 'f' && ch != 'F' && ch != 'd' && ch != 'D') {
             try {
               // try to return as a number, using autoboxing
-              return Float.parseFloat(text);
+              return Float.parseFloat(num);
             } catch (NumberFormatException ex) { /* not a number - fall through */ }
           }
         }




More information about the Mulgara-svn mailing list