jsalvata    2004/02/10 15:15:31

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/sampler
                        HTTPSampler.java
  Log:
  Fix initialization bug in remote execution.
  
  Revision  Changes    Path
  1.84      +19 -30    
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
  
  Index: HTTPSampler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- HTTPSampler.java  6 Feb 2004 10:59:23 -0000       1.83
  +++ HTTPSampler.java  10 Feb 2004 23:15:30 -0000      1.84
  @@ -175,7 +175,21 @@
           System.setProperty("javax.net.ssl.debug", "all");
       }
   
  -    private static Pattern pattern; // initialized by the constructor
  +    private static Pattern pattern;
  +    static {
  +        try
  +        {
  +            pattern= new Perl5Compiler().compile(
  +                    " ",
  +                    Perl5Compiler.READ_ONLY_MASK
  +                        & Perl5Compiler.SINGLELINE_MASK);
  +        }
  +        catch (MalformedPatternException e)
  +        {
  +            log.error("Cant compile pattern.", e);
  +            throw new Error(e.toString()); // programming error -- bail out
  +        }
  +    }
       
       private static ThreadLocal localMatcher= new ThreadLocal()
       {
  @@ -198,42 +212,14 @@
               .getProperty("HTTPSampler.delegateRedirects", "false")
               .equalsIgnoreCase("true");
   
  -
        /**
         * Constructor for the HTTPSampler object.
         */
        public HTTPSampler()
        {
  -        try
  -        {
  -            pattern= new Perl5Compiler().compile(
  -                    " ",
  -                    Perl5Compiler.READ_ONLY_MASK
  -                        & Perl5Compiler.SINGLELINE_MASK);
  -        }
  -        catch (MalformedPatternException e)
  -        {
  -            log.error("Cant compile pattern.", e);
  -            throw new Error(e.toString()); // programming error -- bail out
  -        }
  -
  -             setArguments(new Arguments());
  -     }
  -
  -     public HTTPSampler(URL u)
  -     {
  -             setMethod(GET);
  -             setDomain(u.getHost());
  -             setPath(u.getPath());
  -             setPort(u.getPort());
  -             setProtocol(u.getProtocol());
  -             parseArguments(u.getQuery());
  -             setFollowRedirects(true);
  -             setUseKeepAlive(true);
                setArguments(new Arguments());
        }
   
  -
       public void setFileField(String value)
       {
           setProperty(FILE_FIELD, value);
  @@ -305,6 +291,9 @@
       {
        // TODO JDK1.4 
        // this seems to be equivalent to path.replaceAll(" ","%20");
  +        // TODO move to JMeterUtils or jorphan.
  +        // unless we move to JDK1.4. (including the
  +        // 'pattern' initialization code earlier on)
           path=
               Util.substitute(
                   (Perl5Matcher)localMatcher.get(),
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to