myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1178543 - /myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertNumberTag.java
Date Mon, 03 Oct 2011 19:52:42 GMT
Author: lu4242
Date: Mon Oct  3 19:52:41 2011
New Revision: 1178543

URL: http://svn.apache.org/viewvc?rev=1178543&view=rev
Log:
MYFACES-3343 f:convertNumber in jsp only accept Locale instance into its locale attribute

Modified:
    myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertNumberTag.java

Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertNumberTag.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertNumberTag.java?rev=1178543&r1=1178542&r2=1178543&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertNumberTag.java
(original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertNumberTag.java
Mon Oct  3 19:52:41 2011
@@ -20,6 +20,7 @@ package org.apache.myfaces.taglib.core;
 
 
 import org.apache.myfaces.shared_impl.taglib.UIComponentELTagUtils;
+import org.apache.myfaces.shared_impl.util.LocaleUtils;
 
 import javax.el.ELContext;
 import javax.el.ValueExpression;
@@ -150,10 +151,19 @@ public class ConvertNumberTag
             Locale locale;
             if (_locale.isLiteralText())
             {
-                locale = new Locale(_locale.getExpressionString());
-            } else
+                locale = LocaleUtils.toLocale(_locale.getExpressionString());
+            }
+            else
             {
-                locale = (Locale) _locale.getValue(elContext);
+                Object localeValue = _locale.getValue(elContext);
+                if (localeValue instanceof Locale)
+                {
+                    locale = (Locale)localeValue;
+                }
+                else
+                {
+                    locale = LocaleUtils.toLocale(localeValue.toString());
+                }
                 if (null == locale)
                 {
                     locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();



Mime
View raw message