You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2019/01/30 17:34:24 UTC

svn commit: r1852537 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java

Author: pmouawad
Date: Wed Jan 30 17:34:24 2019
New Revision: 1852537

URL: http://svn.apache.org/viewvc?rev=1852537&view=rev
Log:
Fix SONAR warnings:

- Variable naming
- return instead of if

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java?rev=1852537&r1=1852536&r2=1852537&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java Wed Jan 30 17:34:24 2019
@@ -114,11 +114,11 @@ public class HTTPSampleResult extends Sa
          * 305 = Use Proxy
          * 306 = (Unused)
          */
-        final String[] REDIRECT_CODES = { HTTPConstants.SC_MOVED_PERMANENTLY,
+        final String[] redirectCodes = { HTTPConstants.SC_MOVED_PERMANENTLY,
                 HTTPConstants.SC_MOVED_TEMPORARILY,
                 HTTPConstants.SC_SEE_OTHER };
         String code = getResponseCode();
-        for (String redirectCode : REDIRECT_CODES) {
+        for (String redirectCode : redirectCodes) {
             if (redirectCode.equals(code)) {
                 return true;
             }
@@ -128,11 +128,8 @@ public class HTTPSampleResult extends Sa
         // the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user,
         // since this might change the conditions under which the request was issued.
         // See Bug 54119
-        if (HTTPConstants.SC_TEMPORARY_REDIRECT.equals(code) && 
-                (HTTPConstants.GET.equals(getHTTPMethod()) || HTTPConstants.HEAD.equals(getHTTPMethod()))) {
-            return true;
-        }
-        return false;
+        return HTTPConstants.SC_TEMPORARY_REDIRECT.equals(code) && 
+                (HTTPConstants.GET.equals(getHTTPMethod()) || HTTPConstants.HEAD.equals(getHTTPMethod()));
     }
 
     /**
@@ -246,10 +243,10 @@ public class HTTPSampleResult extends Sa
             // Preserve original case
             String matchAgainst = prefix.toLowerCase(java.util.Locale.ENGLISH);
             // Extract the content-type if present
-            final String METATAG = "<meta http-equiv=\"content-type\" content=\""; // $NON-NLS-1$
-            int tagstart=matchAgainst.indexOf(METATAG);
+            final String metaTag = "<meta http-equiv=\"content-type\" content=\""; // $NON-NLS-1$
+            int tagstart=matchAgainst.indexOf(metaTag);
             if (tagstart!=-1){
-                tagstart += METATAG.length();
+                tagstart += metaTag.length();
                 int tagend = prefix.indexOf('\"', tagstart); // $NON-NLS-1$
                 if (tagend!=-1){
                     final String ct = prefix.substring(tagstart,tagend);