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

(commons-net) branch master updated (7e12be77 -> 0baa3569)

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

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


    from 7e12be77 Javadoc
     new 99bb71a6 Javadoc
     new 833e6704 Fix PMD UselessOverridingMethod in org.apache.commons.net.telnet.TelnetClient
     new 77cb3c2d Add NOPMD comment for constant.
     new 93097d06 Javadoc
     new 6b3a6f5f Javadoc
     new 30527ab8 Fix PMD UnnecessaryFullyQualifiedName
     new c5eaef06 Fix PMD UnnecessaryModifier
     new 628a336a Fix PMD UnnecessaryFullyQualifiedName
     new 2e7764c5 Fix PMD UnnecessaryModifier
     new 59e1206d Add NOPMD as a TODO, not trivial
     new 0baa3569 Add PMD check to default build

The 11 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            | 20 +++++-
 src/changes/changes.xml                            |  2 +
 src/conf/pmd-ruleset.xml                           | 81 ++++++++++++++++++++++
 .../apache/commons/net/ProtocolCommandSupport.java |  6 ++
 .../org/apache/commons/net/bsd/RExecClient.java    |  2 +-
 .../net/examples/cidr/SubnetUtilsExample.java      |  2 +-
 .../commons/net/examples/ftp/FTPClientExample.java |  4 +-
 .../commons/net/examples/mail/POP3ExportMbox.java  |  8 +--
 .../apache/commons/net/examples/ntp/NTPClient.java |  4 +-
 .../net/examples/telnet/TelnetClientExample.java   |  4 +-
 .../commons/net/examples/telnet/WeatherTelnet.java |  4 +-
 .../apache/commons/net/examples/unix/chargen.java  |  2 +-
 .../apache/commons/net/finger/FingerClient.java    |  2 +-
 src/main/java/org/apache/commons/net/ftp/FTP.java  |  4 +-
 .../java/org/apache/commons/net/ftp/FTPClient.java |  6 +-
 .../java/org/apache/commons/net/ftp/FTPCmd.java    |  2 +-
 .../java/org/apache/commons/net/ftp/FTPFile.java   |  8 ++-
 .../apache/commons/net/ftp/FTPListParseEngine.java |  2 +-
 .../org/apache/commons/net/ftp/FTPSClient.java     |  2 +-
 .../commons/net/imap/AuthenticatingIMAPClient.java |  2 +-
 .../org/apache/commons/net/imap/IMAPClient.java    |  2 +-
 .../org/apache/commons/net/imap/IMAPCommand.java   |  2 +-
 .../org/apache/commons/net/nntp/NNTPClient.java    |  8 +--
 .../java/org/apache/commons/net/ntp/TimeStamp.java |  6 ++
 .../commons/net/pop3/ExtendedPOP3Client.java       |  2 +-
 .../commons/net/smtp/AuthenticatingSMTPClient.java |  2 +-
 .../org/apache/commons/net/smtp/SMTPClient.java    |  2 +-
 .../commons/net/telnet/EchoOptionHandler.java      |  2 +-
 .../net/telnet/SuppressGAOptionHandler.java        |  2 +-
 .../java/org/apache/commons/net/telnet/Telnet.java |  4 +-
 .../apache/commons/net/telnet/TelnetClient.java    | 33 +++------
 .../apache/commons/net/telnet/TelnetCommand.java   |  8 +--
 .../commons/net/telnet/TelnetInputStream.java      |  8 +--
 .../net/telnet/TelnetNotificationHandler.java      |  2 +-
 .../apache/commons/net/telnet/TelnetOption.java    |  8 +--
 .../commons/net/telnet/TelnetOptionHandler.java    |  2 +-
 .../net/telnet/TerminalTypeOptionHandler.java      |  2 +-
 .../net/telnet/WindowSizeOptionHandler.java        |  2 +-
 .../org/apache/commons/net/util/ListenerList.java  |  9 ++-
 .../java/org/apache/commons/net/MockTcpServer.java |  4 +-
 .../commons/net/daytime/MockDaytimeTCPServer.java  |  2 +-
 .../org/apache/commons/net/examples/MainTest.java  |  4 +-
 .../commons/net/ftp/parser/MLSDComparison.java     |  4 +-
 .../commons/net/io/ToNetASCIIInputStreamTest.java  |  2 +-
 .../net/telnet/TelnetClientFunctionalTest.java     |  2 +-
 .../commons/net/telnet/TelnetClientTest.java       |  2 +-
 .../commons/net/tftp/TFTPServerPathTest.java       | 14 ++--
 .../java/org/apache/commons/net/tftp/TFTPTest.java |  6 +-
 48 files changed, 210 insertions(+), 103 deletions(-)
 create mode 100644 src/conf/pmd-ruleset.xml


(commons-net) 02/11: Fix PMD UselessOverridingMethod in org.apache.commons.net.telnet.TelnetClient

Posted by gg...@apache.org.
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 833e6704fc6de9c76e6cba4bbdbf26d0da89615b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 16 18:18:01 2024 -0400

    Fix PMD UselessOverridingMethod in
    org.apache.commons.net.telnet.TelnetClient
---
 src/changes/changes.xml                                 |  1 +
 .../org/apache/commons/net/telnet/TelnetClient.java     | 17 -----------------
 2 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 5a1b5c78..7c02d4ee 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -74,6 +74,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD UnnecessaryFullyQualifiedName.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD UnusedFormalParameter.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD AvoidBranchingStatementAsLastInLoop in org.apache.commons.net.bsd.RCommandClient.</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD UselessOverridingMethod in org.apache.commons.net.telnet.TelnetClient.</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/telnet/TelnetClient.java b/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
index e432d48c..61b87476 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
@@ -261,16 +261,6 @@ public class TelnetClient extends Telnet {
         this.inputListener = listener;
     }
 
-    /**
-     * Registers a notification handler to which will be sent notifications of received telnet option negotiation commands.
-     *
-     * @param notifhand   TelnetNotificationHandler to be registered
-     */
-    @Override
-    public void registerNotifHandler(final TelnetNotificationHandler notifhand) {
-        super.registerNotifHandler(notifhand);
-    }
-
     /* Code Section added for supporting spystreams (start) */
     /**
      * Registers an OutputStream for spying what's going on in the TelnetClient session.
@@ -394,11 +384,4 @@ public class TelnetClient extends Telnet {
         this.inputListener = null;
     }
 
-    /**
-     * Unregisters the current notification handler.
-     */
-    @Override
-    public void unregisterNotifHandler() {
-        super.unregisterNotifHandler();
-    }
 }


(commons-net) 08/11: Fix PMD UnnecessaryFullyQualifiedName

Posted by gg...@apache.org.
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 628a336a4788b4c8e11f5bc3e37eb67772b1cb1b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 16 18:52:30 2024 -0400

    Fix PMD UnnecessaryFullyQualifiedName
---
 src/main/java/org/apache/commons/net/ftp/FTP.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/ftp/FTP.java b/src/main/java/org/apache/commons/net/ftp/FTP.java
index 227b10ab..90a0bc34 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTP.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTP.java
@@ -409,7 +409,7 @@ public class FTP extends SocketClient {
             __commandBuffer.append(' ');
             __commandBuffer.append(args);
         }
-        __commandBuffer.append(SocketClient.NETASCII_EOL);
+        __commandBuffer.append(NETASCII_EOL);
         return __commandBuffer.toString();
     }
 
