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 2018/04/05 22:23:25 UTC

svn commit: r1828483 - in /jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/sampler/ test/src/org/apache/jmeter/protocol/http/sampler/

Author: pmouawad
Date: Thu Apr  5 22:23:24 2018
New Revision: 1828483

URL: http://svn.apache.org/viewvc?rev=1828483&view=rev
Log:
Fix checkstyle issues

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1828483&r1=1828482&r2=1828483&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java Thu Apr  5 22:23:24 2018
@@ -691,8 +691,9 @@ public class HTTPHC4Impl extends HTTPHCA
      * @return {@link HttpRequestBase}
      */
     private HttpRequestBase createHttpRequest(URI uri, String method, boolean areFollowingRedirect) {
+        HttpRequestBase result = null;
         if (method.equals(HTTPConstants.POST)) {
-            return new HttpPost(uri);
+            result = new HttpPost(uri);
         } else if (method.equals(HTTPConstants.GET)) {
             // Some servers fail if Content-Length is equal to 0
             // so to avoid this we use HttpGet when there is no body (Content-Length will not be set)
@@ -700,27 +701,28 @@ public class HTTPHC4Impl extends HTTPHCA
             if ( !areFollowingRedirect 
                     && ((!hasArguments() && getSendFileAsPostBody()) 
                     || getSendParameterValuesAsPostBody()) ) {
-                return new HttpGetWithEntity(uri);
+                result = new HttpGetWithEntity(uri);
             } else {
-                return new HttpGet(uri);
+                result = new HttpGet(uri);
             }
         } else if (method.equals(HTTPConstants.PUT)) {
-            return new HttpPut(uri);
+            result =  new HttpPut(uri);
         } else if (method.equals(HTTPConstants.HEAD)) {
-            return new HttpHead(uri);
+            result = new HttpHead(uri);
         } else if (method.equals(HTTPConstants.TRACE)) {
-            return new HttpTrace(uri);
+            result = new HttpTrace(uri);
         } else if (method.equals(HTTPConstants.OPTIONS)) {
-            return new HttpOptions(uri);
+            result = new HttpOptions(uri);
         } else if (method.equals(HTTPConstants.DELETE)) {
-            return new HttpDelete(uri);
+            result = new HttpDelete(uri);
         } else if (method.equals(HTTPConstants.PATCH)) {
-            return new HttpPatch(uri);
+            result = new HttpPatch(uri);
         } else if (HttpWebdav.isWebdavMethod(method)) {
-            return new HttpWebdav(method, uri);
+            result = new HttpWebdav(method, uri);
         } else {
             throw new IllegalArgumentException("Unexpected method: '"+method+"'");
         }
+        return result;
     }
 
     /**
@@ -1584,7 +1586,7 @@ public class HTTPHC4Impl extends HTTPHCA
         // This is not obvious in GUI if you are not uploading any files,
         // but just sending the content of nameless parameters
         final HTTPFileArg file = files.length > 0? files[0] : null;
-        String contentTypeValue = null;
+        String contentTypeValue;
         if(file != null && file.getMimeType() != null && file.getMimeType().length() > 0) {
             contentTypeValue = file.getMimeType();
             entity.setHeader(HEADER_CONTENT_TYPE, contentTypeValue); // we provide the MIME type here

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=1828483&r1=1828482&r2=1828483&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 Thu Apr  5 22:23:24 2018
@@ -422,7 +422,7 @@ public abstract class HTTPSamplerBase ex
         // We use multipart if we have been told so, or files are present
         // and the files should not be send as the post body
         HTTPFileArg[] files = getHTTPFiles();
-        return (getDoMultipart() || (files.length>0 && hasNoMissingFile(files) && !getSendFileAsPostBody()));
+        return getDoMultipart() || (files.length>0 && hasNoMissingFile(files) && !getSendFileAsPostBody());
     }
 
     private boolean hasNoMissingFile(HTTPFileArg[] files) {

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java?rev=1828483&r1=1828482&r2=1828483&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java Thu Apr  5 22:23:24 2018
@@ -18,8 +18,8 @@
 
 package org.apache.jmeter.protocol.http.sampler;
 
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
 import java.io.ByteArrayOutputStream;