You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/06/16 17:10:44 UTC

(commons-net) 01/05: Fix PMD AvoidBranchingStatementAsLastInLoop in org.apache.commons.net.bsd.RCommandClient

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git

commit 88545c0b59395a1381d6d2bb54cdb01c9dc7943c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 16 13:00:56 2024 -0400

    Fix PMD AvoidBranchingStatementAsLastInLoop in
    org.apache.commons.net.bsd.RCommandClient
---
 src/changes/changes.xml                                      | 3 ++-
 src/main/java/org/apache/commons/net/bsd/RCommandClient.java | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d73a0b46..c81cb9e4 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -71,7 +71,8 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Remove InvalidKeySpecException from ExtendedPOP3Client.auth(AUTH_METHOD, String, String) never throws, it's not thrown.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Remove InvalidKeySpecException from org.apache.commons.net.smtp.AuthenticatingSMTPClient.auth(AUTH_METHOD, String, String) never throws, it's not thrown.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE in SSLSocketUtils.</action>
-      <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD UnnecessaryFullyQualifiedName.</action>      
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD UnnecessaryFullyQualifiedName.</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD AvoidBranchingStatementAsLastInLoop in org.apache.commons.net.bsd.RCommandClient.</action>
       <!-- ADD -->
       <!-- UPDATE -->
       <action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">Bump org.apache.commons:commons-parent from 70 to 71 #261.</action> 
diff --git a/src/main/java/org/apache/commons/net/bsd/RCommandClient.java b/src/main/java/org/apache/commons/net/bsd/RCommandClient.java
index d2736d89..0f664b93 100644
--- a/src/main/java/org/apache/commons/net/bsd/RCommandClient.java
+++ b/src/main/java/org/apache/commons/net/bsd/RCommandClient.java
@@ -119,10 +119,10 @@ public class RCommandClient extends RExecClient {
         for (localPort = MAX_CLIENT_PORT; localPort >= MIN_CLIENT_PORT; --localPort) {
             try {
                 _socket_ = _socketFactory_.createSocket(host, port, localAddr, localPort);
+                break;
             } catch (final SocketException e) {
                 continue;
             }
-            break;
         }
 
         if (localPort < MIN_CLIENT_PORT) {