jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1859648 - in /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy: DefaultSamplerCreator.java FormCharSetFinder.java
Date Tue, 21 May 2019 14:07:43 GMT
Author: pmouawad
Date: Tue May 21 14:07:43 2019
New Revision: 1859648

URL: http://svn.apache.org/viewvc?rev=1859648&view=rev
Log:
Fix broken and useless synchronization of formEncodings/pageEncodings
Fix Sonar warning on useless assignement

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java?rev=1859648&r1=1859647&r2=1859648&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java
Tue May 21 14:07:43 2019
@@ -65,6 +65,7 @@ public class DefaultSamplerCreator exten
      * 
      */
     public DefaultSamplerCreator() {
+        super();
     }
 
     /**
@@ -345,7 +346,7 @@ public class DefaultSamplerCreator exten
     protected void computeContentEncoding(HTTPSamplerBase sampler,
             HttpRequestHdr request, Map<String, String> pageEncodings,
             Map<String, String> formEncodings) throws MalformedURLException {
-        URL pageUrl = null;
+        URL pageUrl;
         if(sampler.isProtocolDefaultPort()) {
             pageUrl = new URL(sampler.getProtocol(), sampler.getDomain(), request.getPath());
         }
@@ -378,7 +379,7 @@ public class DefaultSamplerCreator exten
             Map<String, String> pageEncodings,
             Map<String, String> formEncodings, String urlWithoutQuery) {
         // Check if the request itself tells us what the encoding is
-        String contentEncoding = null;
+        String contentEncoding;
         String requestContentEncoding = ConversionUtils.getEncodingFromContentType(
                 request.getContentType());
         if(requestContentEncoding != null) {
@@ -386,18 +387,14 @@ public class DefaultSamplerCreator exten
         }
         else {
             // Check if we know the encoding of the page
-            synchronized (pageEncodings) {
-                contentEncoding = pageEncodings.get(urlWithoutQuery);
-                log.debug("Computed encoding:{} for url:{}", contentEncoding, urlWithoutQuery);
-            }
+            contentEncoding = pageEncodings.get(urlWithoutQuery);
+            log.debug("Computed encoding:{} for url:{}", contentEncoding, urlWithoutQuery);
             // Check if we know the encoding of the form
-            synchronized (formEncodings) {
-                String formEncoding = formEncodings.get(urlWithoutQuery);
-                // Form encoding has priority over page encoding
-                if (formEncoding != null) {
-                    contentEncoding = formEncoding;
-                    log.debug("Computed encoding:{} for url:{}", contentEncoding, urlWithoutQuery);
-                }
+            String formEncoding = formEncodings.get(urlWithoutQuery);
+            // Form encoding has priority over page encoding
+            if (formEncoding != null) {
+                contentEncoding = formEncoding;
+                log.debug("Computed encoding:{} for url:{}", contentEncoding, urlWithoutQuery);
             }
         }
         if (contentEncoding == null) {

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java?rev=1859648&r1=1859647&r2=1859648&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/FormCharSetFinder.java
Tue May 21 14:07:43 2019
@@ -74,9 +74,7 @@ public class FormCharSetFinder {
                     }
                 }
                 if(formCharSet != null) {
-                    synchronized (formEncodings) {
-                        formEncodings.put(action, formCharSet);
-                    }
+                    formEncodings.put(action, formCharSet);
                 }
             }      
         }



Mime
View raw message