You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2021/01/28 15:42:19 UTC

[commons-net] branch master updated (d4e3523 -> 9d17fd7)

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

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


    from d4e3523  Unused
     new 467711f  Tidy
     new 9d17fd7  Simplify by inverting condition

The 2 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:
 .../java/org/apache/commons/net/ftp/FTPClient.java |  3 +--
 .../commons/net/io/ToNetASCIIInputStream.java      |  4 ++--
 .../java/org/apache/commons/net/telnet/Telnet.java | 22 +++++++++++++---------
 3 files changed, 16 insertions(+), 13 deletions(-)


[commons-net] 01/02: Tidy

Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 467711fcd8424c26600160a57bbeed104eae4924
Author: Sebb <se...@apache.org>
AuthorDate: Thu Jan 28 15:41:40 2021 +0000

    Tidy
    
    Array designator belongs with type
    One declaration per line
---
 .../commons/net/io/ToNetASCIIInputStream.java      |  4 ++--
 .../java/org/apache/commons/net/telnet/Telnet.java | 22 +++++++++++++---------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/io/ToNetASCIIInputStream.java b/src/main/java/org/apache/commons/net/io/ToNetASCIIInputStream.java
index 61d744f..3b453a8 100644
--- a/src/main/java/org/apache/commons/net/io/ToNetASCIIInputStream.java
+++ b/src/main/java/org/apache/commons/net/io/ToNetASCIIInputStream.java
@@ -107,7 +107,7 @@ public final class ToNetASCIIInputStream extends FilterInputStream
      *            stream.
      */
     @Override
-    public int read(final byte buffer[]) throws IOException
+    public int read(final byte[] buffer) throws IOException
     {
         return read(buffer, 0, buffer.length);
     }
@@ -128,7 +128,7 @@ public final class ToNetASCIIInputStream extends FilterInputStream
      *            stream.
      */
     @Override
-    public int read(final byte buffer[], int offset, int length) throws IOException
+    public int read(final byte[] buffer, int offset, int length) throws IOException
     {
         int ch;
         final int off;
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 17658d8..cf82ad8 100644
--- a/src/main/java/org/apache/commons/net/telnet/Telnet.java
+++ b/src/main/java/org/apache/commons/net/telnet/Telnet.java
@@ -55,13 +55,17 @@ class Telnet extends SocketClient
                                           (byte)TelnetCommand.IAC, (byte)TelnetCommand.SE
                                       };
 
-    static final int WILL_MASK = 0x01, DO_MASK = 0x02,
-                                  REQUESTED_WILL_MASK = 0x04, REQUESTED_DO_MASK = 0x08;
+    static final int WILL_MASK = 0x01;
+    static final int DO_MASK = 0x02;
+    static final int REQUESTED_WILL_MASK = 0x04;
+    static final int REQUESTED_DO_MASK = 0x08;
 
     /* public */
     static final int DEFAULT_PORT =  23;
 
-    private final int[] doResponse, willResponse, options;
+    private final int[] doResponse;
+    private final int[] willResponse;
+    private final int[] options;
 
     /* TERMINAL-TYPE option (start)*/
     /**
@@ -96,7 +100,7 @@ class Telnet extends SocketClient
     /**
      * Array of option handlers
      */
-    private final TelnetOptionHandler optionHandlers[];
+    private final TelnetOptionHandler[] optionHandlers;
 
     /* open TelnetOptionHandler functionality (end)*/
 
@@ -272,7 +276,7 @@ class Telnet extends SocketClient
             {
                 optionHandlers[option].setWill(true);
 
-                final int subneg[] =
+                final int[] subneg =
                     optionHandlers[option].startSubnegotiationLocal();
 
                 if (subneg != null)
@@ -301,7 +305,7 @@ class Telnet extends SocketClient
             {
                 optionHandlers[option].setDo(true);
 
-                final int subneg[] =
+                final int[] subneg =
                     optionHandlers[option].startSubnegotiationRemote();
 
                 if (subneg != null)
@@ -684,7 +688,7 @@ class Telnet extends SocketClient
      * @param suboptionLength - length of data received
      * @throws IOException - Exception in I/O.
      **/
-    void processSuboption(final int suboption[], final int suboptionLength)
+    void processSuboption(final int[] suboption, final int suboptionLength)
     throws IOException
     {
         if (debug)
@@ -697,7 +701,7 @@ class Telnet extends SocketClient
         {
             if (optionHandlers[suboption[0]] != null)
             {
-                final int responseSuboption[] =
+                final int[] responseSuboption =
                   optionHandlers[suboption[0]].answerSubnegotiation(suboption,
                   suboptionLength);
                 _sendSubnegotiation(responseSuboption);
@@ -756,7 +760,7 @@ class Telnet extends SocketClient
      * @param subn - subnegotiation data to be sent
      * @throws IOException - Exception in I/O.
      **/
-    final synchronized void _sendSubnegotiation(final int subn[])
+    final synchronized void _sendSubnegotiation(final int[] subn)
     throws IOException
     {
         if (debug)


[commons-net] 02/02: Simplify by inverting condition

Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9d17fd7f7b9821a24638d0de2256a8b62092e0e0
Author: Sebb <se...@apache.org>
AuthorDate: Thu Jan 28 15:42:09 2021 +0000

    Simplify by inverting condition
---
 src/main/java/org/apache/commons/net/ftp/FTPClient.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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 f01c928..7490693 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPClient.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPClient.java
@@ -619,8 +619,7 @@ implements Configurable
         delim3 = reply.charAt(2);
         delim4 = reply.charAt(reply.length()-1);
 
-        if (!(delim1 == delim2) || !(delim2 == delim3)
-                || !(delim3 == delim4)) {
+        if ((delim1 != delim2) || (delim2 != delim3) || (delim3 != delim4)) {
             throw new MalformedServerReplyException(
                     "Could not parse extended passive host information.\nServer Reply: " + reply);
         }