You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/11/11 19:49:40 UTC

svn commit: r1034038 - /myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/TypedNumberConverter.java

Author: lu4242
Date: Thu Nov 11 18:49:40 2010
New Revision: 1034038

URL: http://svn.apache.org/viewvc?rev=1034038&view=rev
Log:
MYFACES-1890 Numberconverter has issue with bigdecimal

Modified:
    myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/TypedNumberConverter.java

Modified: myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/TypedNumberConverter.java
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/TypedNumberConverter.java?rev=1034038&r1=1034037&r2=1034038&view=diff
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/TypedNumberConverter.java (original)
+++ myfaces/commons/trunk/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/TypedNumberConverter.java Thu Nov 11 18:49:40 2010
@@ -190,15 +190,19 @@ public class TypedNumberConverter implem
                 // to prevent loss in precision, and do not break existing examples (since
                 // in those cases it is expected to return Double). See MYFACES-1890 and TRINIDAD-1124
                 // for details
-                ValueExpression valueBinding = uiComponent.getValueExpression("value");
-                if (valueBinding != null)
+                Class destType = getDestType(); 
+                if (destType == null)
                 {
-                    Class<?> destType = valueBinding.getType(facesContext.getELContext());
-                    if (destType != null && BigDecimal.class.isAssignableFrom(destType))
+                    ValueExpression valueBinding = uiComponent.getValueExpression("value");
+                    if (valueBinding != null)
                     {
-                        df.setParseBigDecimal(true);
+                        destType = valueBinding.getType(facesContext.getELContext());
                     }
                 }
+                if (destType != null && BigDecimal.class.isAssignableFrom(destType))
+                {
+                    df.setParseBigDecimal(true);
+                }
                 
                 DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
                 boolean changed = false;