myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r627919 - in /myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit: RendererUtils.java _SharedRendererUtils.java
Date Fri, 15 Feb 2008 00:30:01 GMT
Author: lu4242
Date: Thu Feb 14 16:30:00 2008
New Revision: 627919

URL: http://svn.apache.org/viewvc?rev=627919&view=rev
Log:
fix MYFACES-1819 h:selectManyCheckbox with value="#{bean.map['somekey']}" fails

Modified:
    myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
    myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java

Modified: myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java?rev=627919&r1=627918&r2=627919&view=diff
==============================================================================
--- myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
(original)
+++ myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
Thu Feb 14 16:30:00 2008
@@ -408,9 +408,16 @@
         ValueExpression vb = component.getValueExpression("value");
         if (vb == null) return null;
 
-        Class valueType = vb.getType(facesContext.getELContext());
+        //By some strange reason vb.getType(facesContext.getELContext());
+        //does not return the same as vb.getValue(facesContext.getELContext()).getClass(),
+        //so we need to use this instead.
+        Class valueType = null;
+        Object value = vb.getValue(facesContext.getELContext()); 
+        valueType = (value != null) ? value.getClass() :
+            vb.getType(facesContext.getELContext()) ;
+        
         if (valueType == null) return null;
-
+        
         if (List.class.isAssignableFrom(valueType))
         {
             //According to API Doc of UISelectMany the assumed entry type for a List is String

Modified: myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java?rev=627919&r1=627918&r2=627919&view=diff
==============================================================================
--- myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java
(original)
+++ myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java
Thu Feb 14 16:30:00 2008
@@ -87,7 +87,13 @@
         Class arrayComponentType = null;
         if (expression != null)
         {
-            valueType = expression.getType(facesContext.getELContext());
+            //By some strange reason vb.getType(facesContext.getELContext());
+            //does not return the same as vb.getValue(facesContext.getELContext()).getClass(),
+            //so we need to use this instead.
+            Object value = expression.getValue(facesContext.getELContext()); 
+            valueType = (value != null) ? value.getClass() :
+                expression.getType(facesContext.getELContext()) ;
+            
             if (valueType != null && valueType.isArray())
             {
                 arrayComponentType = valueType.getComponentType();



Mime
View raw message