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/23 21:02:21 UTC

svn commit: r1775899 - /jmeter/trunk/src/core/org/apache/jmeter/engine/DistributedRunner.java

Author: pmouawad
Date: Fri Dec 23 21:02:21 2016
New Revision: 1775899

URL: http://svn.apache.org/viewvc?rev=1775899&view=rev
Log:
Sonar : Fix errors, code smells and false-positive

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/engine/DistributedRunner.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/DistributedRunner.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/engine/DistributedRunner.java?rev=1775899&r1=1775898&r2=1775899&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/engine/DistributedRunner.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/engine/DistributedRunner.java Fri Dec 23 21:02:21 2016
@@ -82,7 +82,7 @@ public class DistributedRunner {
                 try {
                     Thread.sleep(retriesDelay);
                 } catch (InterruptedException e) {
-                    throw new RuntimeException("Interrupted while initializing remote", e);
+                    throw new RuntimeException("Interrupted while initializing remote", e); // NOSONAR
                 }
             }
 
@@ -100,16 +100,16 @@ public class DistributedRunner {
                 }
             }
 
-            if (addrs.size() == 0) {
+            if (addrs.isEmpty()) {
                 break;
             }
         }
 
-        if (addrs.size() > 0) {
+        if (!addrs.isEmpty()) {
             String msg = "Following remote engines could not be configured:" + addrs;
             if (!continueOnFail || engines.size() == 0) {
                 stop();
-                throw new RuntimeException(msg);
+                throw new RuntimeException(msg); // NOSONAR
             } else {
                 println(msg);
                 println("Continuing without failed engines...");
@@ -134,7 +134,7 @@ public class DistributedRunner {
                     log.warn("Host not found in list of active engines: " + address);
                 }
             } catch (IllegalStateException | JMeterEngineException e) {
-                JMeterUtils.reportErrorToUser(e.getMessage(), JMeterUtils.getResString("remote_error_starting")); // $NON-NLS-1$
+                JMeterUtils.reportErrorToUser(e.getMessage(), JMeterUtils.getResString("remote_error_starting")); // $NON-NLS-1$ NOSONAR already reported to user 
             }
         }
         println("Remote engines have been started");
@@ -245,7 +245,7 @@ public class DistributedRunner {
     private void errln(String s, Exception e) {
         log.error(s, e);
         stderr.println(s + ": ");
-        e.printStackTrace(stderr);
+        e.printStackTrace(stderr); // NOSONAR
     }
 
     public void setStdout(PrintStream stdout) {