You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2007/03/28 05:08:40 UTC

svn commit: r523150 - /myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java

Author: dennisbyrne
Date: Tue Mar 27 20:08:39 2007
New Revision: 523150

URL: http://svn.apache.org/viewvc?view=rev&rev=523150
Log:
MYFACES-1577 patch by Paul McMahan

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

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java?view=diff&rev=523150&r1=523149&r2=523150
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java Tue Mar 27 20:08:39 2007
@@ -52,6 +52,19 @@
     @Override
     public Object getValue(final Object base, final int index) throws EvaluationException, PropertyNotFoundException
     {
+        if (base == null)
+            throw new PropertyNotFoundException();
+        
+        if (base instanceof Object[]) {
+            if (index < 0 || index>=((Object[])base).length) {
+                throw new PropertyNotFoundException();
+            }
+        } else if (base instanceof List) {
+            if (index < 0 || index>=((List)base).size()) {
+                throw new PropertyNotFoundException();
+            }
+        }
+        
         return getValue(base, new Integer(index));
     }
 
@@ -59,6 +72,9 @@
     public void setValue(final Object base, final Object property, final Object newValue) throws EvaluationException,
             PropertyNotFoundException
     {
+        if (base == null || property == null)
+            throw new PropertyNotFoundException();
+        
         invokeResolver(new ResolverInvoker<Object>(base, property)
         {
             @Override
@@ -79,6 +95,19 @@
     @Override
     public void setValue(Object base, int index, Object newValue) throws EvaluationException, PropertyNotFoundException
     {
+        if (base == null)
+            throw new PropertyNotFoundException();
+        
+        if (base instanceof Object[]) {
+            if (index < 0 || index>=((Object[])base).length) {
+                throw new PropertyNotFoundException();
+            }
+        } else if (base instanceof List) {
+            if (index < 0 || index>=((List)base).size()) {
+                throw new PropertyNotFoundException();
+            }
+        }
+        
         setValue(base, new Integer(index), newValue);
     }