Revision: 2724
          http://vexi.svn.sourceforge.net/vexi/?rev=2724&view=rev
Author:   clrg
Date:     2008-01-13 05:15:59 -0800 (Sun, 13 Jan 2008)

Log Message:
-----------
Fix launchpad bug 182456 - <ui:box text="-" /> causing 
java.lang.NumberFormatException

Modified Paths:
--------------
    trunk/core/org.vexi.core/src/org/vexi/core/TemplateBuilder.java

Modified: trunk/core/org.vexi.core/src/org/vexi/core/TemplateBuilder.java
===================================================================
--- trunk/core/org.vexi.core/src/org/vexi/core/TemplateBuilder.java     
2008-01-11 16:27:35 UTC (rev 2723)
+++ trunk/core/org.vexi.core/src/org/vexi/core/TemplateBuilder.java     
2008-01-13 13:15:59 UTC (rev 2724)
@@ -244,15 +244,19 @@
                 else {
                     boolean hasNonNumeral = false;
                     boolean periodUsed = false;
-                    for(int j=0; j<valString.length(); j++)
+                    for(int j=0; j<valString.length(); j++) {
                         if (j == 0 && valString.charAt(j) == '-') {
+                               // just a single '-' is not a number
+                               if (valString.length()==1) hasNonNumeral = true;
                         } else if (valString.charAt(j) == '.' && !periodUsed 
&& j != valString.length() - 1) {
                             periodUsed = true;
                         } else if (!Character.isDigit(valString.charAt(j))) {
                             hasNonNumeral = true;
                             break;
                         }
-                    if (valString.length() > 0 && !hasNonNumeral) t.vals[i] = 
JSU.N(Double.parseDouble((valString)));
+                    }
+                    if (valString.length() > 0 && !hasNonNumeral)
+                       t.vals[i] = JSU.N(periodUsed ? 
Double.parseDouble(valString) : Integer.parseInt(valString));
                     else t.vals[i] = JSU.S(valString.intern()); // FEATURE: 
JS.intern() ?
                 }
             }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to