You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2012/04/25 14:23:01 UTC

svn commit: r1330236 - in /jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java xdocs/changes.xml

Author: sebb
Date: Wed Apr 25 12:23:01 2012
New Revision: 1330236

URL: http://svn.apache.org/viewvc?rev=1330236&view=rev
Log:
Bug 53145 - HTTP Sampler - function in path evaluated too early

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1330236&r1=1330235&r2=1330236&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java Wed Apr 25 12:23:01 2012
@@ -1333,17 +1333,26 @@ public abstract class HTTPSamplerBase ex
      */
     public void testStarted() {
         JMeterProperty pathP = getProperty(PATH);
-        log.debug("path property is a " + pathP.getClass().getName());
-        log.debug("path beginning value = " + pathP.getStringValue());
-        if (pathP instanceof StringProperty && pathP.getStringValue().length() > 0) {
-            log.debug("Encoding spaces in path");
-            pathP.setObjectValue(encodeSpaces(pathP.getStringValue()));
-            dynamicPath = false;
+        boolean debugEnabled = log.isDebugEnabled();
+        if (debugEnabled) {
+            log.debug("path property is of type " + pathP.getClass().getName());
+        }
+        if (pathP instanceof StringProperty) {
+            String value = pathP.getStringValue();
+            if (value.length() > 0) {
+                if (debugEnabled) {
+                    log.debug("Encoding spaces in path: "+value);
+                }
+                pathP.setObjectValue(encodeSpaces(value));
+                dynamicPath = false;
+                if (debugEnabled) {
+                    log.debug("path ending value = " + pathP.getStringValue());
+                }
+            }
         } else {
             log.debug("setting dynamic path to true");
             dynamicPath = true;
         }
-        log.debug("path ending value = " + pathP.getStringValue());
     }
 
     /**

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1330236&r1=1330235&r2=1330236&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Wed Apr 25 12:23:01 2012
@@ -94,6 +94,7 @@ Graph Full Results Listener has been rem
 <li>Bug 52885 - Proxy : Recording issues with HTTPS, cookies starting with secure are partly truncated</li>
 <li>Bug 52886 - Proxy : Recording issues with HTTPS when spoofing is on, secure cookies are not always changed</li>
 <li>Bug 52897 - HTTPSampler : Using PUT method with HTTPClient4 and empty Content Encoding and sending files leads to NullPointerException</li>
+<li>Bug 53145 - HTTP Sampler - function in path evaluated too early</li>
 </ul>
 
 <h3>Other Samplers</h3>



Re: svn commit: r1330236 - in /jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java xdocs/changes.xml

Posted by sebb <se...@gmail.com>.
On 26 April 2012 06:25, Philippe Mouawad <ph...@gmail.com> wrote:
> I think there is a difference:
> Previously :
> If
>
>   - (pathP instanceof StringProperty) == true
>   - and (pathP.getStringValue().length() > 0 )== false
>   - => dynamicPath = true;
>
>
> Now :
>
> If
>
>   - (pathP instanceof StringProperty) == true
>   - and (pathP.getStringValue().length() > 0 ) == false
>   - => dynamicPath is not set
>
> Maybe it's part of the fix, but I thought issue was due to logging.

I see now - sorry, I was being dense before.

You're quite right, well spotted!

I'll fix it shortly.

> Regards
> Philipe
>
> On Thu, Apr 26, 2012 at 12:10 AM, sebb <se...@gmail.com> wrote:
>
>> On 25 April 2012 21:48, Philippe Mouawad <ph...@gmail.com>
>> wrote:
>> > Hello sebb,
>> > I have a question below.
>> >
>> > Regards
>> > Philippe
>> >
>> > On Wed, Apr 25, 2012 at 2:23 PM, <se...@apache.org> wrote:
>> >
>> >> Author: sebb
>> >> Date: Wed Apr 25 12:23:01 2012
>> >> New Revision: 1330236
>> >>
>> >> URL: http://svn.apache.org/viewvc?rev=1330236&view=rev
>> >> Log:
>> >> Bug 53145 - HTTP Sampler - function in path evaluated too early
>> >>
>> >> Modified:
>> >>
>> >>
>>  jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
>> >>    jmeter/trunk/xdocs/changes.xml
>> >>
>> >> Modified:
>> >>
>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
>> >> URL:
>> >>
>> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1330236&r1=1330235&r2=1330236&view=diff
>> >>
>> >>
>> ==============================================================================
>> >> ---
>> >>
>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
>> >> (original)
>> >> +++
>> >>
>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
>> >> Wed Apr 25 12:23:01 2012
>> >> @@ -1333,17 +1333,26 @@ public abstract class HTTPSamplerBase ex
>> >>      */
>> >>     public void testStarted() {
>> >>         JMeterProperty pathP = getProperty(PATH);
>> >> -        log.debug("path property is a " + pathP.getClass().getName());
>> >> -        log.debug("path beginning value = " + pathP.getStringValue());
>> >> -        if (pathP instanceof StringProperty &&
>> >> pathP.getStringValue().length() > 0) {
>> >> -            log.debug("Encoding spaces in path");
>> >> -            pathP.setObjectValue(encodeSpaces(pathP.getStringValue()));
>> >> -            dynamicPath = false;
>> >> +        boolean debugEnabled = log.isDebugEnabled();
>> >> +        if (debugEnabled) {
>> >> +            log.debug("path property is of type " +
>> >> pathP.getClass().getName());
>> >> +        }
>> >> +        if (pathP instanceof StringProperty) {
>> >> +            String value = pathP.getStringValue();
>> >> +            if (value.length() > 0) {
>> >> +                if (debugEnabled) {
>> >> +                    log.debug("Encoding spaces in path: "+value);
>> >> +                }
>> >> +                pathP.setObjectValue(encodeSpaces(value));
>> >> +                dynamicPath = false;
>> >> +                if (debugEnabled) {
>> >> +                    log.debug("path ending value = " +
>> >> pathP.getStringValue());
>> >> +                }
>> >> +            }
>> >>
>> > => Shouldn't there be an else case here setting   dynamicPath = true; ?
>> >
>>
>> Looks OK to me.
>> I only moved the debugs and split the if statement.
>>
>> >        } else {
>> >>             log.debug("setting dynamic path to true");
>> >>             dynamicPath = true;
>> >>         }
>> >> -        log.debug("path ending value = " + pathP.getStringValue());
>> >>     }
>> >>
>> >>     /**
>> >>
>> >> Modified: jmeter/trunk/xdocs/changes.xml
>> >> URL:
>> >>
>> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1330236&r1=1330235&r2=1330236&view=diff
>> >>
>> >>
>> ==============================================================================
>> >> --- jmeter/trunk/xdocs/changes.xml (original)
>> >> +++ jmeter/trunk/xdocs/changes.xml Wed Apr 25 12:23:01 2012
>> >> @@ -94,6 +94,7 @@ Graph Full Results Listener has been rem
>> >>  <li>Bug 52885 - Proxy : Recording issues with HTTPS, cookies starting
>> >> with secure are partly truncated</li>
>> >>  <li>Bug 52886 - Proxy : Recording issues with HTTPS when spoofing is
>> on,
>> >> secure cookies are not always changed</li>
>> >>  <li>Bug 52897 - HTTPSampler : Using PUT method with HTTPClient4 and
>> empty
>> >> Content Encoding and sending files leads to NullPointerException</li>
>> >> +<li>Bug 53145 - HTTP Sampler - function in path evaluated too
>> early</li>
>> >>  </ul>
>> >>
>> >>  <h3>Other Samplers</h3>
>> >>
>> >>
>> >>
>> >
>> >
>> > --
>> > Cordialement.
>> > Philippe Mouawad.
>>
>
>
>
> --
> Cordialement.
> Philippe Mouawad.

Re: svn commit: r1330236 - in /jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java xdocs/changes.xml

Posted by Philippe Mouawad <ph...@gmail.com>.
I think there is a difference:
Previously :
If

   - (pathP instanceof StringProperty) == true
   - and (pathP.getStringValue().length() > 0 )== false
   - => dynamicPath = true;


Now :

If

   - (pathP instanceof StringProperty) == true
   - and (pathP.getStringValue().length() > 0 ) == false
   - => dynamicPath is not set

Maybe it's part of the fix, but I thought issue was due to logging.

Regards
Philipe

On Thu, Apr 26, 2012 at 12:10 AM, sebb <se...@gmail.com> wrote:

> On 25 April 2012 21:48, Philippe Mouawad <ph...@gmail.com>
> wrote:
> > Hello sebb,
> > I have a question below.
> >
> > Regards
> > Philippe
> >
> > On Wed, Apr 25, 2012 at 2:23 PM, <se...@apache.org> wrote:
> >
> >> Author: sebb
> >> Date: Wed Apr 25 12:23:01 2012
> >> New Revision: 1330236
> >>
> >> URL: http://svn.apache.org/viewvc?rev=1330236&view=rev
> >> Log:
> >> Bug 53145 - HTTP Sampler - function in path evaluated too early
> >>
> >> Modified:
> >>
> >>
>  jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
> >>    jmeter/trunk/xdocs/changes.xml
> >>
> >> Modified:
> >>
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1330236&r1=1330235&r2=1330236&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
> >> (original)
> >> +++
> >>
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
> >> Wed Apr 25 12:23:01 2012
> >> @@ -1333,17 +1333,26 @@ public abstract class HTTPSamplerBase ex
> >>      */
> >>     public void testStarted() {
> >>         JMeterProperty pathP = getProperty(PATH);
> >> -        log.debug("path property is a " + pathP.getClass().getName());
> >> -        log.debug("path beginning value = " + pathP.getStringValue());
> >> -        if (pathP instanceof StringProperty &&
> >> pathP.getStringValue().length() > 0) {
> >> -            log.debug("Encoding spaces in path");
> >> -            pathP.setObjectValue(encodeSpaces(pathP.getStringValue()));
> >> -            dynamicPath = false;
> >> +        boolean debugEnabled = log.isDebugEnabled();
> >> +        if (debugEnabled) {
> >> +            log.debug("path property is of type " +
> >> pathP.getClass().getName());
> >> +        }
> >> +        if (pathP instanceof StringProperty) {
> >> +            String value = pathP.getStringValue();
> >> +            if (value.length() > 0) {
> >> +                if (debugEnabled) {
> >> +                    log.debug("Encoding spaces in path: "+value);
> >> +                }
> >> +                pathP.setObjectValue(encodeSpaces(value));
> >> +                dynamicPath = false;
> >> +                if (debugEnabled) {
> >> +                    log.debug("path ending value = " +
> >> pathP.getStringValue());
> >> +                }
> >> +            }
> >>
> > => Shouldn't there be an else case here setting   dynamicPath = true; ?
> >
>
> Looks OK to me.
> I only moved the debugs and split the if statement.
>
> >        } else {
> >>             log.debug("setting dynamic path to true");
> >>             dynamicPath = true;
> >>         }
> >> -        log.debug("path ending value = " + pathP.getStringValue());
> >>     }
> >>
> >>     /**
> >>
> >> Modified: jmeter/trunk/xdocs/changes.xml
> >> URL:
> >>
> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1330236&r1=1330235&r2=1330236&view=diff
> >>
> >>
> ==============================================================================
> >> --- jmeter/trunk/xdocs/changes.xml (original)
> >> +++ jmeter/trunk/xdocs/changes.xml Wed Apr 25 12:23:01 2012
> >> @@ -94,6 +94,7 @@ Graph Full Results Listener has been rem
> >>  <li>Bug 52885 - Proxy : Recording issues with HTTPS, cookies starting
> >> with secure are partly truncated</li>
> >>  <li>Bug 52886 - Proxy : Recording issues with HTTPS when spoofing is
> on,
> >> secure cookies are not always changed</li>
> >>  <li>Bug 52897 - HTTPSampler : Using PUT method with HTTPClient4 and
> empty
> >> Content Encoding and sending files leads to NullPointerException</li>
> >> +<li>Bug 53145 - HTTP Sampler - function in path evaluated too
> early</li>
> >>  </ul>
> >>
> >>  <h3>Other Samplers</h3>
> >>
> >>
> >>
> >
> >
> > --
> > Cordialement.
> > Philippe Mouawad.
>



-- 
Cordialement.
Philippe Mouawad.

Re: svn commit: r1330236 - in /jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java xdocs/changes.xml

Posted by sebb <se...@gmail.com>.
On 25 April 2012 21:48, Philippe Mouawad <ph...@gmail.com> wrote:
> Hello sebb,
> I have a question below.
>
> Regards
> Philippe
>
> On Wed, Apr 25, 2012 at 2:23 PM, <se...@apache.org> wrote:
>
>> Author: sebb
>> Date: Wed Apr 25 12:23:01 2012
>> New Revision: 1330236
>>
>> URL: http://svn.apache.org/viewvc?rev=1330236&view=rev
>> Log:
>> Bug 53145 - HTTP Sampler - function in path evaluated too early
>>
>> Modified:
>>
>>  jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
>>    jmeter/trunk/xdocs/changes.xml
>>
>> Modified:
>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
>> URL:
>> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1330236&r1=1330235&r2=1330236&view=diff
>>
>> ==============================================================================
>> ---
>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
>> (original)
>> +++
>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
>> Wed Apr 25 12:23:01 2012
>> @@ -1333,17 +1333,26 @@ public abstract class HTTPSamplerBase ex
>>      */
>>     public void testStarted() {
>>         JMeterProperty pathP = getProperty(PATH);
>> -        log.debug("path property is a " + pathP.getClass().getName());
>> -        log.debug("path beginning value = " + pathP.getStringValue());
>> -        if (pathP instanceof StringProperty &&
>> pathP.getStringValue().length() > 0) {
>> -            log.debug("Encoding spaces in path");
>> -            pathP.setObjectValue(encodeSpaces(pathP.getStringValue()));
>> -            dynamicPath = false;
>> +        boolean debugEnabled = log.isDebugEnabled();
>> +        if (debugEnabled) {
>> +            log.debug("path property is of type " +
>> pathP.getClass().getName());
>> +        }
>> +        if (pathP instanceof StringProperty) {
>> +            String value = pathP.getStringValue();
>> +            if (value.length() > 0) {
>> +                if (debugEnabled) {
>> +                    log.debug("Encoding spaces in path: "+value);
>> +                }
>> +                pathP.setObjectValue(encodeSpaces(value));
>> +                dynamicPath = false;
>> +                if (debugEnabled) {
>> +                    log.debug("path ending value = " +
>> pathP.getStringValue());
>> +                }
>> +            }
>>
> => Shouldn't there be an else case here setting   dynamicPath = true; ?
>

Looks OK to me.
I only moved the debugs and split the if statement.

>        } else {
>>             log.debug("setting dynamic path to true");
>>             dynamicPath = true;
>>         }
>> -        log.debug("path ending value = " + pathP.getStringValue());
>>     }
>>
>>     /**
>>
>> Modified: jmeter/trunk/xdocs/changes.xml
>> URL:
>> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1330236&r1=1330235&r2=1330236&view=diff
>>
>> ==============================================================================
>> --- jmeter/trunk/xdocs/changes.xml (original)
>> +++ jmeter/trunk/xdocs/changes.xml Wed Apr 25 12:23:01 2012
>> @@ -94,6 +94,7 @@ Graph Full Results Listener has been rem
>>  <li>Bug 52885 - Proxy : Recording issues with HTTPS, cookies starting
>> with secure are partly truncated</li>
>>  <li>Bug 52886 - Proxy : Recording issues with HTTPS when spoofing is on,
>> secure cookies are not always changed</li>
>>  <li>Bug 52897 - HTTPSampler : Using PUT method with HTTPClient4 and empty
>> Content Encoding and sending files leads to NullPointerException</li>
>> +<li>Bug 53145 - HTTP Sampler - function in path evaluated too early</li>
>>  </ul>
>>
>>  <h3>Other Samplers</h3>
>>
>>
>>
>
>
> --
> Cordialement.
> Philippe Mouawad.

Re: svn commit: r1330236 - in /jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java xdocs/changes.xml

Posted by Philippe Mouawad <ph...@gmail.com>.
Hello sebb,
I have a question below.

Regards
Philippe

On Wed, Apr 25, 2012 at 2:23 PM, <se...@apache.org> wrote:

> Author: sebb
> Date: Wed Apr 25 12:23:01 2012
> New Revision: 1330236
>
> URL: http://svn.apache.org/viewvc?rev=1330236&view=rev
> Log:
> Bug 53145 - HTTP Sampler - function in path evaluated too early
>
> Modified:
>
>  jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
>    jmeter/trunk/xdocs/changes.xml
>
> Modified:
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
> URL:
> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1330236&r1=1330235&r2=1330236&view=diff
>
> ==============================================================================
> ---
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
> (original)
> +++
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
> Wed Apr 25 12:23:01 2012
> @@ -1333,17 +1333,26 @@ public abstract class HTTPSamplerBase ex
>      */
>     public void testStarted() {
>         JMeterProperty pathP = getProperty(PATH);
> -        log.debug("path property is a " + pathP.getClass().getName());
> -        log.debug("path beginning value = " + pathP.getStringValue());
> -        if (pathP instanceof StringProperty &&
> pathP.getStringValue().length() > 0) {
> -            log.debug("Encoding spaces in path");
> -            pathP.setObjectValue(encodeSpaces(pathP.getStringValue()));
> -            dynamicPath = false;
> +        boolean debugEnabled = log.isDebugEnabled();
> +        if (debugEnabled) {
> +            log.debug("path property is of type " +
> pathP.getClass().getName());
> +        }
> +        if (pathP instanceof StringProperty) {
> +            String value = pathP.getStringValue();
> +            if (value.length() > 0) {
> +                if (debugEnabled) {
> +                    log.debug("Encoding spaces in path: "+value);
> +                }
> +                pathP.setObjectValue(encodeSpaces(value));
> +                dynamicPath = false;
> +                if (debugEnabled) {
> +                    log.debug("path ending value = " +
> pathP.getStringValue());
> +                }
> +            }
>
=> Shouldn't there be an else case here setting   dynamicPath = true; ?

        } else {
>             log.debug("setting dynamic path to true");
>             dynamicPath = true;
>         }
> -        log.debug("path ending value = " + pathP.getStringValue());
>     }
>
>     /**
>
> Modified: jmeter/trunk/xdocs/changes.xml
> URL:
> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1330236&r1=1330235&r2=1330236&view=diff
>
> ==============================================================================
> --- jmeter/trunk/xdocs/changes.xml (original)
> +++ jmeter/trunk/xdocs/changes.xml Wed Apr 25 12:23:01 2012
> @@ -94,6 +94,7 @@ Graph Full Results Listener has been rem
>  <li>Bug 52885 - Proxy : Recording issues with HTTPS, cookies starting
> with secure are partly truncated</li>
>  <li>Bug 52886 - Proxy : Recording issues with HTTPS when spoofing is on,
> secure cookies are not always changed</li>
>  <li>Bug 52897 - HTTPSampler : Using PUT method with HTTPClient4 and empty
> Content Encoding and sending files leads to NullPointerException</li>
> +<li>Bug 53145 - HTTP Sampler - function in path evaluated too early</li>
>  </ul>
>
>  <h3>Other Samplers</h3>
>
>
>


-- 
Cordialement.
Philippe Mouawad.