commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-commons/el/src/java/org/apache/commons/el ArraySuffix.java BinaryOperatorExpression.java ComplexValue.java ConditionalExpression.java Expression.java ExpressionEvaluatorImpl.java ExpressionString.java FunctionInvocation.java Literal.java NamedValue.java PropertySuffix.java UnaryOperatorExpression.java ValueSuffix.java
Date Mon, 31 Mar 2003 18:29:42 GMT
luehe       2003/03/31 10:29:42

  Modified:    el       build.properties
               el/src/java/org/apache/commons/el ArraySuffix.java
                        BinaryOperatorExpression.java ComplexValue.java
                        ConditionalExpression.java Expression.java
                        ExpressionEvaluatorImpl.java ExpressionString.java
                        FunctionInvocation.java Literal.java
                        NamedValue.java PropertySuffix.java
                        UnaryOperatorExpression.java ValueSuffix.java
  Log:
  Removed default prefix [patch by Kin-Man Chung]
  
  Revision  Changes    Path
  1.2       +1 -1      jakarta-commons/el/build.properties
  
  Index: build.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/build.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- build.properties	4 Feb 2003 00:22:24 -0000	1.1
  +++ build.properties	31 Mar 2003 18:29:42 -0000	1.2
  @@ -3,7 +3,7 @@
   
   # The directory containing your binary distribution of JUnit, 
   # version 3.7 or later
  -junit.home = /usr/local/junit3.7
  +junit.home = ../../junit3.7
   
   # The pathname of the "junit.jar" JAR file
   junit.jar = ${junit.home}/junit.jar
  
  
  
  1.2       +3 -6      jakarta-commons/el/src/java/org/apache/commons/el/ArraySuffix.java
  
  Index: ArraySuffix.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/ArraySuffix.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ArraySuffix.java	4 Feb 2003 00:22:24 -0000	1.1
  +++ ArraySuffix.java	31 Mar 2003 18:29:42 -0000	1.2
  @@ -146,12 +146,10 @@
      **/
     Object evaluateIndex (VariableResolver pResolver,
   			FunctionMapper functions,
  -			String defaultPrefix,
   			Logger pLogger)
       throws ELException
     {
  -    return mIndex.evaluate (pResolver, functions, defaultPrefix,
  -			    pLogger);
  +    return mIndex.evaluate (pResolver, functions, pLogger);
     }
   
     //-------------------------------------
  @@ -185,7 +183,6 @@
     public Object evaluate (Object pValue,
   			  VariableResolver pResolver,
   			  FunctionMapper functions,
  -			  String defaultPrefix,
   			  Logger pLogger)
       throws ELException
     {
  @@ -205,8 +202,8 @@
       }
   
       // Evaluate the index
  -    else if ((indexVal = evaluateIndex (pResolver, functions, defaultPrefix,
  -					pLogger)) == null) {
  +    else if ((indexVal = evaluateIndex (pResolver, functions, pLogger))
  +								== null) {
         if (pLogger.isLoggingWarning ()) {
   	pLogger.logWarning
   	  (Constants.CANT_GET_NULL_INDEX,
  
  
  
  1.2       +2 -4      jakarta-commons/el/src/java/org/apache/commons/el/BinaryOperatorExpression.java
  
  Index: BinaryOperatorExpression.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/BinaryOperatorExpression.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BinaryOperatorExpression.java	4 Feb 2003 00:22:24 -0000	1.1
  +++ BinaryOperatorExpression.java	31 Mar 2003 18:29:42 -0000	1.2
  @@ -148,12 +148,10 @@
      **/
     public Object evaluate (VariableResolver pResolver,
   			  FunctionMapper functions,
  -			  String defaultPrefix,
   			  Logger pLogger)
       throws ELException
     {
  -    Object value = mExpression.evaluate (pResolver, functions,
  -					 defaultPrefix, pLogger);
  +    Object value = mExpression.evaluate (pResolver, functions, pLogger);
       for (int i = 0; i < mOperators.size (); i++) {
         BinaryOperator operator = (BinaryOperator) mOperators.get (i);
   
  @@ -166,7 +164,7 @@
         if (operator.shouldEvaluate (value)) {
   	Expression expression = (Expression) mExpressions.get (i);
   	Object nextValue = expression.evaluate (pResolver,
  -						functions, defaultPrefix,
  +						functions,
   						pLogger);
   
   	value = operator.apply (value, nextValue, pLogger);
  
  
  
  1.2       +2 -5      jakarta-commons/el/src/java/org/apache/commons/el/ComplexValue.java
  
  Index: ComplexValue.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/ComplexValue.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ComplexValue.java	4 Feb 2003 00:22:24 -0000	1.1
  +++ ComplexValue.java	31 Mar 2003 18:29:42 -0000	1.2
  @@ -134,18 +134,15 @@
      **/
     public Object evaluate (VariableResolver pResolver,
   			  FunctionMapper functions,
  -			  String defaultPrefix,
   			  Logger pLogger)
       throws ELException
     {
  -    Object ret = mPrefix.evaluate (pResolver, functions,
  -				   defaultPrefix, pLogger);
  +    Object ret = mPrefix.evaluate (pResolver, functions, pLogger);
   
       // Apply the suffixes
       for (int i = 0; mSuffixes != null && i < mSuffixes.size (); i++) {
         ValueSuffix suffix = (ValueSuffix) mSuffixes.get (i);
  -      ret = suffix.evaluate (ret, pResolver, functions,
  -			     defaultPrefix, pLogger);
  +      ret = suffix.evaluate (ret, pResolver, functions, pLogger);
       }
   
       return ret;
  
  
  
  1.2       +3 -4      jakarta-commons/el/src/java/org/apache/commons/el/ConditionalExpression.java
  
  Index: ConditionalExpression.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/ConditionalExpression.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConditionalExpression.java	31 Mar 2003 01:17:07 -0000	1.1
  +++ ConditionalExpression.java	31 Mar 2003 18:29:42 -0000	1.2
  @@ -140,20 +140,19 @@
      **/
     public Object evaluate (VariableResolver vr,
   			  FunctionMapper f,
  -			  String p,
   			  Logger l)
       throws ELException
     {
       // first, evaluate the condition (and coerce the result to a boolean value)
       boolean condition =
         Coercions.coerceToBoolean(
  -        mCondition.evaluate(vr, f, p, l), l).booleanValue();
  +        mCondition.evaluate(vr, f, l), l).booleanValue();
   
       // then, use this boolean to branch appropriately
       if (condition)
  -      return mTrueBranch.evaluate(vr, f, p, l);
  +      return mTrueBranch.evaluate(vr, f, l);
       else
  -      return mFalseBranch.evaluate(vr, f, p, l);
  +      return mFalseBranch.evaluate(vr, f, l);
     }
   
     //-------------------------------------
  
  
  
  1.2       +0 -1      jakarta-commons/el/src/java/org/apache/commons/el/Expression.java
  
  Index: Expression.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/Expression.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Expression.java	4 Feb 2003 00:22:24 -0000	1.1
  +++ Expression.java	31 Mar 2003 18:29:42 -0000	1.2
  @@ -90,7 +90,6 @@
      **/
     public abstract Object evaluate (VariableResolver pResolver,
   				   FunctionMapper functions,
  -				   String defaultPrefix,
   				   Logger pLogger)
       throws ELException;
   
  
  
  
  1.2       +18 -32    jakarta-commons/el/src/java/org/apache/commons/el/ExpressionEvaluatorImpl.java
  
  Index: ExpressionEvaluatorImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/ExpressionEvaluatorImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExpressionEvaluatorImpl.java	4 Feb 2003 00:22:24 -0000	1.1
  +++ ExpressionEvaluatorImpl.java	31 Mar 2003 18:29:42 -0000	1.2
  @@ -177,27 +177,20 @@
      *     runtime to resolve the name of implicit objects into Objects.
      * @param functions A FunctionMapper to resolve functions found in 
      *     the expression.  It can be null, in which case no functions 
  -   *     are supported for this invocation.  The FunctionMapper will be
  -   *     invoked one or more times between parsing the expression and
  -   *     evaluating it, and must return a consistent value each time
  -   *     it is invoked.
  -   * @param defaultPrefix The default prefix to use when a function is
  -   *     encountered with no prefix.
  +   *     are supported for this invocation.
      * @return the expression String evaluated to the given expected
      * type
      **/
     public Object evaluate (String pExpressionString,
   			  Class pExpectedType,
                             VariableResolver pResolver,
  -			  FunctionMapper functions,
  -			  String defaultPrefix)
  +			  FunctionMapper functions)
       throws ELException
     {
       return evaluate (pExpressionString,
   		     pExpectedType,
                        pResolver,
   		     functions,
  -		     defaultPrefix,
   		     sLogger);
     }
   
  @@ -209,31 +202,31 @@
      *
      * @param expression The expression to be evaluated.
      * @param expectedType The expected type of the result of the evaluation
  -   * @param fMapper A FunctionMapper to resolve functions found in 
  -   *     the expression.  It can be null, in which case no functions 
  -   *     are supported for this invocation.  The FunctionMapper will be
  -   *     invoked one or more times between parsing the expression and
  -   *     evaluating it, and must return a consistent value each time
  -   *     it is invoked.
  -   * @param defaultPrefix The default prefix to use when a function is
  -   *     encountered with no prefix.
  +   * @param fMapper A FunctionMapper to resolve functions found in
  +   *     the expression.  It can be null, in which case no functions
  +   *     are supported for this invocation.  The ExpressionEvaluator
  +   *     must not hold on to the FunctionMapper reference after
  +   *     returning from <code>parseExpression()</code>.  The
  +   *     <code>Expression</code> object returned must invoke the same
  +   *     functions regardless of whether the mappings in the
  +   *     provided <code>FunctionMapper</code> instance change between
  +   *     calling <code>ExpressionEvaluator.parseExpression()</code>
  +   *     and <code>Expression.evaluate()</code>.
      * @return The Expression object encapsulating the arguments.
      *
      * @exception ELException Thrown if parsing errors were found.
      **/
     public javax.servlet.jsp.el.Expression parseExpression(String expression, 
   							 Class expectedType, 
  -							 FunctionMapper fMapper,
  -							 String defaultPrefix) 
  +							 FunctionMapper fMapper)
       throws ELException 
     {
       // Validate and then create an Expression object.
       parseExpressionString(expression);
           
       // Create an Expression object that knows how to evaluate this.
  -    return new JSTLExpression(this, expression, expectedType, fMapper, 
  -			      defaultPrefix );
  -    }
  +    return new JSTLExpression(this, expression, expectedType, fMapper);
  +  }
   
     //-------------------------------------
     /**
  @@ -244,7 +237,6 @@
   		   Class pExpectedType,
   		   VariableResolver pResolver,
   		   FunctionMapper functions,
  -		   String defaultPrefix,
   		   Logger pLogger)
       throws ELException
     {
  @@ -271,7 +263,6 @@
         Object value = 
   	((Expression) parsedValue).evaluate (pResolver,
   					     functions,
  -					     defaultPrefix,
   					     pLogger);
         return convertToExpectedType (value, 
   				    pExpectedType,
  @@ -283,7 +274,6 @@
         String strValue = 
   	((ExpressionString) parsedValue).evaluate (pResolver,
   						   functions,
  -						   defaultPrefix,
   						   pLogger);
         return convertToExpectedType (strValue,
   				    pExpectedType,
  @@ -544,17 +534,14 @@
       private String expression;
       private Class expectedType;
       private FunctionMapper fMapper;
  -    private String defaultPrefix;
  -        
  +
       public JSTLExpression(ExpressionEvaluatorImpl evaluator, String expression,
  -			  Class expectedType, FunctionMapper fMapper,
  -			  String defaultPrefix)
  +			  Class expectedType, FunctionMapper fMapper)
       {
         this.evaluator = evaluator;
         this.expression = expression;
         this.expectedType = expectedType;
         this.fMapper = fMapper;
  -      this.defaultPrefix = defaultPrefix;
       }
           
       public Object evaluate( VariableResolver vResolver )
  @@ -563,8 +550,7 @@
         return evaluator.evaluate(this.expression,
   				this.expectedType,
   				vResolver,
  -				this.fMapper,
  -				this.defaultPrefix);
  +				this.fMapper);
       }
     }
   
  
  
  
  1.2       +0 -2      jakarta-commons/el/src/java/org/apache/commons/el/ExpressionString.java
  
  Index: ExpressionString.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/ExpressionString.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExpressionString.java	4 Feb 2003 00:22:24 -0000	1.1
  +++ ExpressionString.java	31 Mar 2003 18:29:42 -0000	1.2
  @@ -101,7 +101,6 @@
      **/
     public String evaluate (VariableResolver pResolver,
   			  FunctionMapper functions,
  -			  String defaultPrefix,
   			  Logger pLogger)
       throws ELException
     {
  @@ -115,7 +114,6 @@
   	Object val = 
   	  ((Expression) elem).evaluate (pResolver,
   					functions,
  -					defaultPrefix,
   					pLogger);
   	if (val != null) {
   	  buf.append (val.toString ());
  
  
  
  1.3       +2 -6      jakarta-commons/el/src/java/org/apache/commons/el/FunctionInvocation.java
  
  Index: FunctionInvocation.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/FunctionInvocation.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FunctionInvocation.java	24 Feb 2003 23:13:04 -0000	1.2
  +++ FunctionInvocation.java	31 Mar 2003 18:29:42 -0000	1.3
  @@ -124,7 +124,6 @@
      **/
     public Object evaluate (VariableResolver pResolver,
   			  FunctionMapper functions,
  -			  String defaultPrefix,
                             Logger pLogger)
       throws ELException
     {
  @@ -133,14 +132,12 @@
       if (functions == null)
         pLogger.logError(Constants.UNKNOWN_FUNCTION, functionName);
   
  -    // normalize function name against default prefix
  +    // normalize function name
       String prefix = null;
       String localName = null;
       int index = functionName.indexOf( ':' );
       if (index == -1) {
  -      if (defaultPrefix == null)
  -        pLogger.logError(Constants.UNKNOWN_FUNCTION, functionName);
  -      prefix = defaultPrefix;
  +      prefix = "";
         localName = functionName;
       } else {
         prefix = functionName.substring( 0, index );
  @@ -165,7 +162,6 @@
         // evaluate
         arguments[i] = ((Expression) argumentList.get(i)).evaluate(pResolver,
   								 functions,
  -								 defaultPrefix,
   								 pLogger);
         // coerce
         arguments[i] = Coercions.coerce(arguments[i], params[i], pLogger);
  
  
  
  1.2       +0 -1      jakarta-commons/el/src/java/org/apache/commons/el/Literal.java
  
  Index: Literal.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/Literal.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Literal.java	4 Feb 2003 00:22:25 -0000	1.1
  +++ Literal.java	31 Mar 2003 18:29:42 -0000	1.2
  @@ -102,7 +102,6 @@
      **/
     public Object evaluate (VariableResolver pResolver,
   			  FunctionMapper functions,
  -			  String defaultPrefix,
   			  Logger pLogger)
       throws ELException
     {
  
  
  
  1.2       +0 -1      jakarta-commons/el/src/java/org/apache/commons/el/NamedValue.java
  
  Index: NamedValue.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/NamedValue.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NamedValue.java	4 Feb 2003 00:22:25 -0000	1.1
  +++ NamedValue.java	31 Mar 2003 18:29:42 -0000	1.2
  @@ -114,7 +114,6 @@
      **/
     public Object evaluate (VariableResolver pResolver,
   			  FunctionMapper functions,
  -			  String defaultPrefix,
   			  Logger pLogger)
       throws ELException
     {
  
  
  
  1.2       +0 -1      jakarta-commons/el/src/java/org/apache/commons/el/PropertySuffix.java
  
  Index: PropertySuffix.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/PropertySuffix.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PropertySuffix.java	4 Feb 2003 00:22:25 -0000	1.1
  +++ PropertySuffix.java	31 Mar 2003 18:29:42 -0000	1.2
  @@ -105,7 +105,6 @@
      **/
     Object evaluateIndex (VariableResolver pResolver,
                           FunctionMapper functions,
  -                        String defaultPrefix,
                           Logger pLogger)
       throws ELException
     {
  
  
  
  1.2       +1 -3      jakarta-commons/el/src/java/org/apache/commons/el/UnaryOperatorExpression.java
  
  Index: UnaryOperatorExpression.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/UnaryOperatorExpression.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UnaryOperatorExpression.java	4 Feb 2003 00:22:25 -0000	1.1
  +++ UnaryOperatorExpression.java	31 Mar 2003 18:29:42 -0000	1.2
  @@ -150,12 +150,10 @@
      **/
     public Object evaluate (VariableResolver pResolver,
   			  FunctionMapper functions,
  -			  String defaultPrefix,
   			  Logger pLogger)
       throws ELException
     {
  -    Object value = mExpression.evaluate (pResolver, functions,
  -					 defaultPrefix, pLogger);
  +    Object value = mExpression.evaluate (pResolver, functions, pLogger);
       if (mOperator != null) {
         value = mOperator.apply (value, pLogger);
       }
  
  
  
  1.2       +0 -1      jakarta-commons/el/src/java/org/apache/commons/el/ValueSuffix.java
  
  Index: ValueSuffix.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/ValueSuffix.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ValueSuffix.java	4 Feb 2003 00:22:25 -0000	1.1
  +++ ValueSuffix.java	31 Mar 2003 18:29:42 -0000	1.2
  @@ -88,7 +88,6 @@
     public abstract Object evaluate (Object pValue,
   				   VariableResolver pResolver,
   				   FunctionMapper functions,
  -				   String defaultPrefix,
   				   Logger pLogger)
       throws ELException;
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message