dev@javaserverfaces.java.net

Review: cvs remove JSF 1.1 EL implementation

From: Jayashri Visvanathan <Jayashri.Visvanathan_at_Sun.COM>
Date: Tue, 17 May 2005 16:14:36 -0700


Index: src/com/sun/faces/el/DummyPropertyResolverImpl.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/el/DummyPropertyResolverImpl.java,v
retrieving revision 1.1
diff -u -r1.1 DummyPropertyResolverImpl.java
--- src/com/sun/faces/el/DummyPropertyResolverImpl.java 5 May 2005 20:51:21 -0000 1.1
+++ src/com/sun/faces/el/DummyPropertyResolverImpl.java 17 May 2005 23:09:55 -0000
@@ -9,8 +9,6 @@
 
 package com.sun.faces.el;
 
-import com.sun.faces.el.impl.ELSupport;
-
 import javax.faces.el.EvaluationException;
 import javax.faces.el.PropertyNotFoundException;
 import javax.faces.el.PropertyResolver;
Index: src/com/sun/faces/el/PropertyResolverChainWrapper.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/el/PropertyResolverChainWrapper.java,v
retrieving revision 1.2
diff -u -r1.2 PropertyResolverChainWrapper.java
--- src/com/sun/faces/el/PropertyResolverChainWrapper.java 16 May 2005 20:16:19 -0000 1.2
+++ src/com/sun/faces/el/PropertyResolverChainWrapper.java 17 May 2005 23:09:55 -0000
@@ -16,6 +16,7 @@
 import javax.el.ELResolver;
 import javax.faces.el.EvaluationException;
 import javax.faces.el.PropertyResolver;
