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 2013/08/29 04:39:17 UTC

svn commit: r1518453 - /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java

Author: lu4242
Date: Thu Aug 29 02:39:16 2013
New Revision: 1518453

URL: http://svn.apache.org/r1518453
Log:
small fix for array case and legacy PropertyResolverImpl

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java?rev=1518453&r1=1518452&r2=1518453&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java Thu Aug 29 02:39:16 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.myfaces.el;
 
+import java.lang.reflect.Array;
 import java.util.List;
 
 import javax.el.ELContext;
@@ -101,12 +102,14 @@ public final class PropertyResolverImpl 
             throw new PropertyNotFoundException();
         }
 
+        Class baseType = base.getClass();
         if (base instanceof Object[])
         {
             if (index < 0 || index >= ((Object[])base).length)
             {
                 throw new PropertyNotFoundException();
             }
+            setValue(base, Integer.valueOf(index), newValue);
         }
         else if (base instanceof List)
         {
@@ -114,9 +117,22 @@ public final class PropertyResolverImpl 
             {
                 throw new PropertyNotFoundException();
             }
+            setValue(base, Integer.valueOf(index), newValue);
+        }
+        else if (baseType.isArray())
+        {
+            if (index < 0 || index >= Array.getLength(base))
+            {
+                throw new PropertyNotFoundException();
+            }
+            Array.set(base, index, getFacesContext().getApplication().
+                getExpressionFactory().coerceToType(newValue, baseType.getComponentType()));
+        }
+        else
+        {
+            setValue(base, Integer.valueOf(index), newValue);
         }
 
-        setValue(base, Integer.valueOf(index), newValue);
     }
 
     @Override