You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2003/10/15 19:53:52 UTC

cvs commit: jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy ProxyControl.java

sebb        2003/10/15 10:53:52

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/proxy
                        ProxyControl.java
  Log:
  Detect Malformed RE and log a warning message
  
  Revision  Changes    Path
  1.28      +38 -27    jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
  
  Index: ProxyControl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ProxyControl.java	5 Oct 2003 00:44:02 -0000	1.27
  +++ ProxyControl.java	15 Oct 2003 17:53:52 -0000	1.28
  @@ -83,6 +83,7 @@
   import org.apache.jmeter.util.JMeterUtils;
   import org.apache.jorphan.logging.LoggingManager;
   import org.apache.log.Logger;
  +import org.apache.oro.text.MalformedCachePatternException;
   import org.apache.oro.text.PatternCacheLRU;
   import org.apache.oro.text.regex.Pattern;
   import org.apache.oro.text.regex.Perl5Compiler;
  @@ -364,25 +365,30 @@
       private boolean checkIncludes(HTTPSampler sampler)
       {
           boolean ok = false;
  +		StringBuffer url = new StringBuffer(sampler.getDomain());
  +		url.append(":");
  +		url.append(sampler.getPort());
  +		url.append(sampler.getPath());
  +		if (sampler.getQueryString().length() > 0)
  +		{
  +			url.append("?");
  +			url.append(sampler.getQueryString());
  +		}
           PropertyIterator iter = getIncludePatterns().iterator();
           while (iter.hasNext())
           {
               String item = iter.next().getStringValue();
  -            Pattern pattern =
  -                patternCache.getPattern(
  -                    item,
  -                    Perl5Compiler.READ_ONLY_MASK
  -                        & Perl5Compiler.SINGLELINE_MASK);
  -            StringBuffer url = new StringBuffer(sampler.getDomain());
  -            url.append(":");
  -            url.append(sampler.getPort());
  -            url.append(sampler.getPath());
  -            if (sampler.getQueryString().length() > 0)
  -            {
  -                url.append("?");
  -                url.append(sampler.getQueryString());
  -            }
  -            ok = matcher.matches(url.toString(), pattern);
  +			Pattern pattern;
  +			try {
  +				pattern =
  +				    patternCache.getPattern(
  +				        item,
  +				        Perl5Compiler.READ_ONLY_MASK
  +				            & Perl5Compiler.SINGLELINE_MASK);
  +				ok = matcher.matches(url.toString(), pattern);
  +			} catch (MalformedCachePatternException e) {
  +				log.warn("Skipped invalid Include pattern "+item,e);
  +			}
               if (ok)
               {
                   break;
  @@ -394,25 +400,30 @@
       private boolean checkExcludes(HTTPSampler sampler)
       {
           boolean ok = true;
  +		StringBuffer url = new StringBuffer(sampler.getDomain());
  +		url.append(":");
  +		url.append(sampler.getPort());
  +		url.append(sampler.getPath());
  +		if (sampler.getQueryString().length() > 0)
  +		{
  +			url.append("?");
  +			url.append(sampler.getQueryString());
  +		}
           PropertyIterator iter = getExcludePatterns().iterator();
           while (iter.hasNext())
           {
               String item = iter.next().getStringValue();
  -            Pattern pattern =
  +			Pattern pattern=null;
  +            try {
  +                pattern =
                   patternCache.getPattern(
                       item,
                       Perl5Compiler.READ_ONLY_MASK
                           & Perl5Compiler.SINGLELINE_MASK);
  -            StringBuffer url = new StringBuffer(sampler.getDomain());
  -            url.append(":");
  -            url.append(sampler.getPort());
  -            url.append(sampler.getPath());
  -            if (sampler.getQueryString().length() > 0)
  -            {
  -                url.append("?");
  -                url.append(sampler.getQueryString());
  -            }
  -            ok = ok && !matcher.matches(url.toString(), pattern);
  +				ok = ok && !matcher.matches(url.toString(), pattern);
  +			} catch (MalformedCachePatternException e){
  +				log.warn("Skipped invalid Exclude pattern: "+item,e);
  +			}
               if (!ok)
               {
                   return ok;
  
  
  

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