tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/webapps/admin build.xml
Date Fri, 03 Sep 2004 09:33:06 GMT
remm        2004/09/03 02:33:06

  Modified:    webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve
                        RemoteHostValveForm.java ValveUtil.java
                        RemoteAddrValveForm.java
               webapps/admin build.xml
  Log:
  - The core doesn't use regexp anymore, so this shouldn't either.
  
  Revision  Changes    Path
  1.6       +9 -9      jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/RemoteHostValveForm.java
  
  Index: RemoteHostValveForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/RemoteHostValveForm.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RemoteHostValveForm.java	27 Feb 2004 14:59:06 -0000	1.5
  +++ RemoteHostValveForm.java	3 Sep 2004 09:33:06 -0000	1.6
  @@ -19,9 +19,9 @@
   import java.lang.IllegalArgumentException;
   import java.net.InetAddress;
   import java.util.List;
  +import java.util.regex.Pattern;
   import javax.servlet.http.HttpServletRequest;
   
  -import org.apache.regexp.RE;
   import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.action.ActionForm;
  @@ -57,12 +57,12 @@
       /**
        * The set of <code>allow</code> regular expressions we will evaluate.
        */
  -    private RE allows[] = new RE[0];
  +    private Pattern allows[] = new Pattern[0];
   
       /**
        * The set of <code>deny</code> regular expressions we will evaluate.
        */
  -    private RE denies[] = new RE[0];
  +    private Pattern denies[] = new Pattern[0];
       
       
       // ------------------------------------------------------------- Properties
  @@ -195,24 +195,24 @@
           }
           
           for (int i = 0; i < denies.length; i++) {
  -            if (denies[i].match(host)) {
  +            if (denies[i].matcher(host).matches()) {
                   if (allows.length < 1) {
                       errors.add("deny",
                           new ActionError("error.denyHost"));
                   }    
                   for (int j = 0; j < allows.length; j++) {
  -                    if (!allows[j].match(host)) { 
  +                    if (!allows[j].matcher(host).matches()) { 
                           errors.add("deny",
                           new ActionError("error.denyHost"));
                       }
                   }
  -            } else if (denies[i].match(ip)) {
  +            } else if (denies[i].matcher(ip).matches()) {
                   if (allows.length < 1) {
                       errors.add("deny",
                           new ActionError("error.denyHost"));
                   }               
                   for (int j = 0; j < allows.length; j++) {
  -                    if (!allows[j].match(ip)) { 
  +                    if (!allows[j].matcher(ip).matches()) { 
                           errors.add("deny",
                           new ActionError("error.denyHost"));
                       }
  @@ -227,7 +227,7 @@
           }
           
           for (int i = 0; i < allows.length; i++) {
  -            if (allows[i].match(host)) {
  +            if (allows[i].matcher(host).matches()) {
                   allowMatch = true;       
               }
           }
  
  
  
  1.13      +10 -10    jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/ValveUtil.java
  
  Index: ValveUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/ValveUtil.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ValveUtil.java	10 Jul 2004 06:56:16 -0000	1.12
  +++ ValveUtil.java	3 Sep 2004 09:33:06 -0000	1.13
  @@ -21,6 +21,8 @@
   import java.util.Iterator;
   import java.util.Locale;
   import java.io.IOException;
  +import java.util.regex.Pattern;
  +import java.util.regex.PatternSyntaxException;
   import javax.management.Attribute;
   import javax.management.MBeanServer;
   import javax.management.MBeanServerFactory;
  @@ -33,8 +35,6 @@
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import javax.servlet.http.HttpSession;
  -import org.apache.regexp.RE;
  -import org.apache.regexp.RESyntaxException;
   import org.apache.struts.Globals;
   import org.apache.struts.action.Action;
   import org.apache.struts.action.ActionError;
  @@ -207,14 +207,14 @@
        * @exception IllegalArgumentException if one of the patterns has
        *  invalid syntax
        */
  -    public static RE[] precalculate(String list) 
  +    public static Pattern[] precalculate(String list) 
                                       throws IllegalArgumentException {
   
           if (list == null)
  -            return (new RE[0]);
  +            return (new Pattern[0]);
           list = list.trim();
           if (list.length() < 1)
  -            return (new RE[0]);
  +            return (new Pattern[0]);
           list += ",";
   
           ArrayList reList = new ArrayList();
  @@ -224,16 +224,16 @@
                   break;
               String pattern = list.substring(0, comma).trim();
               try {
  -                reList.add(new RE(pattern));
  -            } catch (RESyntaxException e) {
  +                reList.add(Pattern.compile(pattern));
  +            } catch (PatternSyntaxException e) {
                   throw new IllegalArgumentException
                       ("Syntax error in request filter pattern");
               }
               list = list.substring(comma + 1);
           }
   
  -        RE reArray[] = new RE[reList.size()];
  -        return ((RE[]) reList.toArray(reArray));
  +        Pattern reArray[] = new Pattern[reList.size()];
  +        return ((Pattern[]) reList.toArray(reArray));
   
       }    
   
  
  
  
  1.6       +8 -8      jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/RemoteAddrValveForm.java
  
  Index: RemoteAddrValveForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/RemoteAddrValveForm.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RemoteAddrValveForm.java	27 Feb 2004 14:59:06 -0000	1.5
  +++ RemoteAddrValveForm.java	3 Sep 2004 09:33:06 -0000	1.6
  @@ -19,14 +19,14 @@
   import java.lang.IllegalArgumentException;
   import java.net.InetAddress;
   import java.util.List;
  +import java.util.regex.Pattern;
   import javax.servlet.http.HttpServletRequest;
  -import org.apache.regexp.RE;
  +
   import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionMapping;
   
  -
   import org.apache.webapp.admin.ApplicationServlet;
   import org.apache.webapp.admin.LabelValueBean;
   
  @@ -57,12 +57,12 @@
       /**
        * The set of <code>allow</code> regular expressions we will evaluate.
        */
  -    private RE allows[] = new RE[0];
  +    private Pattern allows[] = new Pattern[0];
   
       /**
        * The set of <code>deny</code> regular expressions we will evaluate.
        */
  -    private RE denies[] = new RE[0];
  +    private Pattern denies[] = new Pattern[0];
   
   
       // ------------------------------------------------------------- Properties
  @@ -192,13 +192,13 @@
           }
           
           for (int i = 0; i < denies.length; i++) {
  -            if (denies[i].match(ip)) {
  +            if (denies[i].matcher(ip).matches()) {
                   if (allows.length < 1) {
                       errors.add("deny",
                           new ActionError("error.denyIP"));
                   }
                   for (int j = 0; j < allows.length; j++) {
  -                    if (!allows[j].match(ip)) { 
  +                    if (!allows[j].matcher(ip).matches()) { 
                           errors.add("deny",
                           new ActionError("error.denyIP"));
                       }
  @@ -211,7 +211,7 @@
               allowMatch = false;
           }
           for (int i = 0; i < allows.length; i++) {
  -            if (allows[i].match(ip)) {
  +            if (allows[i].matcher(ip).matches()) {
                   allowMatch = true;       
               }
           }       
  
  
  
  1.15      +1 -9      jakarta-tomcat-catalina/webapps/admin/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/build.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- build.xml	1 Sep 2004 10:10:48 -0000	1.14
  +++ build.xml	3 Sep 2004 09:33:06 -0000	1.15
  @@ -28,8 +28,8 @@
       <pathelement location="${jsp-api.jar}"/>
       <pathelement location="${struts.jar}"/>
       <pathelement location="${commons-beanutils.jar}"/>
  +    <pathelement location="${commons-collections.jar}"/>
       <pathelement location="${commons-digester.jar}"/>
  -    <pathelement location="${regexp.jar}"/>
     </path>
   
   
  @@ -73,9 +73,6 @@
       <available property="beanutils.present"
        classname="org.apache.commons.beanutils.PropertyUtils"
        classpath="${commons-beanutils.jar}" />
  -    <available property="regexp.present"
  -     classname="org.apache.regexp.RE"
  -     classpath="${regexp.jar}" />
   
   
       <!-- JAR files availability flags -->
  @@ -85,7 +82,6 @@
       <available property="jsp-api.jar.present" file="${jsp-api.jar}" />
       <available property="struts.jar.present"  file="${struts.jar}" />
       <available property="beanutils.jar.present" file="${commons-beanutils.jar}" />
  -    <available property="regexp.jar.present" file="${regexp.jar}" />
   
       <!-- Conditional compilation flags (determined from the flags above) -->
       <condition property="compile.admin">
  @@ -95,7 +91,6 @@
             <equals arg1="${struts.present}" arg2="true" />
             <equals arg1="${jmx.present}" arg2="true" />
             <equals arg1="${modeler.present}" arg2="true" />
  -          <equals arg1="${regexp.present}" arg2="true" />
             <available file="${struts.lib}/struts-bean.tld" />
             <available file="${struts.lib}/struts-html.tld" />
             <available file="${struts.lib}/struts-logic.tld" />
  @@ -142,7 +137,6 @@
       <echo message="modeler.present=${modeler.present}" />
       <echo message="servlet.present=${servlet.present}" />
       <echo message="jsp.present=${jsp.present}" />
  -    <echo message="regexp.present=${regexp.present}" />
   
       <echo message="--- Required JARs ---" />
       <echo message="jmx.jar.present=${jmx.jar.present}" />
  @@ -151,7 +145,6 @@
       <echo message="jsp-api.jar.present=${jsp-api.jar.present}" />
       <echo message="struts.jar.present=${struts.jar.present}" />
       <echo message="beanutils.jar.present=${beanutils.jar.present}" />
  -    <echo message="regexp.jar.present=${regexp.jar.present}" />
   
       <echo message="--- Optional JARs ---" />
   
  @@ -189,7 +182,6 @@
       <copy tofile="${webapps.build}/${webapp.name}/WEB-INF/lib/commons-collections.jar"

       	file="${commons-collections.jar}"/>
       <copy todir="${webapps.build}/${webapp.name}/WEB-INF/lib" file="${commons-digester.jar}"/>
  -    <copy todir="${webapps.build}/${webapp.name}/WEB-INF/lib" file="${regexp.jar}"/>
       <copy todir="${webapps.build}/${webapp.name}">
         <fileset dir=".">
           <exclude name="build.*"/>
  
  
  

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


Mime
View raw message