You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/06/29 17:02:57 UTC

svn commit: r1750675 - /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java

Author: lofwyr
Date: Wed Jun 29 17:02:57 2016
New Revision: 1750675

URL: http://svn.apache.org/viewvc?rev=1750675&view=rev
Log:
TOBAGO-1567: Clean up: consolidate getFormattedValue() and other methods.
* fix: try first the EL and then use value as type reference

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java?rev=1750675&r1=1750674&r2=1750675&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java Wed Jun 29 17:02:57 2016
@@ -834,14 +834,13 @@ public final class ComponentUtils {
       final ValueExpression valueExpression = component.getValueExpression("value");
       if (valueExpression != null) {
         Class converterType = null;
-        if (value != null) {
+        try {
+          converterType = valueExpression.getType(facesContext.getELContext());
+        } catch (Exception e) {
+          // ignore, seems not to be possible, when EL is a function like #{bean.getName(item.id)}
+        }
+        if (converterType == null) {
           converterType = value.getClass();
-        } else {
-          try {
-            converterType = valueExpression.getType(facesContext.getELContext());
-          } catch (Exception e) {
-            // ignore, seems not to be possible, when EL is a funktion like #{bean.getName(item.id)}
-          }
         }
         if (converterType != null && converterType != String.class && converterType != Object.class) {
           converter = facesContext.getApplication().createConverter(converterType);