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 2025/07/16 17:42:18 UTC

(commons-net) 02/02: Javadoc

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 a5acdd0149e83d5f50e64f07482c1857460665c0
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Wed Jul 16 13:42:10 2025 -0400

    Javadoc
---
 .../org/apache/commons/net/ProtocolCommandSupport.java   | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/ProtocolCommandSupport.java b/src/main/java/org/apache/commons/net/ProtocolCommandSupport.java
index 2ef8bab7..0f919902 100644
--- a/src/main/java/org/apache/commons/net/ProtocolCommandSupport.java
+++ b/src/main/java/org/apache/commons/net/ProtocolCommandSupport.java
@@ -31,6 +31,9 @@ import org.apache.commons.net.util.ListenerList;
  */
 public class ProtocolCommandSupport implements Serializable {
 
+    /**
+     * Serialization is unnecessary for this class. Reject attempts to do so until such time as the Serializable attribute can be dropped.
+     */
     private static final long serialVersionUID = -8017692739988399978L;
 
     /**
@@ -63,7 +66,7 @@ public class ProtocolCommandSupport implements Serializable {
     }
 
     /**
-     * Fires a ProtocolCommandEvent signalling the sending of a command to all registered listeners, invoking their
+     * Fires a ProtocolCommandEvent signaling the sending of a command to all registered listeners, invoking their
      * {@link org.apache.commons.net.ProtocolCommandListener#protocolCommandSent protocolCommandSent()} methods.
      *
      * @param command The string representation of the command type sent, not including the arguments (e.g., "STAT" or "GET").
@@ -72,9 +75,7 @@ public class ProtocolCommandSupport implements Serializable {
     public void fireCommandSent(final String command, final String message) {
         if (!listeners.isEmpty()) {
             final ProtocolCommandEvent event = new ProtocolCommandEvent(source, command, message);
-            for (final ProtocolCommandListener listener : listeners) {
-                listener.protocolCommandSent(event);
-            }
+            listeners.forEach(listener -> listener.protocolCommandSent(event));
         }
     }
 
@@ -90,9 +91,7 @@ public class ProtocolCommandSupport implements Serializable {
     public void fireReplyReceived(final int replyCode, final String message) {
         if (!listeners.isEmpty()) {
             final ProtocolCommandEvent event = new ProtocolCommandEvent(source, replyCode, message);
-            for (final ProtocolCommandListener listener : listeners) {
-                listener.protocolReplyReceived(event);
-            }
+            listeners.forEach(listener -> listener.protocolReplyReceived(event));
         }
     }
 
@@ -113,9 +112,6 @@ public class ProtocolCommandSupport implements Serializable {
     private void readObject(final ObjectInputStream ignored) {
         throw new UnsupportedOperationException("Serialization is not supported");
     }
-    /*
-     * Serialization is unnecessary for this class. Reject attempts to do so until such time as the Serializable attribute can be dropped.
-     */
 
     /**
      * Removes a ProtocolCommandListener.