geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r911892 - in /geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el: ArrayELResolver.java ListELResolver.java
Date Fri, 19 Feb 2010 18:23:29 GMT
Author: gawor
Date: Fri Feb 19 18:23:29 2010
New Revision: 911892

URL: http://svn.apache.org/viewvc?rev=911892&view=rev
Log:
some spec compliance updates

Modified:
    geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ArrayELResolver.java
    geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ListELResolver.java

Modified: geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ArrayELResolver.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ArrayELResolver.java?rev=911892&r1=911891&r2=911892&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ArrayELResolver.java
(original)
+++ geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ArrayELResolver.java
Fri Feb 19 18:23:29 2010
@@ -88,7 +88,13 @@
 
 			int idx = coerce(property);
 			checkBounds(base, idx);
-			Array.set(base, idx, value);
+			try {
+			    Array.set(base, idx, value);
+			} catch (IllegalArgumentException e) {
+			    ClassCastException ex = new ClassCastException(e.getMessage());
+			    ex.initCause(e);
+			    throw ex;
+			}
 		}
 	}
 

Modified: geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ListELResolver.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ListELResolver.java?rev=911892&r1=911891&r2=911892&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ListELResolver.java (original)
+++ geronimo/specs/trunk/geronimo-el_2.2_spec/src/main/java/javax/el/ListELResolver.java Fri
Feb 19 18:23:29 2010
@@ -68,9 +68,7 @@
 			context.setPropertyResolved(true);
 			List list = (List) base;
 			int idx = coerce(property);
-			if (idx < 0 || idx >= list.size()) {
-				return null;
-			}
+			checkBounds(list, idx);
 			Object obj = list.get(idx);
 			return (obj != null) ? obj.getClass() : null;
 		}
@@ -97,6 +95,7 @@
 			}
 
 			int idx = coerce(property);
+			checkBounds(list, idx);
 			try {
 				list.set(idx, value);
 			} catch (UnsupportedOperationException e) {
@@ -117,10 +116,7 @@
 			context.setPropertyResolved(true);
 			List list = (List) base;
 			int idx = coerce(property);
-			if (idx < 0 || idx >= list.size()) {
-				throw new PropertyNotFoundException(
-						new ArrayIndexOutOfBoundsException(idx).getMessage());
-			}
+			checkBounds(list, idx);
 			return this.readOnly || UNMODIFIABLE.equals(list.getClass());
 		}
 
@@ -152,6 +148,13 @@
 		return null;
 	}
 
+	private final static void checkBounds(List base, int idx) {
+	    if (idx < 0 || idx >= base.size()) {
+	        throw new PropertyNotFoundException(
+	                new ArrayIndexOutOfBoundsException(idx).getMessage());
+	    }
+	}
+	   
 	private final static int coerce(Object property) {
 		if (property instanceof Number) {
 			return ((Number) property).intValue();



Mime
View raw message