@@ -673,7 +673,7 @@ public class FTP extends SocketClient {
         final StringBuilder buffer = new StringBuilder(256);
         for (final String line : _replyLines) {
             buffer.append(line);
-            buffer.append(SocketClient.NETASCII_EOL);
+            buffer.append(NETASCII_EOL);
         }
         _newReplyString = false;
         return _replyString = buffer.toString();


(commons-net) 11/11: Add PMD check to default build

Posted by gg...@apache.org.
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 0baa35693c4fcc5a34f386313df0f97c32d99e97
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 16 19:02:19 2024 -0400

    Add PMD check to default build
    
    Add PMD report
---
 pom.xml                  | 20 +++++++++++-
 src/conf/pmd-ruleset.xml | 81 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 100 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 6c2369b4..6d24636c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -139,7 +139,7 @@ Supported protocols include Echo, Finger, FTP, NNTP, NTP, POP3(S), SMTP(S), Teln
         </dependency>
     </dependencies>
     <build>
-        <defaultGoal>clean apache-rat:check javadoc:javadoc checkstyle:check verify japicmp:cmp</defaultGoal>
+        <defaultGoal>clean apache-rat:check javadoc:javadoc checkstyle:check verify japicmp:cmp pmd:check</defaultGoal>
         <pluginManagement>
             <plugins>
                 <!-- Allow CLI usage -->
@@ -154,6 +154,15 @@ Supported protocols include Echo, Finger, FTP, NNTP, NTP, POP3(S), SMTP(S), Teln
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-checkstyle-plugin</artifactId>
                 </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-pmd-plugin</artifactId>
+                    <configuration>
+                        <rulesets>
+                            <ruleset>${basedir}/src/conf/pmd-ruleset.xml</ruleset>
+                        </rulesets>
+                    </configuration>
+                </plugin>
             </plugins>
         </pluginManagement>
         <plugins>
@@ -400,6 +409,15 @@ Supported protocols include Echo, Finger, FTP, NNTP, NTP, POP3(S), SMTP(S), Teln
                     <enableRulesSummary>false</enableRulesSummary>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-pmd-plugin</artifactId>
+                <configuration>
+                    <rulesets>
+                        <ruleset>${basedir}/src/conf/pmd-ruleset.xml</ruleset>
+                    </rulesets>
+                </configuration>
+             </plugin>
         </plugins>
     </reporting>
     <profiles>
diff --git a/src/conf/pmd-ruleset.xml b/src/conf/pmd-ruleset.xml
new file mode 100644
index 00000000..51c022c7
--- /dev/null
+++ b/src/conf/pmd-ruleset.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<ruleset name="mybraces" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+  <description>Excludes from default PMD rules.</description>  
+    <rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
+    <rule ref="category/java/bestpractices.xml/CheckResultSet" />
+    <rule ref="category/java/bestpractices.xml/PrimitiveWrapperInstantiation" />
+    <rule ref="category/java/bestpractices.xml/UnusedLocalVariable" />
+    <rule ref="category/java/bestpractices.xml/UnusedPrivateField" />
+    <rule ref="category/java/bestpractices.xml/UnusedPrivateMethod" />
+
+    <rule ref="category/java/codestyle.xml/ExtendsObject" />
+    <rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
+    <rule ref="category/java/codestyle.xml/TooManyStaticImports" />
+    <rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName" />
+    <rule ref="category/java/codestyle.xml/UnnecessaryImport" />
+    <rule ref="category/java/codestyle.xml/UnnecessaryModifier" />
+    <rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
+    <rule ref="category/java/codestyle.xml/UnnecessarySemicolon" />
+    <rule ref="category/java/codestyle.xml/UselessParentheses" />
+    <rule ref="category/java/codestyle.xml/UselessQualifiedThis" />
+
+    <rule ref="category/java/design.xml/CollapsibleIfStatements" />
+    <rule ref="category/java/design.xml/SimplifiedTernary" />
+    <rule ref="category/java/design.xml/UselessOverridingMethod" />
+
+    <rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" />
+    <rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" />
+    <rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators" />
+    <rule ref="category/java/errorprone.xml/AvoidUsingOctalValues" />
+    <rule ref="category/java/errorprone.xml/BrokenNullCheck" />
+    <rule ref="category/java/errorprone.xml/CheckSkipResult" />
+    <rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" />
+    <rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" />
+    <rule ref="category/java/errorprone.xml/JumbledIncrementer" />
+    <rule ref="category/java/errorprone.xml/MisplacedNullCheck" />
+    <rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
+    <rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock" />
+    <rule ref="category/java/errorprone.xml/UnconditionalIfStatement" />
+    <rule ref="category/java/errorprone.xml/UnnecessaryConversionTemporary" />
+    <rule ref="category/java/errorprone.xml/UnusedNullCheckInEquals" />
+    <rule ref="category/java/errorprone.xml/UselessOperationOnImmutable" />
+
+    <rule ref="category/java/multithreading.xml/AvoidThreadGroup" />
+    <rule ref="category/java/multithreading.xml/DontCallThreadRun" />
+    <rule ref="category/java/multithreading.xml/DoubleCheckedLocking" />
+
+    <rule ref="category/java/performance.xml/BigIntegerInstantiation" />
+    
+  <rule ref="category/java/errorprone.xml/EmptyCatchBlock">
+    <properties>
+      <property name="allowCommentedBlocks" value="true" />
+    </properties>
+  </rule>
+  <rule ref="category/java/bestpractices.xml/UnusedFormalParameter">
+    <properties>
+      <property name="violationSuppressRegex" value=".*'ignored'.*" />
+    </properties>
+  </rule>
+  <rule ref="category/java/codestyle.xml/EmptyControlStatement">
+    <properties>
+      <property name="allowCommentedBlocks" value="true" />
+    </properties>
+  </rule>
+</ruleset>


(commons-net) 03/11: Add NOPMD comment for constant.

Posted by gg...@apache.org.
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 77cb3c2d613c633dbfb13cdcc6bcd01995cd3153
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 16 18:18:23 2024 -0400

    Add NOPMD comment for constant.
---
 src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java b/src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java
index ec2aa421..3cd7dd8e 100644
--- a/src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java
+++ b/src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java
@@ -45,7 +45,7 @@ import org.apache.commons.net.ntp.TimeStamp;
  */
 public final class NTPClient {
 
-    private static final String OWN_CLOCK_IP_ADDRESS = "127.127.1.0";
+    private static final String OWN_CLOCK_IP_ADDRESS = "127.127.1.0"; // NOPMD
     private static final NumberFormat numberFormat = new DecimalFormat("0.00");
 
     public static void main(final String[] args) {


(commons-net) 05/11: Javadoc

Posted by gg...@apache.org.
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 6b3a6f5fdb47e343bb64ae2a11938be0ff7e7a77
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 16 18:27:59 2024 -0400

    Javadoc
---
 src/main/java/org/apache/commons/net/ProtocolCommandSupport.java | 6 ++++++
 src/main/java/org/apache/commons/net/ftp/FTPFile.java            | 6 ++++++
 src/main/java/org/apache/commons/net/ntp/TimeStamp.java          | 6 ++++++
 src/main/java/org/apache/commons/net/util/ListenerList.java      | 9 +++++++--
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/ProtocolCommandSupport.java b/src/main/java/org/apache/commons/net/ProtocolCommandSupport.java
index 6d1dd30e..7340befc 100644
--- a/src/main/java/org/apache/commons/net/ProtocolCommandSupport.java
+++ b/src/main/java/org/apache/commons/net/ProtocolCommandSupport.java
@@ -119,6 +119,12 @@ public class ProtocolCommandSupport implements Serializable {
         listeners.removeListener(listener);
     }
 
+    /**
+     * Always throws {@link UnsupportedOperationException}.
+     *
+     * @param ignored ignored.
+     * @throws UnsupportedOperationException Always thrown.
+     */
     private void writeObject(final ObjectOutputStream ignored) {
         throw new UnsupportedOperationException("Serialization is not supported");
     }
diff --git a/src/main/java/org/apache/commons/net/ftp/FTPFile.java b/src/main/java/org/apache/commons/net/ftp/FTPFile.java
index a143e787..25b45499 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPFile.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPFile.java
@@ -478,6 +478,12 @@ public class FTPFile implements Serializable {
         return getRawListing();
     }
 
+    /**
+     * Always throws {@link UnsupportedOperationException}.
+     *
+     * @param ignored ignored.
+     * @throws UnsupportedOperationException Always thrown.
+     */
     private void writeObject(final ObjectOutputStream ignored) {
         throw new UnsupportedOperationException("Serialization is not supported");
     }
diff --git a/src/main/java/org/apache/commons/net/ntp/TimeStamp.java b/src/main/java/org/apache/commons/net/ntp/TimeStamp.java
index 3ff31089..24286075 100644
--- a/src/main/java/org/apache/commons/net/ntp/TimeStamp.java
+++ b/src/main/java/org/apache/commons/net/ntp/TimeStamp.java
@@ -403,6 +403,12 @@ public class TimeStamp implements Serializable, Comparable<TimeStamp> {
         return utcFormatter.format(ntpDate);
     }
 
+    /**
+     * Always throws {@link UnsupportedOperationException}.
+     *
+     * @param ignored ignored.
+     * @throws UnsupportedOperationException Always thrown.
+     */
     private void writeObject(final ObjectOutputStream ignored) {
         throw new UnsupportedOperationException("Serialization is not supported");
     }
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 96cc3e4d..9ac933e2 100644
--- a/src/main/java/org/apache/commons/net/util/ListenerList.java
+++ b/src/main/java/org/apache/commons/net/util/ListenerList.java
@@ -59,14 +59,19 @@ public class ListenerList implements Serializable, Iterable<EventListener> {
         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.
      */
-
     public void removeListener(final EventListener listener) {
         listeners.remove(listener);
     }
 
+    /**
+     * Always throws {@link UnsupportedOperationException}.
+     *
+     * @param ignored ignored.
+     * @throws UnsupportedOperationException Always thrown.
+     */
     private void writeObject(final ObjectOutputStream ignored) {
         throw new UnsupportedOperationException("Serialization is not supported");
     }


(commons-net) 09/11: Fix PMD UnnecessaryModifier

Posted by gg...@apache.org.
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 2e7764c54e9c41da547f7e84272cfcfe3a4150d0
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 16 18:57:28 2024 -0400

    Fix PMD UnnecessaryModifier
---
 src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java | 2 +-
 src/main/java/org/apache/commons/net/imap/IMAPCommand.java              | 2 +-
 src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java       | 2 +-
 src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java b/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java
index 05e88570..2babe295 100644
--- a/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java
+++ b/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java
@@ -65,7 +65,7 @@ public class AuthenticatingIMAPClient extends IMAPSClient {
          *
          * @return The name of the given authentication method suitable for the server.
          */
-        public final String getAuthName() {
+        public String getAuthName() {
             return authName;
         }
     }
diff --git a/src/main/java/org/apache/commons/net/imap/IMAPCommand.java b/src/main/java/org/apache/commons/net/imap/IMAPCommand.java
index a14a1b91..0794812d 100644
--- a/src/main/java/org/apache/commons/net/imap/IMAPCommand.java
+++ b/src/main/java/org/apache/commons/net/imap/IMAPCommand.java
@@ -156,7 +156,7 @@ public enum IMAPCommand {
      * @param command the {@link IMAPCommand} whose command string is required. Must not be null.
      * @return The IMAP protocol string command corresponding to a command code.
      */
-    public static final String getCommand(final IMAPCommand command) {
+    public static String getCommand(final IMAPCommand command) {
         return command.getIMAPCommand();
     }
 
diff --git a/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java b/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
index 3cd19432..eb333b3d 100644
--- a/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
+++ b/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
@@ -55,7 +55,7 @@ public class ExtendedPOP3Client extends POP3SClient {
          *
          * @return The name of the given authentication method suitable for the server.
          */
-        public final String getAuthName() {
+        public String getAuthName() {
             return this.methodName;
         }
     }
diff --git a/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java b/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
index e626f78a..a8f9be55 100644
--- a/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
+++ b/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
@@ -62,7 +62,7 @@ public class AuthenticatingSMTPClient extends SMTPSClient {
          * @param method The authentication method to get the name for.
          * @return The name of the given authentication method suitable for the server.
          */
-        public static final String getAuthName(final AUTH_METHOD method) {
+        public static String getAuthName(final AUTH_METHOD method) {
             if (method.equals(PLAIN)) {
                 return "PLAIN";
             }


(commons-net) 06/11: Fix PMD UnnecessaryFullyQualifiedName

Posted by gg...@apache.org.
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 30527ab89918e14b4ed084db03a861ebcfe395ab
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 16 18:32:32 2024 -0400

    Fix PMD UnnecessaryFullyQualifiedName
---
 src/main/java/org/apache/commons/net/imap/IMAPClient.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/net/imap/IMAPClient.java b/src/main/java/org/apache/commons/net/imap/IMAPClient.java
index f1f15790..d1d52132 100644
--- a/src/main/java/org/apache/commons/net/imap/IMAPClient.java
+++ b/src/main/java/org/apache/commons/net/imap/IMAPClient.java
@@ -263,7 +263,7 @@ public class IMAPClient extends IMAP {
             args.append(message);
             return doCommand(IMAPCommand.APPEND, args.toString());
         }
-        args.append('{').append(message.getBytes(IMAP.__DEFAULT_ENCODING).length).append('}'); // length of message
+        args.append('{').append(message.getBytes(__DEFAULT_ENCODING).length).append('}'); // length of message
         final int status = sendCommand(IMAPCommand.APPEND, args.toString());
         return IMAPReply.isContinuation(status) // expecting continuation response
                 && IMAPReply.isSuccess(sendData(message)); // if so, send the data


(commons-net) 10/11: Add NOPMD as a TODO, not trivial

Posted by gg...@apache.org.
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 59e1206dd00c7be73c86e0ed0bea377bfa3f410a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 16 18:59:08 2024 -0400

    Add NOPMD as a TODO, not trivial
---
 src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java b/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java
index ad478976..2ca4d1c9 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java
@@ -250,7 +250,7 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable {
                     queue.notify();
                 }
 
-                return ch;
+                return ch; // NOPMD TODO?
             }
         }
     }
@@ -422,7 +422,7 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable {
             /* TERMINAL-TYPE option (end) */
             }
 
-            break;
+            break; // NOPMD TODO?
         }
 
         return ch;


(commons-net) 07/11: Fix PMD UnnecessaryModifier

Posted by gg...@apache.org.
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 c5eaef063c76e61bf9f01ebed2ea10c6fa55f1e5
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 16 18:51:30 2024 -0400

    Fix PMD UnnecessaryModifier
---
 src/changes/changes.xml                                    |  1 +
 src/main/java/org/apache/commons/net/bsd/RExecClient.java  |  2 +-
 .../commons/net/examples/cidr/SubnetUtilsExample.java      |  2 +-
 .../apache/commons/net/examples/ftp/FTPClientExample.java  |  4 ++--
 .../apache/commons/net/examples/mail/POP3ExportMbox.java   |  8 ++++----
 .../java/org/apache/commons/net/examples/unix/chargen.java |  2 +-
 .../java/org/apache/commons/net/finger/FingerClient.java   |  2 +-
 src/main/java/org/apache/commons/net/ftp/FTPClient.java    |  6 +++---
 src/main/java/org/apache/commons/net/ftp/FTPCmd.java       |  2 +-
 src/main/java/org/apache/commons/net/ftp/FTPFile.java      |  2 +-
 .../org/apache/commons/net/ftp/FTPListParseEngine.java     |  2 +-
 src/main/java/org/apache/commons/net/ftp/FTPSClient.java   |  2 +-
 src/main/java/org/apache/commons/net/nntp/NNTPClient.java  |  8 ++++----
 src/main/java/org/apache/commons/net/smtp/SMTPClient.java  |  2 +-
 src/test/java/org/apache/commons/net/MockTcpServer.java    |  4 ++--
 .../apache/commons/net/daytime/MockDaytimeTCPServer.java   |  2 +-
 .../java/org/apache/commons/net/examples/MainTest.java     |  4 ++--
 .../org/apache/commons/net/ftp/parser/MLSDComparison.java  |  4 ++--
 .../apache/commons/net/io/ToNetASCIIInputStreamTest.java   |  2 +-
 .../commons/net/telnet/TelnetClientFunctionalTest.java     |  2 +-
 .../org/apache/commons/net/telnet/TelnetClientTest.java    |  2 +-
 .../org/apache/commons/net/tftp/TFTPServerPathTest.java    | 14 +++++++-------
 src/test/java/org/apache/commons/net/tftp/TFTPTest.java    |  6 +++---
 23 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7c02d4ee..b6e68b4b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -75,6 +75,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD UnusedFormalParameter.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD AvoidBranchingStatementAsLastInLoop in org.apache.commons.net.bsd.RCommandClient.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD UselessOverridingMethod in org.apache.commons.net.telnet.TelnetClient.</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD UnnecessaryModifier.</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/RExecClient.java b/src/main/java/org/apache/commons/net/bsd/RExecClient.java
index e3a8537a..872d457e 100644
--- a/src/main/java/org/apache/commons/net/bsd/RExecClient.java
+++ b/src/main/java/org/apache/commons/net/bsd/RExecClient.java
@@ -81,7 +81,7 @@ public class RExecClient extends SocketClient {
     InputStream createErrorStream() throws IOException {
         final Socket socket;
 
-        try (final ServerSocket server = _serverSocketFactory_.createServerSocket(0, 1, getLocalAddress())) {
+        try (ServerSocket server = _serverSocketFactory_.createServerSocket(0, 1, getLocalAddress())) {
             _output_.write(Integer.toString(server.getLocalPort()).getBytes(StandardCharsets.UTF_8)); // $NON-NLS-1$
             _output_.write(NULL_CHAR);
             _output_.flush();
diff --git a/src/main/java/org/apache/commons/net/examples/cidr/SubnetUtilsExample.java b/src/main/java/org/apache/commons/net/examples/cidr/SubnetUtilsExample.java
index 879e57ae..7b5d6b0f 100644
--- a/src/main/java/org/apache/commons/net/examples/cidr/SubnetUtilsExample.java
+++ b/src/main/java/org/apache/commons/net/examples/cidr/SubnetUtilsExample.java
@@ -51,7 +51,7 @@ public class SubnetUtilsExample {
 
         final String prompt = "Enter an IP address (e.g. 192.168.0.10):";
         System.out.println(prompt);
-        try (final Scanner scanner = new Scanner(System.in, Charset.defaultCharset().name())) {
+        try (Scanner scanner = new Scanner(System.in, Charset.defaultCharset().name())) {
             while (scanner.hasNextLine()) {
                 final String address = scanner.nextLine();
                 System.out.println("The IP address [" + address + "] is " + (info.isInRange(address) ? "" : "not ") + "within the subnet [" + subnet + "]");
diff --git a/src/main/java/org/apache/commons/net/examples/ftp/FTPClientExample.java b/src/main/java/org/apache/commons/net/examples/ftp/FTPClientExample.java
index 5aa8189e..126c9a7c 100644
--- a/src/main/java/org/apache/commons/net/examples/ftp/FTPClientExample.java
+++ b/src/main/java/org/apache/commons/net/examples/ftp/FTPClientExample.java
@@ -355,7 +355,7 @@ public final class FTPClientExample {
             ftp.setUseEPSVwithIPv4(useEpsvWithIPv4);
 
             if (storeFile) {
-                try (final InputStream input = new FileInputStream(local)) {
+                try (InputStream input = new FileInputStream(local)) {
                     ftp.storeFile(remote, input);
                 }
 
@@ -446,7 +446,7 @@ public final class FTPClientExample {
                     System.out.println("Failed: " + ftp.getReplyString());
                 }
             } else {
-                try (final OutputStream output = new FileOutputStream(local)) {
+                try (OutputStream output = new FileOutputStream(local)) {
                     ftp.retrieveFile(remote, output);
                 }
 
diff --git a/src/main/java/org/apache/commons/net/examples/mail/POP3ExportMbox.java b/src/main/java/org/apache/commons/net/examples/mail/POP3ExportMbox.java
index 1b2010b8..1a64f32e 100644
--- a/src/main/java/org/apache/commons/net/examples/mail/POP3ExportMbox.java
+++ b/src/main/java/org/apache/commons/net/examples/mail/POP3ExportMbox.java
@@ -129,7 +129,7 @@ public final class POP3ExportMbox {
                     System.out.println("Writing dir: " + mbox);
                     // Currently POP3Client uses iso-8859-1
                     for (int i = 1; i <= count; i++) {
-                        try (final OutputStreamWriter fw = new OutputStreamWriter(new FileOutputStream(new File(mbox, i + ".eml")),
+                        try (OutputStreamWriter fw = new OutputStreamWriter(new FileOutputStream(new File(mbox, i + ".eml")),
                                 StandardCharsets.ISO_8859_1)) {
                             writeFile(pop3, fw, i);
                         }
@@ -137,7 +137,7 @@ public final class POP3ExportMbox {
                 } else {
                     System.out.println("Writing file: " + mbox);
                     // Currently POP3Client uses iso-8859-1
-                    try (final OutputStreamWriter fw = new OutputStreamWriter(new FileOutputStream(mbox), StandardCharsets.ISO_8859_1)) {
+                    try (OutputStreamWriter fw = new OutputStreamWriter(new FileOutputStream(mbox), StandardCharsets.ISO_8859_1)) {
                         for (int i = 1; i <= count; i++) {
                             writeMbox(pop3, fw, i);
                         }
@@ -158,7 +158,7 @@ public final class POP3ExportMbox {
     }
 
     private static void writeFile(final POP3Client pop3, final OutputStreamWriter fw, final int i) throws IOException {
-        try (final BufferedReader r = (BufferedReader) pop3.retrieveMessage(i)) {
+        try (BufferedReader r = (BufferedReader) pop3.retrieveMessage(i)) {
             String line;
             while ((line = r.readLine()) != null) {
                 fw.write(line);
@@ -172,7 +172,7 @@ public final class POP3ExportMbox {
                 = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");
         final String replyTo = "MAILER-DAEMON"; // default
         final Date received = new Date();
-        try (final BufferedReader r = (BufferedReader) pop3.retrieveMessage(i)) {
+        try (BufferedReader r = (BufferedReader) pop3.retrieveMessage(i)) {
             fw.append("From ");
             fw.append(replyTo);
             fw.append(' ');
diff --git a/src/main/java/org/apache/commons/net/examples/unix/chargen.java b/src/main/java/org/apache/commons/net/examples/unix/chargen.java
index 928dfda6..9ad9371b 100644
--- a/src/main/java/org/apache/commons/net/examples/unix/chargen.java
+++ b/src/main/java/org/apache/commons/net/examples/unix/chargen.java
@@ -46,7 +46,7 @@ public final class chargen {
         // We want to timeout if a response takes longer than 60 seconds
         client.setDefaultTimeout(60000);
         client.connect(host);
-        try (final BufferedReader chargenInput = new BufferedReader(new InputStreamReader(client.getInputStream(), Charset.defaultCharset()))) {
+        try (BufferedReader chargenInput = new BufferedReader(new InputStreamReader(client.getInputStream(), Charset.defaultCharset()))) {
 
             // We assume the chargen service outputs lines, but it really doesn't
             // have to, so this code might actually not work if no newlines are
diff --git a/src/main/java/org/apache/commons/net/finger/FingerClient.java b/src/main/java/org/apache/commons/net/finger/FingerClient.java
index d2294d08..db92d54e 100644
--- a/src/main/java/org/apache/commons/net/finger/FingerClient.java
+++ b/src/main/java/org/apache/commons/net/finger/FingerClient.java
@@ -145,7 +145,7 @@ public class FingerClient extends SocketClient {
         int read;
         final StringBuilder result = new StringBuilder(buffer.length);
 
-        try (final BufferedReader input = new BufferedReader(new InputStreamReader(getInputStream(longOutput, user), getCharset()))) {
+        try (BufferedReader input = new BufferedReader(new InputStreamReader(getInputStream(longOutput, user), getCharset()))) {
             while (true) {
                 read = input.read(buffer, 0, buffer.length);
                 if (read <= 0) {
diff --git a/src/main/java/org/apache/commons/net/ftp/FTPClient.java b/src/main/java/org/apache/commons/net/ftp/FTPClient.java
index ea307fb9..af555fd3 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPClient.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPClient.java
@@ -703,7 +703,7 @@ public class FTPClient extends FTP implements Configurable {
         if (dataConnectionMode == ACTIVE_LOCAL_DATA_CONNECTION_MODE) {
             // if no activePortRange was set (correctly) -> getActivePort() = 0
             // -> new ServerSocket(0) -> bind to any free local port
-            try (final ServerSocket server = _serverSocketFactory_.createServerSocket(getActivePort(), 1, getHostAddress())) {
+            try (ServerSocket server = _serverSocketFactory_.createServerSocket(getActivePort(), 1, getHostAddress())) {
                 // Try EPRT only if remote server is over IPv6, if not use PORT,
                 // because EPRT has no advantage over PORT on IPv4.
                 // It could even have the disadvantage,
@@ -2356,11 +2356,11 @@ public class FTPClient extends FTP implements Configurable {
      */
     public String[] listNames(final String pathname) throws IOException {
         final ArrayList<String> results = new ArrayList<>();
-        try (final Socket socket = _openDataConnection_(FTPCmd.NLST, getListArguments(pathname))) {
+        try (Socket socket = _openDataConnection_(FTPCmd.NLST, getListArguments(pathname))) {
             if (socket == null) {
                 return null;
             }
-            try (final BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), getControlEncoding()))) {
+            try (BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), getControlEncoding()))) {
                 String line;
                 while ((line = reader.readLine()) != null) {
                     results.add(line);
diff --git a/src/main/java/org/apache/commons/net/ftp/FTPCmd.java b/src/main/java/org/apache/commons/net/ftp/FTPCmd.java
index 5d8c0bb2..1979a4d5 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPCmd.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPCmd.java
@@ -254,7 +254,7 @@ public enum FTPCmd {
      *
      * @return The FTP protcol command string corresponding to a specified command code.
      */
-    public final String getCommand() {
+    public String getCommand() {
         return name();
     }
 
diff --git a/src/main/java/org/apache/commons/net/ftp/FTPFile.java b/src/main/java/org/apache/commons/net/ftp/FTPFile.java
index 25b45499..dadc93b1 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPFile.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPFile.java
@@ -421,7 +421,7 @@ public class FTPFile implements Serializable {
             return "[Invalid: could not parse file entry]";
         }
         final StringBuilder sb = new StringBuilder();
-        try (final Formatter fmt = new Formatter(sb)) {
+        try (Formatter fmt = new Formatter(sb)) {
             sb.append(formatType());
             sb.append(permissionToString(USER_ACCESS));
             sb.append(permissionToString(GROUP_ACCESS));
diff --git a/src/main/java/org/apache/commons/net/ftp/FTPListParseEngine.java b/src/main/java/org/apache/commons/net/ftp/FTPListParseEngine.java
index a4ca970f..f7100645 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPListParseEngine.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPListParseEngine.java
@@ -235,7 +235,7 @@ public class FTPListParseEngine {
      * @throws IOException thrown on any failure to read the stream
      */
     private void read(final InputStream inputStream, final String charsetName) throws IOException {
-        try (final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, Charsets.toCharset(charsetName)))) {
+        try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, Charsets.toCharset(charsetName)))) {
 
             String line = this.parser.readNextEntry(reader);
 
diff --git a/src/main/java/org/apache/commons/net/ftp/FTPSClient.java b/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
index 507148fd..8179c58d 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
@@ -797,7 +797,7 @@ public class FTPSClient extends FTPClient {
         if (getDataConnectionMode() == ACTIVE_LOCAL_DATA_CONNECTION_MODE) {
             // if no activePortRange was set (correctly) -> getActivePort() = 0
             // -> new ServerSocket(0) -> bind to any free local port
-            try (final ServerSocket server = _serverSocketFactory_.createServerSocket(getActivePort(), 1, getHostAddress())) {
+            try (ServerSocket server = _serverSocketFactory_.createServerSocket(getActivePort(), 1, getHostAddress())) {
                 // Try EPRT only if remote server is over IPv6, if not use PORT,
                 // because EPRT has no advantage over PORT on IPv4.
                 // It could even have the disadvantage,
diff --git a/src/main/java/org/apache/commons/net/nntp/NNTPClient.java b/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
index c6b09864..d7cd7fbf 100644
--- a/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
+++ b/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
@@ -399,7 +399,7 @@ public class NNTPClient extends NNTP {
             return null;
         }
 
-        try (final StringWriter help = new StringWriter(); final BufferedReader reader = new DotTerminatedMessageReader(_reader_)) {
+        try (StringWriter help = new StringWriter(); BufferedReader reader = new DotTerminatedMessageReader(_reader_)) {
             Util.copyReader(reader, help);
             return help.toString();
         }
@@ -426,7 +426,7 @@ public class NNTPClient extends NNTP {
         }
 
         final Vector<String> list = new Vector<>();
-        try (final BufferedReader reader = new DotTerminatedMessageReader(_reader_)) {
+        try (BufferedReader reader = new DotTerminatedMessageReader(_reader_)) {
 
             String line;
             while ((line = reader.readLine()) != null) {
@@ -516,7 +516,7 @@ public class NNTPClient extends NNTP {
             return null;
         }
 
-        try (final BufferedReader reader = new DotTerminatedMessageReader(_reader_)) {
+        try (BufferedReader reader = new DotTerminatedMessageReader(_reader_)) {
             String line;
             final ArrayList<String> list = new ArrayList<>();
             while ((line = reader.readLine()) != null) {
@@ -602,7 +602,7 @@ public class NNTPClient extends NNTP {
         final Vector<NewsgroupInfo> list = new Vector<>(2048);
 
         String line;
-        try (final BufferedReader reader = new DotTerminatedMessageReader(_reader_)) {
+        try (BufferedReader reader = new DotTerminatedMessageReader(_reader_)) {
             while ((line = reader.readLine()) != null) {
                 final NewsgroupInfo tmp = parseNewsgroupListEntry(line);
                 if (tmp == null) {
diff --git a/src/main/java/org/apache/commons/net/smtp/SMTPClient.java b/src/main/java/org/apache/commons/net/smtp/SMTPClient.java
index 88ba62d5..4c44430d 100644
--- a/src/main/java/org/apache/commons/net/smtp/SMTPClient.java
+++ b/src/main/java/org/apache/commons/net/smtp/SMTPClient.java
@@ -322,7 +322,7 @@ public class SMTPClient extends SMTP {
      * @throws IOException                   If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
      */
     public boolean sendShortMessageData(final String message) throws IOException {
-        try (final Writer writer = sendMessageData()) {
+        try (Writer writer = sendMessageData()) {
             if (writer == null) {
                 return false;
             }
diff --git a/src/test/java/org/apache/commons/net/MockTcpServer.java b/src/test/java/org/apache/commons/net/MockTcpServer.java
index d09f1802..581a4c4e 100644
--- a/src/test/java/org/apache/commons/net/MockTcpServer.java
+++ b/src/test/java/org/apache/commons/net/MockTcpServer.java
@@ -35,7 +35,7 @@ import java.net.Socket;
  *      // other fields and constructors are omitted for brevity
  *     {@literal @Override}
  *     protected void processClientSocket(final Socket clientSocket) throws Exception {
- *         try (final PrintWriter pw = new PrintWriter(clientSocket.getOutputStream())) {
+ *         try (PrintWriter pw = new PrintWriter(clientSocket.getOutputStream())) {
  *             pw.write("Hello, World!");
  *             pw.flush();
  *         }
@@ -131,7 +131,7 @@ public abstract class MockTcpServer implements Runnable, Closeable {
     @Override
     public final void run() {
         while (running) {
-            try (final Socket clientSocket = serverSocket.accept()) {
+            try (Socket clientSocket = serverSocket.accept()) {
                 processClientSocket(clientSocket);
             } catch (final IOException e) {
                 System.err.println("IOException on MockWebServer serverSocket.accept(): " + e);
diff --git a/src/test/java/org/apache/commons/net/daytime/MockDaytimeTCPServer.java b/src/test/java/org/apache/commons/net/daytime/MockDaytimeTCPServer.java
index 19d0a31e..3d1cd744 100644
--- a/src/test/java/org/apache/commons/net/daytime/MockDaytimeTCPServer.java
+++ b/src/test/java/org/apache/commons/net/daytime/MockDaytimeTCPServer.java
@@ -98,7 +98,7 @@ public final class MockDaytimeTCPServer extends MockTcpServer {
 
     @Override
     protected void processClientSocket(final Socket clientSocket) throws Exception {
-        try (final PrintWriter pw = new PrintWriter(clientSocket.getOutputStream())) {
+        try (PrintWriter pw = new PrintWriter(clientSocket.getOutputStream())) {
             final Clock nextClock = Objects.requireNonNull(responseQueue.poll(5, TimeUnit.SECONDS), "Could not obtain next clock for DaytimeTCPMockServer");
             final ZonedDateTime dateTime = ZonedDateTime.now(nextClock);
             pw.write(dateTime.format(DAYTIME_DATA_FORMAT));
diff --git a/src/test/java/org/apache/commons/net/examples/MainTest.java b/src/test/java/org/apache/commons/net/examples/MainTest.java
index d2caabb9..b4b14785 100644
--- a/src/test/java/org/apache/commons/net/examples/MainTest.java
+++ b/src/test/java/org/apache/commons/net/examples/MainTest.java
@@ -88,7 +88,7 @@ public class MainTest {
         final String sourceFile = new File(URLDecoder.decode(codeSource.getLocation().getFile(), StandardCharsets.UTF_8.name())).getCanonicalPath();
         final Properties p = new Properties();
         if (sourceFile.endsWith(".jar")) {
-            try (final JarFile jf = new JarFile(sourceFile)) {
+            try (JarFile jf = new JarFile(sourceFile)) {
                 final Enumeration<JarEntry> e = jf.entries();
                 while (e.hasMoreElements()) {
                     final JarEntry je = e.nextElement();
@@ -112,7 +112,7 @@ public class MainTest {
     public void testCheckExamplesPropertiesIsComplete() throws Exception {
         final Properties cp = scanClasses();
         final Properties fp = new Properties();
-        try (final InputStream inputStream = this.getClass().getResourceAsStream("examples.properties")) {
+        try (InputStream inputStream = this.getClass().getResourceAsStream("examples.properties")) {
             fp.load(inputStream);
         }
         @SuppressWarnings("unchecked") // OK
diff --git a/src/test/java/org/apache/commons/net/ftp/parser/MLSDComparison.java b/src/test/java/org/apache/commons/net/ftp/parser/MLSDComparison.java
index 63c55d1c..df7cb64b 100644
--- a/src/test/java/org/apache/commons/net/ftp/parser/MLSDComparison.java
+++ b/src/test/java/org/apache/commons/net/ftp/parser/MLSDComparison.java
@@ -181,12 +181,12 @@ public class MLSDComparison {
             for (final File mlsd : files) {
                 // System.out.println(mlsd);
                 FTPListParseEngine engine = new FTPListParseEngine(MLSxEntryParser.getInstance());
-                try (final InputStream is = new FileInputStream(mlsd)) {
+                try (InputStream is = new FileInputStream(mlsd)) {
                     engine.readServerList(is, FTP.DEFAULT_CONTROL_ENCODING);
                 }
                 final FTPFile[] mlsds = engine.getFiles(FTPFileFilters.ALL);
                 final File listFile = new File(mlsd.getParentFile(), mlsd.getName().replace("_mlsd", "_list"));
-                try (final InputStream inputStream = new FileInputStream(listFile)) {
+                try (InputStream inputStream = new FileInputStream(listFile)) {
                     final FTPClientConfig cfg = new FTPClientConfig();
                     cfg.setServerTimeZoneId("GMT");
                     final UnixFTPEntryParser parser = new UnixFTPEntryParser(cfg);
diff --git a/src/test/java/org/apache/commons/net/io/ToNetASCIIInputStreamTest.java b/src/test/java/org/apache/commons/net/io/ToNetASCIIInputStreamTest.java
index 7cf9aa75..3b981ddb 100644
--- a/src/test/java/org/apache/commons/net/io/ToNetASCIIInputStreamTest.java
+++ b/src/test/java/org/apache/commons/net/io/ToNetASCIIInputStreamTest.java
@@ -32,7 +32,7 @@ public class ToNetASCIIInputStreamTest {
         final byte[] data = input.getBytes(StandardCharsets.US_ASCII);
         final byte[] expected = expect.getBytes(StandardCharsets.US_ASCII);
         final InputStream source = new ByteArrayInputStream(data);
-        try (final ToNetASCIIInputStream toNetASCII = new ToNetASCIIInputStream(source)) {
+        try (ToNetASCIIInputStream toNetASCII = new ToNetASCIIInputStream(source)) {
             final byte[] output = new byte[data.length * 2]; // cannot be longer than twice the input
 
             final int length = byByte ? getSingleBytes(toNetASCII, output) : getBuffer(toNetASCII, output);
diff --git a/src/test/java/org/apache/commons/net/telnet/TelnetClientFunctionalTest.java b/src/test/java/org/apache/commons/net/telnet/TelnetClientFunctionalTest.java
index a18d1807..9cd50052 100644
--- a/src/test/java/org/apache/commons/net/telnet/TelnetClientFunctionalTest.java
+++ b/src/test/java/org/apache/commons/net/telnet/TelnetClientFunctionalTest.java
@@ -42,7 +42,7 @@ public class TelnetClientFunctionalTest extends TestCase {
         boolean testresult = false;
         tc1.connect("rainmaker.wunderground.com", 3000);
 
-        try (final InputStream is = tc1.getInputStream(); final OutputStream os = tc1.getOutputStream()) {
+        try (InputStream is = tc1.getInputStream(); final OutputStream os = tc1.getOutputStream()) {
 
             boolean cont = waitForString(is, "Return to continue:", 30000);
             if (cont) {
diff --git a/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java b/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java
index cce975e2..93513693 100644
--- a/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java
+++ b/src/test/java/org/apache/commons/net/telnet/TelnetClientTest.java
@@ -721,7 +721,7 @@ public class TelnetClientTest extends TestCase implements TelnetNotificationHand
         final byte[] expected1 = { (byte) 't', (byte) 'e', (byte) 's', (byte) 't', (byte) '1' };
         final byte[] expected2 = { (byte) 't', (byte) 'e', (byte) 's', (byte) 't', (byte) '2' };
 
-        try (final PipedOutputStream po = new PipedOutputStream(); final PipedInputStream pi = new PipedInputStream(po)) {
+        try (PipedOutputStream po = new PipedOutputStream(); final PipedInputStream pi = new PipedInputStream(po)) {
 
             final OutputStream os = STANDARD.server.getOutputStream();
             final OutputStream ostc = STANDARD.client.getOutputStream();
diff --git a/src/test/java/org/apache/commons/net/tftp/TFTPServerPathTest.java b/src/test/java/org/apache/commons/net/tftp/TFTPServerPathTest.java
index b49f9456..c1ee8c62 100644
--- a/src/test/java/org/apache/commons/net/tftp/TFTPServerPathTest.java
+++ b/src/test/java/org/apache/commons/net/tftp/TFTPServerPathTest.java
@@ -122,14 +122,14 @@ public class TFTPServerPathTest {
         tftpClient.setSoTimeout(Duration.ofMillis(2000));
 
         // we can read file
-        try (final OutputStream os = Files.newOutputStream(fileToWrite)) {
+        try (OutputStream os = Files.newOutputStream(fileToWrite)) {
             final String writeFileName = fileToRead.getFileName().toString();
             final int bytesRead = tftpClient.receiveFile(writeFileName, TFTP.BINARY_MODE, os, serverAddress, serverPort);
             assertEquals(fileToReadContentLength, bytesRead);
         }
 
         // but we cannot write to it
-        try (final InputStream is = Files.newInputStream(fileToRead)) {
+        try (InputStream is = Files.newInputStream(fileToRead)) {
             final String readFileName = fileToRead.getFileName().toString();
             final IOException exception = assertThrows(IOException.class, () -> tftpClient.sendFile(readFileName, TFTP.BINARY_MODE, is, serverAddress, serverPort));
             assertEquals("Error code 4 received: Write not allowed by server.", exception.getMessage());
@@ -148,14 +148,14 @@ public class TFTPServerPathTest {
         tftpClient.setSoTimeout(Duration.ofMillis(2000));
 
         // we cannot read file
-        try (final OutputStream os = Files.newOutputStream(fileToWrite)) {
+        try (OutputStream os = Files.newOutputStream(fileToWrite)) {
             final String readFileName = fileToRead.getFileName().toString();
             final IOException exception = assertThrows(IOException.class, () -> tftpClient.receiveFile(readFileName, TFTP.BINARY_MODE, os, serverAddress, serverPort));
             assertEquals("Error code 4 received: Read not allowed by server.", exception.getMessage());
         }
 
         // but we can write to it
-        try (final InputStream is = Files.newInputStream(fileToRead)) {
+        try (InputStream is = Files.newInputStream(fileToRead)) {
             deleteFile(fileToWrite, false);
             final String writeFileName = fileToWrite.getFileName().toString();
             tftpClient.sendFile(writeFileName, TFTP.BINARY_MODE, is, serverAddress, serverPort);
@@ -172,7 +172,7 @@ public class TFTPServerPathTest {
         tftpClient = new TFTPClient();
         tftpClient.open();
 
-        try (final InputStream is = Files.newInputStream(fileToRead)) {
+        try (InputStream is = Files.newInputStream(fileToRead)) {
             final IOException exception = assertThrows(IOException.class, () -> tftpClient.sendFile("../foo", TFTP.BINARY_MODE, is, serverAddress, serverPort));
             assertEquals("Error code 0 received: Cannot access files outside of TFTP server root.", exception.getMessage());
             assertFalse(Files.exists(serverDirectory.resolve("foo")), "file created when it should not have been");
@@ -195,14 +195,14 @@ public class TFTPServerPathTest {
         Files.write(fileToRead, content);
 
         // send file
-        try (final InputStream is = Files.newInputStream(fileToRead)) {
+        try (InputStream is = Files.newInputStream(fileToRead)) {
             deleteFile(fileToWrite, false);
             final String writeFileName = fileToWrite.getFileName().toString();
             tftpClient.sendFile(writeFileName, TFTP.BINARY_MODE, is, serverAddress, serverPort);
         }
 
         // then verify it contents
-        try (final OutputStream os = Files.newOutputStream(fileToWrite)) {
+        try (OutputStream os = Files.newOutputStream(fileToWrite)) {
             final String readFileName = fileToRead.getFileName().toString();
             final int readBytes = tftpClient.receiveFile(readFileName, TFTP.BINARY_MODE, os, serverAddress, serverPort);
             assertEquals(content.length, readBytes);
diff --git a/src/test/java/org/apache/commons/net/tftp/TFTPTest.java b/src/test/java/org/apache/commons/net/tftp/TFTPTest.java
index d734670e..16f3513a 100644
--- a/src/test/java/org/apache/commons/net/tftp/TFTPTest.java
+++ b/src/test/java/org/apache/commons/net/tftp/TFTPTest.java
@@ -68,7 +68,7 @@ public class TFTPTest extends TestCase {
      * Create a file, size specified in bytes
      */
     private static File createFile(final File file, final int size) throws IOException {
-        try (final OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
+        try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
             final byte[] temp = "0".getBytes();
             for (int i = 0; i < size; i++) {
                 os.write(temp);
@@ -134,7 +134,7 @@ public class TFTPTest extends TestCase {
             out.delete();
             assertFalse("Couldn't clear output location", out.exists());
 
-            try (final FileOutputStream output = new FileOutputStream(out)) {
+            try (FileOutputStream output = new FileOutputStream(out)) {
                 tftp.receiveFile(file.getName(), mode, output, "localhost", SERVER_PORT);
             }
 
@@ -196,7 +196,7 @@ public class TFTPTest extends TestCase {
             in.delete();
             assertFalse("Couldn't clear output location", in.exists());
 
-            try (final FileInputStream fis = new FileInputStream(file)) {
+            try (FileInputStream fis = new FileInputStream(file)) {
                 tftp.sendFile(in.getName(), mode, fis, "localhost", SERVER_PORT);
             }
 


(commons-net) 04/11: Javadoc

Posted by gg...@apache.org.
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 93097d065e704c17d9434bf4506da0ee7516b484
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 16 18:25:55 2024 -0400

    Javadoc
---
 .../commons/net/examples/telnet/TelnetClientExample.java |  4 ++--
 .../commons/net/examples/telnet/WeatherTelnet.java       |  4 ++--
 .../org/apache/commons/net/telnet/EchoOptionHandler.java |  2 +-
 .../commons/net/telnet/SuppressGAOptionHandler.java      |  2 +-
 src/main/java/org/apache/commons/net/telnet/Telnet.java  |  4 ++--
 .../java/org/apache/commons/net/telnet/TelnetClient.java | 16 ++++++++--------
 .../org/apache/commons/net/telnet/TelnetCommand.java     |  8 ++++----
 .../org/apache/commons/net/telnet/TelnetInputStream.java |  4 ++--
 .../commons/net/telnet/TelnetNotificationHandler.java    |  2 +-
 .../java/org/apache/commons/net/telnet/TelnetOption.java |  8 ++++----
 .../apache/commons/net/telnet/TelnetOptionHandler.java   |  2 +-
 .../commons/net/telnet/TerminalTypeOptionHandler.java    |  2 +-
 .../commons/net/telnet/WindowSizeOptionHandler.java      |  2 +-
 13 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/examples/telnet/TelnetClientExample.java b/src/main/java/org/apache/commons/net/examples/telnet/TelnetClientExample.java
index f160e7f9..41f60931 100644
--- a/src/main/java/org/apache/commons/net/examples/telnet/TelnetClientExample.java
+++ b/src/main/java/org/apache/commons/net/examples/telnet/TelnetClientExample.java
@@ -95,7 +95,7 @@ public class TelnetClientExample implements Runnable, TelnetNotificationHandler
                 final Thread reader = new Thread(new TelnetClientExample());
                 tc.registerNotifHandler(new TelnetClientExample());
                 System.out.println("TelnetClientExample");
-                System.out.println("Type AYT to send an AYT telnet command");
+                System.out.println("Type AYT to send an AYT Telnet command");
                 System.out.println("Type OPT to print a report of status of options (0-24)");
                 System.out.println("Type REGISTER to register a new SimpleOptionHandler");
                 System.out.println("Type UNREGISTER to unregister an OptionHandler");
@@ -260,7 +260,7 @@ public class TelnetClientExample implements Runnable, TelnetNotificationHandler
         try {
             tc.disconnect();
         } catch (final IOException e) {
-            System.err.println("Exception while closing telnet:" + e.getMessage());
+            System.err.println("Exception while closing Telnet:" + e.getMessage());
         }
     }
 }
diff --git a/src/main/java/org/apache/commons/net/examples/telnet/WeatherTelnet.java b/src/main/java/org/apache/commons/net/examples/telnet/WeatherTelnet.java
index ee297e59..d4c89bbd 100644
--- a/src/main/java/org/apache/commons/net/examples/telnet/WeatherTelnet.java
+++ b/src/main/java/org/apache/commons/net/examples/telnet/WeatherTelnet.java
@@ -24,9 +24,9 @@ import org.apache.commons.net.telnet.TelnetClient;
 
 /**
  * This is an example of a trivial use of the TelnetClient class. It connects to the weather server at the University of Michigan, um-weather.sprl.umich.edu
- * port 3000, and allows the user to interact with the server via standard input. You could use this example to connect to any telnet server, but it is
+ * port 3000, and allows the user to interact with the server via standard input. You could use this example to connect to any Telnet server, but it is
  * obviously not general purpose because it reads from standard input a line at a time, making it inconvenient for use with a remote interactive shell. The
- * TelnetClient class used by itself is mostly intended for automating access to telnet resources rather than interactive use.
+ * TelnetClient class used by itself is mostly intended for automating access to Telnet resources rather than interactive use.
  */
 
 // This class requires the IOUtil support class!
diff --git a/src/main/java/org/apache/commons/net/telnet/EchoOptionHandler.java b/src/main/java/org/apache/commons/net/telnet/EchoOptionHandler.java
index 5364cb41..80571d61 100644
--- a/src/main/java/org/apache/commons/net/telnet/EchoOptionHandler.java
+++ b/src/main/java/org/apache/commons/net/telnet/EchoOptionHandler.java
@@ -18,7 +18,7 @@
 package org.apache.commons.net.telnet;
 
 /**
- * Implements the telnet echo option RFC 857.
+ * Implements the Telnet echo option RFC 857.
  */
 public class EchoOptionHandler extends TelnetOptionHandler {
     /**
diff --git a/src/main/java/org/apache/commons/net/telnet/SuppressGAOptionHandler.java b/src/main/java/org/apache/commons/net/telnet/SuppressGAOptionHandler.java
index 7e20fc42..2678e761 100644
--- a/src/main/java/org/apache/commons/net/telnet/SuppressGAOptionHandler.java
+++ b/src/main/java/org/apache/commons/net/telnet/SuppressGAOptionHandler.java
@@ -18,7 +18,7 @@
 package org.apache.commons.net.telnet;
 
 /**
- * Implements the telnet suppress go ahead option RFC 858.
+ * Implements the Telnet suppress go ahead option RFC 858.
  */
 public class SuppressGAOptionHandler extends TelnetOptionHandler {
     /**
diff --git a/src/main/java/org/apache/commons/net/telnet/Telnet.java b/src/main/java/org/apache/commons/net/telnet/Telnet.java
index 5041cb94..ba4eb0c1 100644
--- a/src/main/java/org/apache/commons/net/telnet/Telnet.java
+++ b/src/main/java/org/apache/commons/net/telnet/Telnet.java
@@ -276,7 +276,7 @@ class Telnet extends SocketClient {
     }
 
     /**
-     * Registers a new TelnetOptionHandler for this telnet to use.
+     * Registers a new TelnetOptionHandler for this Telnet to use.
      *
      * @param opthand   option handler to be registered.
      * @throws InvalidTelnetOptionException - The option code is invalid.
@@ -592,7 +592,7 @@ class Telnet extends SocketClient {
     }
 
     /**
-     * Registers a notification handler to which will be sent notifications of received telnet option negotiation commands.
+     * Registers a notification handler to which will be sent notifications of received Telnet option negotiation commands.
      *
      * @param notifhand   TelnetNotificationHandler to be registered
      */
diff --git a/src/main/java/org/apache/commons/net/telnet/TelnetClient.java b/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
index 61b87476..af3d793a 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
@@ -105,7 +105,7 @@ public class TelnetClient extends Telnet {
     }
 
     /**
-     * Registers a new TelnetOptionHandler for this telnet client to use.
+     * Registers a new TelnetOptionHandler for this Telnet client to use.
      *
      * @param opthand   option handler to be registered.
      *
@@ -143,8 +143,8 @@ public class TelnetClient extends Telnet {
     }
 
     /**
-     * Disconnects the telnet session, closing the input and output streams as well as the socket. If you have references to the input and output streams of the
-     * telnet connection, you should not close them yourself, but rather call disconnect to properly close the connection.
+     * Disconnects the Telnet session, closing the input and output streams as well as the socket. If you have references to the input and output streams of the
+     * Telnet connection, you should not close them yourself, but rather call disconnect to properly close the connection.
      */
     @Override
     public void disconnect() throws IOException {
@@ -170,10 +170,10 @@ public class TelnetClient extends Telnet {
     }
 
     /**
-     * Returns the telnet connection input stream. You should not close the stream when you finish with it. Rather, you should call {@link #disconnect
+     * Returns the Telnet connection input stream. You should not close the stream when you finish with it. Rather, you should call {@link #disconnect
      * disconnect }.
      *
-     * @return The telnet connection input stream.
+     * @return The Telnet connection input stream.
      */
     public InputStream getInputStream() {
         return input;
@@ -195,10 +195,10 @@ public class TelnetClient extends Telnet {
     /* Code Section added for supporting AYT (start) */
 
     /**
-     * Returns the telnet connection output stream. You should not close the stream when you finish with it. Rather, you should call {@link #disconnect
+     * Returns the Telnet connection output stream. You should not close the stream when you finish with it. Rather, you should call {@link #disconnect
      * disconnect }.
      *
-     * @return The telnet connection output stream.
+     * @return The Telnet connection output stream.
      */
     public OutputStream getOutputStream() {
         return output;
@@ -324,7 +324,7 @@ public class TelnetClient extends Telnet {
 
     /**
      * Sends a protocol-specific subnegotiation message to the remote peer. {@link TelnetClient} will add the IAC SB &amp; IAC SE framing bytes; the first byte
-     * in {@code message} should be the appropriate telnet option code.
+     * in {@code message} should be the appropriate Telnet option code.
      *
      * <p>
      * This method does not wait for any response. Subnegotiation messages sent by the remote end can be handled by registering an approrpriate
diff --git a/src/main/java/org/apache/commons/net/telnet/TelnetCommand.java b/src/main/java/org/apache/commons/net/telnet/TelnetCommand.java
index d86d540c..2b5b11ee 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetCommand.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetCommand.java
@@ -18,7 +18,7 @@
 package org.apache.commons.net.telnet;
 
 /**
- * The TelnetCommand class cannot be instantiated and only serves as a storehouse for telnet command constants.
+ * The TelnetCommand class cannot be instantiated and only serves as a storehouse for Telnet command constants.
  *
  * @see org.apache.commons.net.telnet.Telnet
  * @see org.apache.commons.net.telnet.TelnetClient
@@ -99,10 +99,10 @@ public final class TelnetCommand {
     private static final int LAST_COMMAND = EOF;
 
     /**
-     * Returns the string representation of the telnet protocol command corresponding to the given command code.
+     * Returns the string representation of the Telnet protocol command corresponding to the given command code.
      *
-     * @param code The command code of the telnet protocol command.
-     * @return The string representation of the telnet protocol command.
+     * @param code The command code of the Telnet protocol command.
+     * @return The string representation of the Telnet protocol command.
      */
     public static String getCommand(final int code) {
         return commandString[FIRST_COMMAND - code];
diff --git a/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java b/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java
index 372e66a5..ad478976 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java
@@ -117,7 +117,7 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable {
     }
 
     // synchronized(client) critical sections are to protect against
-    // TelnetOutputStream writing through the telnet client at same time
+    // TelnetOutputStream writing through the Telnet client at same time
     // as a processDo/Will/etc. command invoked from TelnetInputStream
     // tries to write. Returns true if buffer was previously empty.
     private boolean processChar(final int ch) throws InterruptedException {
@@ -256,7 +256,7 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable {
     }
 
     // synchronized(client) critical sections are to protect against
-    // TelnetOutputStream writing through the telnet client at same time
+    // TelnetOutputStream writing through the Telnet client at same time
     // as a processDo/Will/etc. command invoked from TelnetInputStream
     // tries to write.
     /**
diff --git a/src/main/java/org/apache/commons/net/telnet/TelnetNotificationHandler.java b/src/main/java/org/apache/commons/net/telnet/TelnetNotificationHandler.java
index 6827b823..364a78f7 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetNotificationHandler.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetNotificationHandler.java
@@ -18,7 +18,7 @@
 package org.apache.commons.net.telnet;
 
 /**
- * The TelnetNotificationHandler interface can be used to handle notification of options negotiation commands received on a telnet session.
+ * The TelnetNotificationHandler interface can be used to handle notification of options negotiation commands received on a Telnet session.
  * <p>
  * The user can implement this interface and register a TelnetNotificationHandler by using the registerNotificationHandler() of TelnetClient to be notified of
  * option negotiation commands.
diff --git a/src/main/java/org/apache/commons/net/telnet/TelnetOption.java b/src/main/java/org/apache/commons/net/telnet/TelnetOption.java
index 396c9048..a3922404 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetOption.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetOption.java
@@ -18,7 +18,7 @@
 package org.apache.commons.net.telnet;
 
 /**
- * The TelnetOption class cannot be instantiated and only serves as a storehouse for telnet option constants.
+ * The TelnetOption class cannot be instantiated and only serves as a storehouse for Telnet option constants.
  * <p>
  * Details regarding Telnet option specification can be found in RFC 855.
  * </p>
@@ -262,10 +262,10 @@ public class TelnetOption {
             "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Extended-Options-List" };
 
     /**
-     * Returns the string representation of the telnet protocol option corresponding to the given option code.
+     * Returns the string representation of the Telnet protocol option corresponding to the given option code.
      *
-     * @param code The option code of the telnet protocol option
-     * @return The string representation of the telnet protocol option.
+     * @param code The option code of the Telnet protocol option
+     * @return The string representation of the Telnet protocol option.
      */
     public static final String getOption(final int code) {
         if (optionString[code].isEmpty()) {
diff --git a/src/main/java/org/apache/commons/net/telnet/TelnetOptionHandler.java b/src/main/java/org/apache/commons/net/telnet/TelnetOptionHandler.java
index 13cb0227..f02dbbf5 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetOptionHandler.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetOptionHandler.java
@@ -18,7 +18,7 @@
 package org.apache.commons.net.telnet;
 
 /**
- * The TelnetOptionHandler class is the base class to be used for implementing handlers for telnet options.
+ * The TelnetOptionHandler class is the base class to be used for implementing handlers for Telnet options.
  * <p>
  * TelnetOptionHandler implements basic option handling functionality and defines abstract methods that must be implemented to define subnegotiation behavior.
  * </p>
diff --git a/src/main/java/org/apache/commons/net/telnet/TerminalTypeOptionHandler.java b/src/main/java/org/apache/commons/net/telnet/TerminalTypeOptionHandler.java
index 88eccfb9..9a31c87f 100644
--- a/src/main/java/org/apache/commons/net/telnet/TerminalTypeOptionHandler.java
+++ b/src/main/java/org/apache/commons/net/telnet/TerminalTypeOptionHandler.java
@@ -18,7 +18,7 @@
 package org.apache.commons.net.telnet;
 
 /**
- * Implements the telnet terminal type option RFC 1091.
+ * Implements the Telnet terminal type option RFC 1091.
  */
 public class TerminalTypeOptionHandler extends TelnetOptionHandler {
     /**
diff --git a/src/main/java/org/apache/commons/net/telnet/WindowSizeOptionHandler.java b/src/main/java/org/apache/commons/net/telnet/WindowSizeOptionHandler.java
index c4f80ae4..1f5353ad 100644
--- a/src/main/java/org/apache/commons/net/telnet/WindowSizeOptionHandler.java
+++ b/src/main/java/org/apache/commons/net/telnet/WindowSizeOptionHandler.java
@@ -18,7 +18,7 @@
 package org.apache.commons.net.telnet;
 
 /**
- * Implements the telnet window size option RFC 1073.
+ * Implements the Telnet window size option RFC 1073.
  *
  * @since 2.0
  */


(commons-net) 01/11: Javadoc

Posted by gg...@apache.org.
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 99bb71a62d083f924eca431fd7577041517f31ef
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 16 18:13:20 2024 -0400

    Javadoc
---
 src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java b/src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java
index 712c738c..ec2aa421 100644
--- a/src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java
+++ b/src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java
@@ -37,7 +37,7 @@ import org.apache.commons.net.ntp.TimeStamp;
  * (NTP) service port on a specified server, retrieves the time, and prints it to standard output along with the fields from the NTP message header (e.g.
  * stratum level, reference id, poll interval, root delay, mode, ...) See <A HREF="ftp://ftp.rfc-editor.org/in-notes/rfc868.txt"> the spec </A> for details.
  * <p>
- * Usage: NTPClient <hostname-or-address-list>
+ * Usage: NTPClient {@code <hostname-or-address-list>}
  * </p>
  * <p>
  * Example: NTPClient clock.psu.edu