You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by la...@apache.org on 2001/12/31 22:39:06 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/test Matcher.java

larryi      01/12/31 13:39:06

  Modified:    src/share/org/apache/tomcat/util/test Matcher.java
  Log:
  Update to set the result to true if test is skipped.
  
  Also, implement "unless" on Matcher as a comma separated list of properties.
  The matcher is executed only if all properties are not defined. This allows
  a sequence of matchers to specify an "if" on different properties and
  a default matcher to specify the list of properties in an "unless".
  
  Revision  Changes    Path
  1.3       +18 -4     jakarta-tomcat/src/share/org/apache/tomcat/util/test/Matcher.java
  
  Index: Matcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/test/Matcher.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Matcher.java	22 Sep 2001 21:10:50 -0000	1.2
  +++ Matcher.java	31 Dec 2001 21:39:06 -0000	1.3
  @@ -181,12 +181,26 @@
           if( client != null ) {
               Project project = client.getProject();
               if( project != null ) {
  -                if( ifProp != null && project.getProperty(ifProp) == null)
  +                if( ifProp != null && project.getProperty(ifProp) == null) {
                       // skip if "if" property is not set
  +                    result = true;
                       return true;
  -                if( unlessProp != null && project.getProperty(unlessProp) != null )
  -                    // skip if "unless" property is set
  -                    return true;
  +                }
  +                // Allow a comma separated list of properties for "unless"
  +                // so after using a sequence of properties, each in an "if",
  +                // you can include the list in an "unless" to implement the
  +                // default.
  +                if( unlessProp != null) {
  +                    StringTokenizer st = new StringTokenizer(unlessProp,",");
  +                    while( st.hasMoreElements() ) {
  +                        String prop = (String)st.nextElement();
  +                        if( project.getProperty(prop) != null ) {
  +                            // skip if an "unless" property is set
  +                            result = true;
  +                            return true;
  +                        }
  +                    }
  +                }
               }
           }
           return false;
  
  
  

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