You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by sebb <se...@gmail.com> on 2017/02/28 17:11:53 UTC

Re: svn commit: r1784727 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java

On 28 February 2017 at 11:34,  <pm...@apache.org> wrote:
> Author: pmouawad
> Date: Tue Feb 28 11:34:16 2017
> New Revision: 1784727
>
> URL: http://svn.apache.org/viewvc?rev=1784727&view=rev
> Log:
> Avoid repetitive calls to getMethod

OK

> Decrease log level from WARN to DEBUG for some components supersed

Why?

The idea of the log message is to warn users that the Auth Manager may
have been inadvertently overridden.

-1 without a good reason why this warning is not needed.

> Modified:
>     jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
>
> 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=1784727&r1=1784726&r2=1784727&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 Tue Feb 28 11:34:16 2017
> @@ -452,7 +452,8 @@ public abstract class HTTPSamplerBase ex
>       */
>      public void setPath(String path, String contentEncoding) {
>          boolean fullUrl = path.startsWith(HTTP_PREFIX) || path.startsWith(HTTPS_PREFIX);
> -        boolean getOrDelete = HTTPConstants.GET.equals(getMethod()) || HTTPConstants.DELETE.equals(getMethod());
> +        String method = getMethod();
> +        boolean getOrDelete = HTTPConstants.GET.equals(method) || HTTPConstants.DELETE.equals(method);
>          if (!fullUrl && getOrDelete) {
>              int index = path.indexOf(QRY_PFX);
>              if (index > -1) {
> @@ -825,7 +826,9 @@ public abstract class HTTPSamplerBase ex
>      public void setAuthManager(AuthManager value) {
>          AuthManager mgr = getAuthManager();
>          if (mgr != null) {
> -            log.warn("Existing AuthManager " + mgr.getName() + " superseded by " + value.getName());
> +            if(log.isDebugEnabled()) {
> +                log.debug("Existing AuthManager {} superseded by {}", mgr.getName(), value.getName());
> +            }
>          }
>          setProperty(new TestElementProperty(AUTH_MANAGER, value));
>      }
> @@ -861,7 +864,9 @@ public abstract class HTTPSamplerBase ex
>      public void setCookieManager(CookieManager value) {
>          CookieManager mgr = getCookieManager();
>          if (mgr != null) {
> -            log.warn("Existing CookieManager " + mgr.getName() + " superseded by " + value.getName());
> +            if(log.isDebugEnabled()) {
> +                log.debug("Existing CookieManager {} superseded by {}", mgr.getName(), value.getName());
> +            }
>          }
>          setCookieManagerProperty(value);
>      }
> @@ -878,7 +883,9 @@ public abstract class HTTPSamplerBase ex
>      public void setCacheManager(CacheManager value) {
>          CacheManager mgr = getCacheManager();
>          if (mgr != null) {
> -            log.warn("Existing CacheManager " + mgr.getName() + " superseded by " + value.getName());
> +            if(log.isDebugEnabled()) {
> +                log.debug("Existing CacheManager {} superseded by {}", mgr.getName(), value.getName());
> +            }
>          }
>          setCacheManagerProperty(value);
>      }
> @@ -894,7 +901,9 @@ public abstract class HTTPSamplerBase ex
>      public void setDNSResolver(DNSCacheManager cacheManager) {
>          DNSCacheManager mgr = getDNSResolver();
>          if (mgr != null) {
> -            log.warn("Existing DNSCacheManager " + mgr.getName() + " superseded by " + cacheManager.getName());
> +            if(log.isDebugEnabled()) {
> +                log.debug("Existing DNSCacheManager {} superseded by {}", mgr.getName(), cacheManager.getName());
> +            }
>          }
>          setProperty(new TestElementProperty(DNS_CACHE_MANAGER, cacheManager));
>      }
> @@ -964,6 +973,7 @@ public abstract class HTTPSamplerBase ex
>          }
>          String domain = getDomain();
>          String protocol = getProtocol();
> +        String method = getMethod();
>          if (PROTOCOL_FILE.equalsIgnoreCase(protocol)) {
>              domain = null; // allow use of relative file URLs
>          } else {
> @@ -975,9 +985,9 @@ public abstract class HTTPSamplerBase ex
>          pathAndQuery.append(path);
>
>          // Add the query string if it is a HTTP GET or DELETE request
> -        if (HTTPConstants.GET.equals(getMethod())
> -                || HTTPConstants.DELETE.equals(getMethod())
> -                || HTTPConstants.OPTIONS.equals(getMethod())) {
> +        if (HTTPConstants.GET.equals(method)
> +                || HTTPConstants.DELETE.equals(method)
> +                || HTTPConstants.OPTIONS.equals(method)) {
>              // Get the query string encoded in specified encoding
>              // If no encoding is specified by user, we will get it
>              // encoded in UTF-8, which is what the HTTP spec says
> @@ -1145,7 +1155,8 @@ public abstract class HTTPSamplerBase ex
>              StringBuilder stringBuffer = new StringBuilder();
>              stringBuffer.append(this.getUrl().toString());
>              // Append body if it is a post or put
> -            if (HTTPConstants.POST.equals(getMethod()) || HTTPConstants.PUT.equals(getMethod())) {
> +            String method = getMethod();
> +            if (HTTPConstants.POST.equals(method) || HTTPConstants.PUT.equals(method)) {
>                  stringBuffer.append("\nQuery Data: ");
>                  stringBuffer.append(getQueryString());
>              }
>
>