+import javax.faces.context.FacesContext;
 
 public class PropertyResolverChainWrapper extends ELResolver {
 
@@ -33,9 +34,12 @@
         context.setPropertyResolved(true);
         Object result = null;
 
+ FacesContext facesContext = (FacesContext)
+ context.getContext(FacesContext.class);
         if (base instanceof List || base.getClass().isArray()) {
- int index =
- ELSupport.coerceToNumber(property, Integer.class).intValue();
+ Object indexObj = facesContext.getApplication().getExpressionFactory().
+ coerceToType(property, Integer.class);
+ int index = ((Integer)indexObj).intValue();
             try {
                 result = legacyPR.getValue(base, index);
             } catch (EvaluationException ex) {
@@ -67,10 +71,13 @@
 
         context.setPropertyResolved(true);
         Class result = null;
-
+
         if (base instanceof List || base.getClass().isArray()) {
- int index =
- ELSupport.coerceToNumber(property, Integer.class).intValue();
+ FacesContext facesContext = (FacesContext)
+ context.getContext(FacesContext.class);
+ Object indexObj = facesContext.getApplication().getExpressionFactory().
+ coerceToType(property, Integer.class);
+ int index = ((Integer)indexObj).intValue();
             try {
                 result = legacyPR.getType(base, index);
             } catch (EvaluationException ex) {
@@ -102,8 +109,11 @@
         context.setPropertyResolved(true);
 
         if (base instanceof List || base.getClass().isArray()) {
- int index =
- ELSupport.coerceToNumber(property, Integer.class).intValue();
+ FacesContext facesContext = (FacesContext)
+ context.getContext(FacesContext.class);
+ Object indexObj = facesContext.getApplication().getExpressionFactory().
+ coerceToType(property, Integer.class);
+ int index = ((Integer)indexObj).intValue();
             try {
                 legacyPR.setValue(base, index, val);
             } catch (EvaluationException ex) {
@@ -129,8 +139,11 @@
         boolean result = false;
 
         if (base instanceof List || base.getClass().isArray()) {
- int index =
- ELSupport.coerceToNumber(property, Integer.class).intValue();
+ FacesContext facesContext = (FacesContext)
+ context.getContext(FacesContext.class);
+ Object indexObj = facesContext.getApplication().getExpressionFactory().
+ coerceToType(property, Integer.class);
+ int index = ((Integer)indexObj).intValue();
             try {
                 result = legacyPR.isReadOnly(base, index);
             } catch (EvaluationException ex) {
Index: src/com/sun/faces/el/PropertyResolverImpl.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/el/PropertyResolverImpl.java,v
retrieving revision 1.16
diff -u -r1.16 PropertyResolverImpl.java
--- src/com/sun/faces/el/PropertyResolverImpl.java 5 May 2005 20:51:23 -0000 1.16
+++ src/com/sun/faces/el/PropertyResolverImpl.java 17 May 2005 23:09:55 -0000
@@ -19,7 +19,6 @@
 import javax.faces.el.PropertyNotFoundException;
 import javax.faces.el.PropertyResolver;
 
-import com.sun.faces.el.impl.ELSupport;
 import com.sun.faces.util.Util;
 
 /**
@@ -52,17 +51,20 @@
                 Object value = ((List) base).get(index);
                 return (value != null) ? value.getClass() : null;
             } else {
- throw new EvaluationException(ELSupport.msg(
- "el.error.property.array.type", base));
+ throw new PropertyNotFoundException(Util.getExceptionMessageString(
+ Util.EL_PROPERTY_TYPE_ERROR_ID,
+ new Object[]{base}));
             }
         } catch (ArrayIndexOutOfBoundsException aioobe) {
- throw new PropertyNotFoundException(ELSupport.msg(
- "el.error.property.array.outofbounds.size", base,
- "" + index, "" + Array.getLength(base)));
+ throw new PropertyNotFoundException(Util.getExceptionMessageString(
+ Util.EL_SIZE_OUT_OF_BOUNDS_ERROR_ID,
+ new Object[]{base,new Integer(index),
+ new Integer(Array.getLength(base))}));
         } catch (IndexOutOfBoundsException ioobe) {
- throw new PropertyNotFoundException(ELSupport.msg(
- "el.error.property.array.outofbounds.size", base,
- "" + index, "" + ((List) base).size()));
+ throw new PropertyNotFoundException(Util.getExceptionMessageString(
+ Util.EL_SIZE_OUT_OF_BOUNDS_ERROR_ID,
+ new Object[]{base,new Integer(index),
+ new Integer(((List)base).size())}));
         }
     }
 
@@ -102,8 +104,9 @@
                 return null;
             }
         } else {
- throw new EvaluationException(ELSupport.msg(
- "el.error.property.array.type", base));
+ throw new PropertyNotFoundException(Util.getExceptionMessageString(
+ Util.EL_PROPERTY_TYPE_ERROR_ID,
+ new Object[]{base}));
         }
         
     }
@@ -131,8 +134,9 @@
         if (base instanceof List || base.getClass().isArray()) {
             return false;
         } else {
- throw new EvaluationException(ELSupport.msg(
- "el.error.property.array.type", base));
+ throw new PropertyNotFoundException(Util.getExceptionMessageString(
+ Util.EL_PROPERTY_TYPE_ERROR_ID,
+ new Object[]{base}));
         }
     }
 
@@ -153,29 +157,33 @@
         
         // validate input
         assertInput(base, index);
-
+ FacesContext context = FacesContext.getCurrentInstance();
         Class type = base.getClass();
         if (type.isArray()) {
             try {
- Array.set(base, index, ELSupport.coerceToType(value, type
+ Array.set(base, index, (context.getApplication().
+ getExpressionFactory()).coerceToType(value, type
                         .getComponentType()));
             }
             catch (ArrayIndexOutOfBoundsException aioobe) {
- throw new PropertyNotFoundException(ELSupport.msg(
- "el.error.property.array.outofbounds.size", base, ""
- + index, "" + Array.getLength(base)));
+ throw new PropertyNotFoundException(Util.getExceptionMessageString(
+ Util.EL_SIZE_OUT_OF_BOUNDS_ERROR_ID,
+ new Object[]{base,new Integer(index),
+ new Integer(Array.getLength(base))}));
             }
         } else if (base instanceof List) {
             try {
                 ((List) base).set(index, value);
             } catch (IndexOutOfBoundsException ioobe) {
- throw new PropertyNotFoundException(ELSupport.msg(
- "el.error.property.array.outofbounds.size", base, ""
- + index, "" + ((List) base).size()));
+ throw new PropertyNotFoundException(Util.getExceptionMessageString(
+ Util.EL_SIZE_OUT_OF_BOUNDS_ERROR_ID,
+ new Object[]{base,new Integer(index),
+ new Integer(((List)base).size())}));
             }
         } else {
- throw new EvaluationException(ELSupport.msg(
- "el.error.property.array.type", base));
+ throw new PropertyNotFoundException(Util.getExceptionMessageString(
+ Util.EL_PROPERTY_TYPE_ERROR_ID,
+ new Object[]{base}));
         }
     }
 
@@ -214,8 +222,9 @@
             throw new PropertyNotFoundException(message);
         }
         if (index < 0) {
- throw new PropertyNotFoundException(ELSupport.msg(
- "el.error.property.array.outofbounds", base, "" + index));
+ throw new PropertyNotFoundException(Util.getExceptionMessageString(
+ Util.EL_OUT_OF_BOUNDS_ERROR_ID,
+ new Object[]{base, new Integer(index)}));
         }
     }
 }
Index: src/com/sun/faces/el/VariableResolverImpl.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/el/VariableResolverImpl.java,v
retrieving revision 1.22
diff -u -r1.22 VariableResolverImpl.java
--- src/com/sun/faces/el/VariableResolverImpl.java 5 May 2005 20:51:24 -0000 1.22
+++ src/com/sun/faces/el/VariableResolverImpl.java 17 May 2005 23:09:55 -0000
@@ -12,7 +12,7 @@
 import java.util.Arrays;
 
 import com.sun.faces.application.ApplicationAssociate;
-import com.sun.faces.el.impl.ELConstants;
+import com.sun.faces.el.ELConstants;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
Index: src/com/sun/faces/util/Util.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/util/Util.java,v
retrieving revision 1.159
diff -u -r1.159 Util.java
--- src/com/sun/faces/util/Util.java 17 May 2005 03:30:41 -0000 1.159
+++ src/com/sun/faces/util/Util.java 17 May 2005 23:09:55 -0000
@@ -327,6 +327,13 @@
     public static final String INCORRECT_JSP_VERSION_ID =
             "com.sun.faces.INCORRECT_JSP_VERSION";
     
+ public static final String EL_OUT_OF_BOUNDS_ERROR_ID =
+ "com.sun.faces.OUT_OF_BOUNDS_ERROR";
+ public static final String EL_PROPERTY_TYPE_ERROR_ID =
+ "com.sun.faces.PROPERTY_TYPE_ERROR";
+ public static final String EL_SIZE_OUT_OF_BOUNDS_ERROR_ID =
+ "com.sun.faces.SIZE_OUT_OF_BOUNDS_ERROR";
+
 // README - make sure to add the message identifier constant
 // (ex: Util.CONVERSION_ERROR_MESSAGE_ID) and the number of substitution
 // parameters to test/com/sun/faces/util/TestUtil_messages (see comment there).
Index: src/javax/faces/Messages.properties
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/javax/faces/Messages.properties,v
retrieving revision 1.27
diff -u -r1.27 Messages.properties
--- src/javax/faces/Messages.properties 17 May 2005 03:30:41 -0000 1.27
+++ src/javax/faces/Messages.properties 17 May 2005 23:09:55 -0000
@@ -194,4 +194,9 @@
 com.sun.faces.CYCLIC_REFERENCE_ERROR=Possible cycle reference to managed bean "{0}"
 com.sun.faces.OBJECT_IS_READONLY="{0} object is read only"
 com.sun.faces.APPLICATION_INIT_COMPLETE_ERROR_ID=ELResolvers cannot be added after the application initialization is complete.
-com.sun.faces.INCORRECT_JSP_VERSION=Incorrect JSP version found, method ''{0}'' does not exist.
\ No newline at end of file
+com.sun.faces.INCORRECT_JSP_VERSION=Incorrect JSP version found, method ''{0}'' does not exist.
+
+#com.sun.faces.el.PropertyResolverImpl
+com.sun.faces.OUT_OF_BOUNDS_ERROR=Index {1} Out of Bounds for {0}
+com.sun.faces.PROPERTY_TYPE_ERROR={0} is not Array or List type.
+com.sun.faces.SIZE_OUT_OF_BOUNDS_ERROR=Index {1} Out of Bounds for {0} with a length of {2}
\ No newline at end of file
Index: test/com/sun/faces/util/TestUtil_messages.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/test/com/sun/faces/util/TestUtil_messages.java,v
retrieving revision 1.40
diff -u -r1.40 TestUtil_messages.java
--- test/com/sun/faces/util/TestUtil_messages.java 17 May 2005 03:30:42 -0000 1.40
+++ test/com/sun/faces/util/TestUtil_messages.java 17 May 2005 23:09:55 -0000
@@ -119,7 +119,10 @@
         {Util.APPLICATION_ASSOCIATE_CTOR_WRONG_CALLSTACK_ID, "0"},
         {Util.APPLICATION_ASSOCIATE_EXISTS_ID, "0"},
         {Util.OBJECT_IS_READONLY, "1"},
- {Util.INCORRECT_JSP_VERSION_ID, "1"}
+ {Util.INCORRECT_JSP_VERSION_ID, "1"},
+ {Util.EL_OUT_OF_BOUNDS_ERROR_ID, "1"},
+ {Util.EL_PROPERTY_TYPE_ERROR_ID, "1"},
+ {Util.EL_SIZE_OUT_OF_BOUNDS_ERROR_ID,"2"}
     };
 
     private String[][] toolsMessageInfo = {


M src/com/sun/faces/el/DummyPropertyResolverImpl.java
R src/com/sun/faces/el/ELSupport.java
R src/com/sun/faces/el/MethodBindingConstant.java
R src/com/sun/faces/el/MethodBindingFactory.java
R src/com/sun/faces/el/MethodBindingImpl.java
M src/com/sun/faces/el/PropertyResolverChainWrapper.java
M src/com/sun/faces/el/PropertyResolverImpl.java
R src/com/sun/faces/el/ValueBindingConstant.java
R src/com/sun/faces/el/ValueBindingFactory.java
R src/com/sun/faces/el/ValueBindingImpl.java
M src/com/sun/faces/el/VariableResolverImpl.java
R src/com/sun/faces/el/impl/AbstractConstantNode.java
R src/com/sun/faces/el/impl/AbstractJsfParserVisitor.java
R src/com/sun/faces/el/impl/AbstractNode.java
R src/com/sun/faces/el/impl/AstAnd.java
R src/com/sun/faces/el/impl/AstChoose.java
R src/com/sun/faces/el/impl/AstComplex.java
R src/com/sun/faces/el/impl/AstDiv.java
R src/com/sun/faces/el/impl/AstEmpty.java
R src/com/sun/faces/el/impl/AstEqual.java
R src/com/sun/faces/el/impl/AstFalse.java
R src/com/sun/faces/el/impl/AstFloat.java
R src/com/sun/faces/el/impl/AstGreaterThan.java
R src/com/sun/faces/el/impl/AstGreaterThanEqual.java
R src/com/sun/faces/el/impl/AstLessThan.java
R src/com/sun/faces/el/impl/AstLessThanEqual.java
R src/com/sun/faces/el/impl/AstMinus.java
R src/com/sun/faces/el/impl/AstMod.java
R src/com/sun/faces/el/impl/AstMult.java
R src/com/sun/faces/el/impl/AstNegative.java
R src/com/sun/faces/el/impl/AstNot.java
R src/com/sun/faces/el/impl/AstNotEqual.java
R src/com/sun/faces/el/impl/AstNull.java
R src/com/sun/faces/el/impl/AstNumber.java
R src/com/sun/faces/el/impl/AstOr.java
R src/com/sun/faces/el/impl/AstPlus.java
R src/com/sun/faces/el/impl/AstProperty.java
R src/com/sun/faces/el/impl/AstPropertyEval.java
R src/com/sun/faces/el/impl/AstString.java
R src/com/sun/faces/el/impl/AstText.java
R src/com/sun/faces/el/impl/AstTrue.java
R src/com/sun/faces/el/impl/AstValue.java
R src/com/sun/faces/el/impl/AstVariable.java
R src/com/sun/faces/el/impl/ELArithmetic.java
R src/com/sun/faces/el/impl/ELConstants.java
R src/com/sun/faces/el/impl/ELSupport.java
R src/com/sun/faces/el/impl/JJTJsfParserState.java
R src/com/sun/faces/el/impl/JsfParser.java
R src/com/sun/faces/el/impl/JsfParser.jj
R src/com/sun/faces/el/impl/JsfParser.jjt
R src/com/sun/faces/el/impl/JsfParserConstants.java
R src/com/sun/faces/el/impl/JsfParserTokenManager.java
R src/com/sun/faces/el/impl/JsfParserTreeConstants.java
R src/com/sun/faces/el/impl/JsfParserVisitor.java
R src/com/sun/faces/el/impl/Messages.properties
R src/com/sun/faces/el/impl/MethodAbstractVisitor.java
R src/com/sun/faces/el/impl/MethodInvokeVisitor.java
R src/com/sun/faces/el/impl/MethodReturnTypeVisitor.java
R src/com/sun/faces/el/impl/Node.java
R src/com/sun/faces/el/impl/ParseException.java
R src/com/sun/faces/el/impl/SimpleCharStream.java
R src/com/sun/faces/el/impl/Token.java
R src/com/sun/faces/el/impl/TokenMgrError.java
R src/com/sun/faces/el/impl/ValueGetVisitor.java
R src/com/sun/faces/el/impl/ValueReadOnlyVisitor.java
R src/com/sun/faces/el/impl/ValueSetVisitor.java
R src/com/sun/faces/el/impl/ValueTypeVisitor.java
M src/com/sun/faces/util/Util.java
M src/javax/faces/Messages.properties
M test/com/sun/faces/util/TestUtil_messages.java