tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lar...@apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/test Matcher.java
Date Mon, 31 Dec 2001 21:39:06 GMT
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:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message