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 65872e80e6a5ae862b62e78efd80afde65d3cd3f
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Mar 13 07:25:53 2026 -0400

    ListenerList.removeListener(T) now ignores null input to avoid a
    NullPointerException.
---
 src/changes/changes.xml                                     | 1 +
 src/main/java/org/apache/commons/net/util/ListenerList.java | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1ae61405..eb492e33 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -72,6 +72,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Jianwei Guo, Gary Gregory" 
issue="NET-740">FTP fails to parse listings for Linux vsftpd in Chinese or 
Japanese #393.</action>
       <action type="fix" dev="ggregory" due-to="Gary 
Gregory">TelnetInputStream.read() doesn't preserve the original 
InterruptedException as the cause of its InterruptedIOException.</action>
       <action type="fix" dev="ggregory" due-to="Gary 
Gregory">FTPClient._storeFile(String, String, InputStream) doesn't always close 
it's internal socket when an exception is thrown early in processing.</action>
+      <action type="fix" dev="ggregory" due-to="Gary 
Gregory">ListenerList.removeListener(T) now ignores null input to avoid a 
NullPointerException.</action>
       <!-- ADD -->
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add 
DatagramSocketClient.getDefaultTimeoutDuration() and deprecate 
getDefaultTimeout().</action>
       <action type="add" dev="ggregory" due-to="Maros Orsak, Gary Gregory" 
issue="NET-741">Add subnet IPv6 handling with SubnetUtils6 #391.</action>
diff --git a/src/main/java/org/apache/commons/net/util/ListenerList.java 
b/src/main/java/org/apache/commons/net/util/ListenerList.java
index 636f5e08..a51c88af 100644
--- a/src/main/java/org/apache/commons/net/util/ListenerList.java
+++ b/src/main/java/org/apache/commons/net/util/ListenerList.java
@@ -99,7 +99,9 @@ public class ListenerList<T extends EventListener> implements 
Serializable, Iter
      * @param listener listener to be removed from this list, if present.
      */
     public void removeListener(final T listener) {
-        listeners.remove(listener);
+        if (listener != null) {
+            listeners.remove(listener);
+        }
     }
 
     /**

Reply via email to