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 2016/12/31 15:56:54 UTC

svn commit: r1776791 - /jmeter/trunk/src/core/org/apache/jmeter/util/HttpSSLProtocolSocketFactory.java

Author: pmouawad
Date: Sat Dec 31 15:56:54 2016
New Revision: 1776791

URL: http://svn.apache.org/viewvc?rev=1776791&view=rev
Log:
Sonar : fix squid:S00115 "Rename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'"
Fix also properties declaration order 

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/util/HttpSSLProtocolSocketFactory.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/HttpSSLProtocolSocketFactory.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/HttpSSLProtocolSocketFactory.java?rev=1776791&r1=1776790&r2=1776791&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/util/HttpSSLProtocolSocketFactory.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/HttpSSLProtocolSocketFactory.java Sat Dec 31 15:56:54 2016
@@ -47,6 +47,17 @@ public class HttpSSLProtocolSocketFactor
 
     private static final Logger log = LoggingManager.getLoggerForClass();
 
+    private static final String PROTOCOL_LIST =
+            JMeterUtils.getPropDefault("https.socket.protocols", ""); // $NON-NLS-1$ $NON-NLS-2$
+
+    private static final String[] protocols = PROTOCOL_LIST.split(" "); // $NON-NLS-1$
+
+    static {
+        if (!PROTOCOL_LIST.isEmpty()){
+            log.info("Using protocol list: "+PROTOCOL_LIST);
+        }
+    }
+
     private final JsseSSLManager sslManager;
 
     private final int CPS; // Characters per second to emulate
@@ -61,27 +72,17 @@ public class HttpSSLProtocolSocketFactor
         CPS=cps;
     }
 
-    private static final String protocolList =
-        JMeterUtils.getPropDefault("https.socket.protocols", ""); // $NON-NLS-1$ $NON-NLS-2$
-
-    static {
-        if (protocolList.length()>0){
-            log.info("Using protocol list: "+protocolList);
-        }
-    }
-
-    private static final String[] protocols = protocolList.split(" "); // $NON-NLS-1$
 
     private void setSocket(Socket socket){
         if (!(socket instanceof SSLSocket)) {
             throw new IllegalArgumentException("Expected SSLSocket");
         }
         SSLSocket sock = (SSLSocket) socket;
-        if (protocolList.length() > 0) {
+        if (!PROTOCOL_LIST.isEmpty()) {
             try {
                 sock.setEnabledProtocols(protocols);
             } catch (IllegalArgumentException e) {
-                log.warn("Could not set protocol list: " + protocolList + ".");
+                log.warn("Could not set protocol list: " + PROTOCOL_LIST + ".");
                 log.warn("Valid protocols are: " + join(sock.getSupportedProtocols()));
             }
         }