You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by ar...@apache.org on 2002/04/15 01:34:59 UTC

cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/test EvaluationTest.java evaluationTests.txt evaluationTestsOutput.txt parserTests.txt parserTestsOutput.txt

arista      02/04/14 16:34:59

  Modified:    standard/src/org/apache/taglibs/standard/lang/jstl
                        Coercions.java ELParser.jj
               standard/src/org/apache/taglibs/standard/lang/jstl/parser
                        ELParser.java ELParserConstants.java
                        ELParserTokenManager.java
               standard/src/org/apache/taglibs/standard/lang/jstl/test
                        EvaluationTest.java evaluationTests.txt
                        evaluationTestsOutput.txt parserTests.txt
                        parserTestsOutput.txt
  Added:       standard/src/org/apache/taglibs/standard/lang/jstl
                        EmptyOperator.java
  Log:
  Bug 8077 - add "empty" EL operator
  
  The empty EL operator has been added as EmptyOperator.java
  
  Revision  Changes    Path
  1.4       +14 -0     jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/Coercions.java
  
  Index: Coercions.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/Coercions.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Coercions.java	6 Mar 2002 07:46:48 -0000	1.3
  +++ Coercions.java	14 Apr 2002 23:34:58 -0000	1.4
  @@ -110,6 +110,20 @@
    *     if operator results in exception, error
    *     otherwise
    *       error
  + *
  + * Applying "empty" operator - empty A
  + *   if A is null
  + *     return true
  + *   if A is zero-length String
  + *     return true
  + *   if A is zero-length array
  + *     return true
  + *   if A is List and ((List) A).isEmpty()
  + *     return true
  + *   if A is Map and ((Map) A).isEmpty()
  + *     return true
  + *   otherwise
  + *     return false
    * 
    * Applying logical operators
    *   Binary operator - A {and,or} B
  @@ -248,7 +262,7 @@
    * </pre></ul>
    *
    * @author Nathan Abramson - Art Technology Group
  - * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: shawn $
  + * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: arista $
    **/
   
   public class Coercions
  
  
  
  1.12      +2 -0      jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/ELParser.jj
  
  Index: ELParser.jj
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/ELParser.jj,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ELParser.jj	14 Apr 2002 14:32:35 -0000	1.11
  +++ ELParser.jj	14 Apr 2002 23:34:58 -0000	1.12
  @@ -123,6 +123,7 @@
   | < AND2: "&&" >
   | < OR1: "or" >
   | < OR2: "||" >
  +| < EMPTY: "empty" >
   
   
   /* Identifiers */
  @@ -505,6 +506,7 @@
      (
       (<NOT1> | <NOT2>) { operator = NotOperator.SINGLETON; }
       | <MINUS> { operator = UnaryMinusOperator.SINGLETON; }
  +    | <EMPTY> { operator = EmptyOperator.SINGLETON; }
       )
     {
       if (singleOperator == null) {
  
  
  
  1.1                  jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/EmptyOperator.java
  
  Index: EmptyOperator.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.standard.lang.jstl;
  
  import java.lang.reflect.Array;
  import java.util.List;
  import java.util.Map;
  
  /**
   *
   * <p>The implementation of the empty operator
   * 
   * @author Nathan Abramson - Art Technology Group
   * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: arista $
   **/
  
  public class EmptyOperator
    extends UnaryOperator
  {
    //-------------------------------------
    // Singleton
    //-------------------------------------
  
    public static final EmptyOperator SINGLETON =
      new EmptyOperator ();
  
    //-------------------------------------
    /**
     *
     * Constructor
     **/
    public EmptyOperator ()
    {
    }
  
    //-------------------------------------
    // Expression methods
    //-------------------------------------
    /**
     *
     * Returns the symbol representing the operator
     **/
    public String getOperatorSymbol ()
    {
      return "empty";
    }
  
    //-------------------------------------
    /**
     *
     * Applies the operator to the given value
     **/
    public Object apply (Object pValue,
  		       Object pContext,
  		       Logger pLogger)
      throws ELException
    {
      // See if the value is null
      if (pValue == null) {
        return PrimitiveObjects.getBoolean (true);
      }
  
      // See if the value is a zero-length String
      else if ("".equals (pValue)) {
        return PrimitiveObjects.getBoolean (true);
      }
  
      // See if the value is a zero-length array
      else if (pValue.getClass ().isArray () &&
  	     Array.getLength (pValue) == 0) {
        return PrimitiveObjects.getBoolean (true);
      }
  
      // See if the value is an empty List
      else if (pValue instanceof List &&
  	     ((List) pValue).isEmpty ()) {
        return PrimitiveObjects.getBoolean (true);
      }
  
      // See if the value is an empty Map
      else if (pValue instanceof Map &&
  	     ((Map) pValue).isEmpty ()) {
        return PrimitiveObjects.getBoolean (true);
      }
  
      // Otherwise, not empty
      else {
        return PrimitiveObjects.getBoolean (false);
      }
    }
  
    //-------------------------------------
  }
  
  
  
  1.10      +9 -4      jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/parser/ELParser.java
  
  Index: ELParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/parser/ELParser.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ELParser.java	14 Apr 2002 14:32:36 -0000	1.9
  +++ ELParser.java	14 Apr 2002 23:34:58 -0000	1.10
  @@ -533,6 +533,7 @@
         case MINUS:
         case NOT1:
         case NOT2:
  +      case EMPTY:
           ;
           break;
         default:
  @@ -560,6 +561,10 @@
           jj_consume_token(MINUS);
                   operator = UnaryMinusOperator.SINGLETON;
           break;
  +      case EMPTY:
  +        jj_consume_token(EMPTY);
  +                operator = EmptyOperator.SINGLETON;
  +        break;
         default:
           jj_la1[25] = jj_gen;
           jj_consume_token(-1);
  @@ -783,7 +788,7 @@
     private int jj_gen;
     final private int[] jj_la1 = new int[31];
     final private int[] jj_la1_0 = {0x6,0x6,0x6,0x0,0x0,0x0,0x0,0x18600000,0x600000,0x18000000,0x18600000,0x79e0000,0x180000,0x60000,0x6000000,0x1800000,0x79e0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80010000,0x20007580,0x80010000,0x7580,0x3000,};
  -  final private int[] jj_la1_1 = {0x0,0x0,0x0,0x3000,0x3000,0xc00,0xc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x6,0xf8,0x30,0xc0,0xf8,0x304,0x300,0x304,0x0,0x4000,0x0,0x0,0x0,};
  +  final private int[] jj_la1_1 = {0x0,0x0,0x0,0x3000,0x3000,0xc00,0xc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x6,0xf8,0x30,0xc0,0xf8,0x4304,0x300,0x4304,0x0,0x8000,0x0,0x0,0x0,};
   
     public ELParser(java.io.InputStream stream) {
       jj_input_stream = new SimpleCharStream(stream, 1, 1);
  @@ -881,8 +886,8 @@
   
     final public ParseException generateParseException() {
       jj_expentries.removeAllElements();
  -    boolean[] la1tokens = new boolean[51];
  -    for (int i = 0; i < 51; i++) {
  +    boolean[] la1tokens = new boolean[52];
  +    for (int i = 0; i < 52; i++) {
         la1tokens[i] = false;
       }
       if (jj_kind >= 0) {
  @@ -901,7 +906,7 @@
           }
         }
       }
  -    for (int i = 0; i < 51; i++) {
  +    for (int i = 0; i < 52; i++) {
         if (la1tokens[i]) {
           jj_expentry = new int[1];
           jj_expentry[0] = i;
  
  
  
  1.8       +7 -5      jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/parser/ELParserConstants.java
  
  Index: ELParserConstants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/parser/ELParserConstants.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ELParserConstants.java	14 Apr 2002 14:32:36 -0000	1.7
  +++ ELParserConstants.java	14 Apr 2002 23:34:58 -0000	1.8
  @@ -45,11 +45,12 @@
     int AND2 = 43;
     int OR1 = 44;
     int OR2 = 45;
  -  int IDENTIFIER = 46;
  -  int IMPL_OBJ_START = 47;
  -  int LETTER = 48;
  -  int DIGIT = 49;
  -  int ILLEGAL_CHARACTER = 50;
  +  int EMPTY = 46;
  +  int IDENTIFIER = 47;
  +  int IMPL_OBJ_START = 48;
  +  int LETTER = 49;
  +  int DIGIT = 50;
  +  int ILLEGAL_CHARACTER = 51;
   
     int DEFAULT = 0;
     int IN_EXPRESSION = 1;
  @@ -101,6 +102,7 @@
       "\"&&\"",
       "\"or\"",
       "\"||\"",
  +    "\"empty\"",
       "<IDENTIFIER>",
       "\"#\"",
       "<LETTER>",
  
  
  
  1.10      +42 -32    jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/parser/ELParserTokenManager.java
  
  Index: ELParserTokenManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/parser/ELParserTokenManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ELParserTokenManager.java	14 Apr 2002 14:32:36 -0000	1.9
  +++ ELParserTokenManager.java	14 Apr 2002 23:34:58 -0000	1.10
  @@ -218,43 +218,43 @@
      switch (pos)
      {
         case 0:
  -         if ((active0 & 0x10000L) != 0L)
  -            return 1;
  -         if ((active0 & 0x15a015547000L) != 0L)
  +         if ((active0 & 0x55a015547000L) != 0L)
            {
  -            jjmatchedKind = 46;
  +            jjmatchedKind = 47;
               return 6;
            }
  +         if ((active0 & 0x10000L) != 0L)
  +            return 1;
            return -1;
         case 1:
  -         if ((active0 & 0x100015540000L) != 0L)
  -            return 6;
  -         if ((active0 & 0x5a000007000L) != 0L)
  +         if ((active0 & 0x45a000007000L) != 0L)
            {
  -            jjmatchedKind = 46;
  +            jjmatchedKind = 47;
               jjmatchedPos = 1;
               return 6;
            }
  +         if ((active0 & 0x100015540000L) != 0L)
  +            return 6;
            return -1;
         case 2:
  -         if ((active0 & 0x5a000000000L) != 0L)
  -            return 6;
  -         if ((active0 & 0x7000L) != 0L)
  +         if ((active0 & 0x400000007000L) != 0L)
            {
  -            jjmatchedKind = 46;
  +            jjmatchedKind = 47;
               jjmatchedPos = 2;
               return 6;
            }
  +         if ((active0 & 0x5a000000000L) != 0L)
  +            return 6;
            return -1;
         case 3:
  -         if ((active0 & 0x5000L) != 0L)
  -            return 6;
  -         if ((active0 & 0x2000L) != 0L)
  +         if ((active0 & 0x400000002000L) != 0L)
            {
  -            jjmatchedKind = 46;
  +            jjmatchedKind = 47;
               jjmatchedPos = 3;
               return 6;
            }
  +         if ((active0 & 0x5000L) != 0L)
  +            return 6;
            return -1;
         default :
            return -1;
  @@ -314,7 +314,7 @@
         case 100:
            return jjMoveStringLiteralDfa1_1(0x2000000000L);
         case 101:
  -         return jjMoveStringLiteralDfa1_1(0x400000L);
  +         return jjMoveStringLiteralDfa1_1(0x400000400000L);
         case 102:
            return jjMoveStringLiteralDfa1_1(0x2000L);
         case 103:
  @@ -372,6 +372,8 @@
            break;
         case 105:
            return jjMoveStringLiteralDfa2_1(active0, 0x2000000000L);
  +      case 109:
  +         return jjMoveStringLiteralDfa2_1(active0, 0x400000000000L);
         case 110:
            return jjMoveStringLiteralDfa2_1(active0, 0x40000000000L);
         case 111:
  @@ -420,6 +422,8 @@
            break;
         case 108:
            return jjMoveStringLiteralDfa3_1(active0, 0x6000L);
  +      case 112:
  +         return jjMoveStringLiteralDfa3_1(active0, 0x400000000000L);
         case 116:
            if ((active0 & 0x10000000000L) != 0L)
               return jjStartNfaWithStates_1(2, 40, 6);
  @@ -456,6 +460,8 @@
            break;
         case 115:
            return jjMoveStringLiteralDfa4_1(active0, 0x2000L);
  +      case 116:
  +         return jjMoveStringLiteralDfa4_1(active0, 0x400000000000L);
         default :
            break;
      }
  @@ -476,6 +482,10 @@
            if ((active0 & 0x2000L) != 0L)
               return jjStartNfaWithStates_1(4, 13, 6);
            break;
  +      case 121:
  +         if ((active0 & 0x400000000000L) != 0L)
  +            return jjStartNfaWithStates_1(4, 46, 6);
  +         break;
         default :
            break;
      }
  @@ -527,8 +537,8 @@
                     }
                     else if ((0x1800000000L & l) != 0L)
                     {
  -                     if (kind > 46)
  -                        kind = 46;
  +                     if (kind > 47)
  +                        kind = 47;
                        jjCheckNAdd(6);
                     }
                     else if (curChar == 39)
  @@ -559,15 +569,15 @@
                  case 5:
                     if ((0x1800000000L & l) == 0L)
                        break;
  -                  if (kind > 46)
  -                     kind = 46;
  +                  if (kind > 47)
  +                     kind = 47;
                     jjCheckNAdd(6);
                     break;
                  case 6:
                     if ((0x3ff001000000000L & l) == 0L)
                        break;
  -                  if (kind > 46)
  -                     kind = 46;
  +                  if (kind > 47)
  +                     kind = 47;
                     jjCheckNAdd(6);
                     break;
                  case 7:
  @@ -691,8 +701,8 @@
                  case 6:
                     if ((0x7fffffe87fffffeL & l) == 0L)
                        break;
  -                  if (kind > 46)
  -                     kind = 46;
  +                  if (kind > 47)
  +                     kind = 47;
                     jjCheckNAdd(6);
                     break;
                  case 2:
  @@ -771,8 +781,8 @@
                  case 6:
                     if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
                        break;
  -                  if (kind > 46)
  -                     kind = 46;
  +                  if (kind > 47)
  +                     kind = 47;
                     jjCheckNAdd(6);
                     break;
                  case 20:
  @@ -853,7 +863,7 @@
   "\74", "\154\164", "\75\75", "\145\161", "\74\75", "\154\145", "\76\75", "\147\145", 
   "\41\75", "\156\145", "\50", "\51", "\133", "\135", "\53", "\55", "\52", "\57", 
   "\144\151\166", "\45", "\155\157\144", "\156\157\164", "\41", "\141\156\144", "\46\46", 
  -"\157\162", "\174\174", null, null, null, null, null, };
  +"\157\162", "\174\174", "\145\155\160\164\171", null, null, null, null, null, };
   public static final String[] lexStateNames = {
      "DEFAULT", 
      "IN_EXPRESSION", 
  @@ -861,10 +871,10 @@
   public static final int[] jjnewLexState = {
      -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
  -   -1, 
  +   -1, -1, 
   };
   static final long[] jjtoToken = {
  -   0x47ffffffffd87L, 
  +   0x8fffffffffd87L, 
   };
   static final long[] jjtoSkip = {
      0x78L, 
  @@ -968,9 +978,9 @@
          jjmatchedKind = 0x7fffffff;
          jjmatchedPos = 0;
          curPos = jjMoveStringLiteralDfa0_1();
  -       if (jjmatchedPos == 0 && jjmatchedKind > 50)
  +       if (jjmatchedPos == 0 && jjmatchedKind > 51)
          {
  -          jjmatchedKind = 50;
  +          jjmatchedKind = 51;
          }
          break;
      }
  
  
  
  1.4       +28 -0     jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/test/EvaluationTest.java
  
  Index: EvaluationTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/test/EvaluationTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EvaluationTest.java	14 Apr 2002 14:32:37 -0000	1.3
  +++ EvaluationTest.java	14 Apr 2002 23:34:58 -0000	1.4
  @@ -66,8 +66,10 @@
   import java.io.PrintStream;
   import java.util.ArrayList;
   import java.util.HashMap;
  +import java.util.HashSet;
   import java.util.List;
   import java.util.Map;
  +import java.util.Set;
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.PageContext;
   import org.apache.taglibs.standard.lang.jstl.ELException;
  @@ -372,6 +374,32 @@
         ret.setAttribute ("pbean5", Factory.createBean5 ());
         ret.setAttribute ("pbean6", Factory.createBean6 ());
         ret.setAttribute ("pbean7", Factory.createBean7 ());
  +    }
  +
  +    // Create the empty tests
  +    {
  +      Map m = new HashMap ();
  +      m.put ("emptyArray", new Object [0]);
  +      m.put ("nonemptyArray", new Object [] {"abc"});
  +      m.put ("emptyList", new ArrayList ());
  +      {
  +	List l = new ArrayList ();
  +	l.add ("hello");
  +	m.put ("nonemptyList", l);
  +      }
  +      m.put ("emptyMap", new HashMap ());
  +      {
  +	Map m2 = new HashMap ();
  +	m2.put ("a", "a");
  +	m.put ("nonemptyMap", m2);
  +      }
  +      m.put ("emptySet", new HashSet ());
  +      {
  +	Set s = new HashSet ();
  +	s.add ("hello");
  +	m.put ("nonemptySet", s);
  +      }
  +      ret.setAttribute ("emptyTests", m);
       }
   
       return ret;
  
  
  
  1.5       +34 -0     jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/test/evaluationTests.txt
  
  Index: evaluationTests.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/test/evaluationTests.txt,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- evaluationTests.txt	14 Apr 2002 23:05:33 -0000	1.4
  +++ evaluationTests.txt	14 Apr 2002 23:34:58 -0000	1.5
  @@ -746,3 +746,37 @@
   java.lang.Object
   ${false or 'true'}
   java.lang.Object
  +
  +#######################################################
  +# test empty operator
  +
  +${ empty "A"}
  +java.lang.Object
  +${ empty "" }
  +java.lang.Object
  +${ empty null }
  +java.lang.Object
  +${ empty false}
  +java.lang.Object
  +${ empty 0}
  +java.lang.Object
  +${ not empty 0}
  +java.lang.Object
  +${ not empty empty 0}
  +java.lang.Object
  +${ empty emptyTests.emptyArray }
  +java.lang.Object
  +${ empty emptyTests.nonemptyArray }
  +java.lang.Object
  +${ empty emptyTests.emptyList }
  +java.lang.Object
  +${ empty emptyTests.nonemptyList }
  +java.lang.Object
  +${ empty emptyTests.emptyMap }
  +java.lang.Object
  +${ empty emptyTests.nonemptyMap }
  +java.lang.Object
  +${ empty emptyTests.emptySet }
  +java.lang.Object
  +${ empty emptyTests.nonemptySet }
  +java.lang.Object
  
  
  
  1.6       +88 -9     jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/test/evaluationTestsOutput.txt
  
  Index: evaluationTestsOutput.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/test/evaluationTestsOutput.txt,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- evaluationTestsOutput.txt	14 Apr 2002 23:05:33 -0000	1.5
  +++ evaluationTestsOutput.txt	14 Apr 2002 23:34:58 -0000	1.6
  @@ -1126,47 +1126,47 @@
   
   Expression: ${and}
   ExpectedType: class java.lang.Object
  -Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${and}": Encountered "and", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${and}": Encountered "and", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   With type: javax.servlet.jsp.JspException
   
   Expression: ${or}
   ExpectedType: class java.lang.Object
  -Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${or}": Encountered "or", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${or}": Encountered "or", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   With type: javax.servlet.jsp.JspException
   
   Expression: ${not}
   ExpectedType: class java.lang.Object
  -Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${not}": Encountered "}", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${not}": Encountered "}", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   With type: javax.servlet.jsp.JspException
   
   Expression: ${eq}
   ExpectedType: class java.lang.Object
  -Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${eq}": Encountered "eq", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${eq}": Encountered "eq", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   With type: javax.servlet.jsp.JspException
   
   Expression: ${ne}
   ExpectedType: class java.lang.Object
  -Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ne}": Encountered "ne", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ne}": Encountered "ne", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   With type: javax.servlet.jsp.JspException
   
   Expression: ${lt}
   ExpectedType: class java.lang.Object
  -Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${lt}": Encountered "lt", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${lt}": Encountered "lt", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   With type: javax.servlet.jsp.JspException
   
   Expression: ${gt}
   ExpectedType: class java.lang.Object
  -Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${gt}": Encountered "gt", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${gt}": Encountered "gt", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   With type: javax.servlet.jsp.JspException
   
   Expression: ${le}
   ExpectedType: class java.lang.Object
  -Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${le}": Encountered "le", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${le}": Encountered "le", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   With type: javax.servlet.jsp.JspException
   
   Expression: ${ge}
   ExpectedType: class java.lang.Object
  -Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ge}": Encountered "ge", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Evaluates to: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${ge}": Encountered "ge", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   With type: javax.servlet.jsp.JspException
   
   Expression: ${instanceof}
  @@ -1667,5 +1667,84 @@
   Expression: ${false or 'true'}
   ExpectedType: class java.lang.Object
   Evaluates to: true
  +With type: java.lang.Boolean
  +
  +
  +#######################################################
  +# test empty operator
  +
  +Expression: ${ empty "A"}
  +ExpectedType: class java.lang.Object
  +Evaluates to: false
  +With type: java.lang.Boolean
  +
  +Expression: ${ empty "" }
  +ExpectedType: class java.lang.Object
  +Evaluates to: true
  +With type: java.lang.Boolean
  +
  +Expression: ${ empty null }
  +ExpectedType: class java.lang.Object
  +Evaluates to: true
  +With type: java.lang.Boolean
  +
  +Expression: ${ empty false}
  +ExpectedType: class java.lang.Object
  +Evaluates to: false
  +With type: java.lang.Boolean
  +
  +Expression: ${ empty 0}
  +ExpectedType: class java.lang.Object
  +Evaluates to: false
  +With type: java.lang.Boolean
  +
  +Expression: ${ not empty 0}
  +ExpectedType: class java.lang.Object
  +Evaluates to: true
  +With type: java.lang.Boolean
  +
  +Expression: ${ not empty empty 0}
  +ExpectedType: class java.lang.Object
  +Evaluates to: true
  +With type: java.lang.Boolean
  +
  +Expression: ${ empty emptyTests.emptyArray }
  +ExpectedType: class java.lang.Object
  +Evaluates to: true
  +With type: java.lang.Boolean
  +
  +Expression: ${ empty emptyTests.nonemptyArray }
  +ExpectedType: class java.lang.Object
  +Evaluates to: false
  +With type: java.lang.Boolean
  +
  +Expression: ${ empty emptyTests.emptyList }
  +ExpectedType: class java.lang.Object
  +Evaluates to: true
  +With type: java.lang.Boolean
  +
  +Expression: ${ empty emptyTests.nonemptyList }
  +ExpectedType: class java.lang.Object
  +Evaluates to: false
  +With type: java.lang.Boolean
  +
  +Expression: ${ empty emptyTests.emptyMap }
  +ExpectedType: class java.lang.Object
  +Evaluates to: true
  +With type: java.lang.Boolean
  +
  +Expression: ${ empty emptyTests.nonemptyMap }
  +ExpectedType: class java.lang.Object
  +Evaluates to: false
  +With type: java.lang.Boolean
  +
  +Expression: ${ empty emptyTests.emptySet }
  +ExpectedType: class java.lang.Object
  +Evaluates to: false
  +With type: java.lang.Boolean
  +
  +Expression: ${ empty emptyTests.nonemptySet }
  +ExpectedType: class java.lang.Object
  +Evaluates to: false
   With type: java.lang.Boolean
   
  
  
  
  1.7       +10 -0     jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/test/parserTests.txt
  
  Index: parserTests.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/test/parserTests.txt,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- parserTests.txt	12 Apr 2002 11:28:42 -0000	1.6
  +++ parserTests.txt	14 Apr 2002 23:34:58 -0000	1.7
  @@ -112,3 +112,13 @@
   ${ a || b}
   ${ !a }
   ${ not a }
  +
  +# empty operator
  +${ empty "A"}
  +${ empty "" }
  +${ empty null }
  +${ empty false}
  +${ empty 0}
  +${ not empty 0}
  +${ not empty empty 0}
  +${ empty }
  
  
  
  1.9       +23 -5     jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/test/parserTestsOutput.txt
  
  Index: parserTestsOutput.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/lang/jstl/test/parserTestsOutput.txt,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- parserTestsOutput.txt	14 Apr 2002 14:32:37 -0000	1.8
  +++ parserTestsOutput.txt	14 Apr 2002 23:34:58 -0000	1.9
  @@ -4,7 +4,7 @@
   Attribute value: ${ 3}
   Parses to: ${3}
   Attribute value: a${
  -Causes an error: An error occurred while parsing custom action attribute "test" with value "a${": Encountered "<EOF>", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Causes an error: An error occurred while parsing custom action attribute "test" with value "a${": Encountered "<EOF>", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   Attribute value: a${ 5 }
   Parses to: a${5}
   Attribute value: ${ 3 }b
  @@ -76,9 +76,9 @@
   Attribute value: ${" with escaping \"\\\""}
   Parses to: ${" with escaping \"\\\""}
   Attribute value: ${" bad \ escaping"}
  -Causes an error: An error occurred while parsing custom action attribute "test" with value "${" bad \ escaping"}": Encountered "" bad \ ", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Causes an error: An error occurred while parsing custom action attribute "test" with value "${" bad \ escaping"}": Encountered "" bad \ ", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   Attribute value: ${" bad \' escaping"}
  -Causes an error: An error occurred while parsing custom action attribute "test" with value "${" bad \' escaping"}": Encountered "" bad \'", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Causes an error: An error occurred while parsing custom action attribute "test" with value "${" bad \' escaping"}": Encountered "" bad \'", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   
   # string literals with '
   Attribute value: ${'abc'}
  @@ -98,9 +98,9 @@
   Attribute value: ${' with escaping \'\\\''}
   Parses to: ${" with escaping '\\'"}
   Attribute value: ${' bad \ escaping'}
  -Causes an error: An error occurred while parsing custom action attribute "test" with value "${' bad \ escaping'}": Encountered "' bad \ ", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Causes an error: An error occurred while parsing custom action attribute "test" with value "${' bad \ escaping'}": Encountered "' bad \ ", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   Attribute value: ${' bad \" escaping'}
  -Causes an error: An error occurred while parsing custom action attribute "test" with value "${' bad \" escaping'}": Encountered "' bad \"", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", <IDENTIFIER>]
  +Causes an error: An error occurred while parsing custom action attribute "test" with value "${' bad \" escaping'}": Encountered "' bad \"", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
   
   # identifiers
   Attribute value: ${abc}
  @@ -197,3 +197,21 @@
   Parses to: ${(not a)}
   Attribute value: ${ not a }
   Parses to: ${(not a)}
  +
  +# empty operator
  +Attribute value: ${ empty "A"}
  +Parses to: ${(empty "A")}
  +Attribute value: ${ empty "" }
  +Parses to: ${(empty "")}
  +Attribute value: ${ empty null }
  +Parses to: ${(empty null)}
  +Attribute value: ${ empty false}
  +Parses to: ${(empty false)}
  +Attribute value: ${ empty 0}
  +Parses to: ${(empty 0)}
  +Attribute value: ${ not empty 0}
  +Parses to: ${(not empty 0)}
  +Attribute value: ${ not empty empty 0}
  +Parses to: ${(not empty empty 0)}
  +Attribute value: ${ empty }
  +Causes an error: An error occurred while parsing custom action attribute "test" with value "${ empty }": Encountered "}", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>