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 3ad42e5b30eaceefac1bacd9a1e87cbd6f3d4a56
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Feb 28 19:00:31 2025 -0500

    Add Checkstyle SuperFinalize
    
    - TFTPServer does not call super.finalize()
    - Base64 does not call super.finalize()
---
 src/changes/changes.xml                                   | 2 ++
 src/conf/checkstyle.xml                                   | 1 +
 src/main/java/org/apache/commons/net/util/Base64.java     | 3 ++-
 src/test/java/org/apache/commons/net/tftp/TFTPServer.java | 1 +
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 42777ddc..5f38b25a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -86,6 +86,8 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Avoid multiple 
possible NullPointerException in SocketClient.verifyRemote(Socket).</action>
       <action type="fix" dev="ggregory" due-to="Gary 
Gregory">PrintCommandListener.protocolReplyReceived(ProtocolCommandEvent) 
doesn't always use an end-of-line.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">FTPClientExample 
uses the wrong FTP system type to parse file lines.</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Base64 does not 
call super.finalize().</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">TFTPServer does 
not call super.finalize().</action>
       <!-- ADD -->
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add 
org.apache.commons.net.nntp.Article#getChild().</action>
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add 
org.apache.commons.net.nntp.Article#getNext().</action>
diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index bfed860e..23ac0af0 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -94,6 +94,7 @@ limitations under the License.
     <module name="SuppressionCommentFilter"/>
     <module name="StringLiteralEquality" />
     <module name="SuperClone" />
+    <module name="SuperFinalize" />
     <!--
         Allow comment to suppress checkstyle for a single line
         e.g. // CHECKSTYLE IGNORE MagicNumber
diff --git a/src/main/java/org/apache/commons/net/util/Base64.java 
b/src/main/java/org/apache/commons/net/util/Base64.java
index e2dc54ab..fbf02250 100644
--- a/src/main/java/org/apache/commons/net/util/Base64.java
+++ b/src/main/java/org/apache/commons/net/util/Base64.java
@@ -600,8 +600,9 @@ public class Base64 {
     }
 
     @Override
-    public final void finalize() {
+    public final void finalize() throws Throwable {
         // CT: Be wary of letting constructors throw exceptions. 
(CT_CONSTRUCTOR_THROW)
+        super.finalize();
     }
 
     int getLineLength() {
diff --git a/src/test/java/org/apache/commons/net/tftp/TFTPServer.java 
b/src/test/java/org/apache/commons/net/tftp/TFTPServer.java
index 1af9de75..b59b8e7b 100644
--- a/src/test/java/org/apache/commons/net/tftp/TFTPServer.java
+++ b/src/test/java/org/apache/commons/net/tftp/TFTPServer.java
@@ -600,6 +600,7 @@ public class TFTPServer implements Runnable, AutoCloseable {
     @Override
     protected void finalize() throws Throwable {
         close();
+        super.finalize();
     }
 
     /**

Reply via email to