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 2020/12/17 17:37:12 UTC

[commons-net] branch master updated (53d9fd4 -> 862f493)

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 53d9fd4  Eat own dog food.
     new dfdb53a  Refactor and avoid extra array creations.
     new 778385e  Fix spelling errors.
     new 862f493  Log Maven/Java version in GitHub builds.

The 3 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:
 .github/workflows/maven.yml                            |  2 +-
 src/main/java/org/apache/commons/net/ftp/FTP.java      | 13 +++++++++++++
 .../java/org/apache/commons/net/ftp/FTPClient.java     | 18 +++++++++---------
 src/main/java/org/apache/commons/net/ftp/FTPReply.java |  6 +++---
 .../java/org/apache/commons/net/nntp/NNTPReply.java    |  4 ++--
 .../java/org/apache/commons/net/smtp/SMTPReply.java    |  6 +++---
 6 files changed, 31 insertions(+), 18 deletions(-)


[commons-net] 02/03: Fix spelling errors.

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 778385efddb1d96c05d6cfd7a3f6b6e934afd1b4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 17 12:34:24 2020 -0500

    Fix spelling errors.
---
 src/main/java/org/apache/commons/net/ftp/FTPReply.java   | 6 +++---
 src/main/java/org/apache/commons/net/nntp/NNTPReply.java | 4 ++--
 src/main/java/org/apache/commons/net/smtp/SMTPReply.java | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/ftp/FTPReply.java b/src/main/java/org/apache/commons/net/ftp/FTPReply.java
index 890233c..30db15e 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPReply.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPReply.java
@@ -112,7 +112,7 @@ public final class FTPReply
      * server.
      *
      * @param reply  The reply code to test.
-     * @return True if a reply code is a postive preliminary response, false
+     * @return True if a reply code is a positive preliminary response, false
      *         if not.
      */
     public static boolean isPositivePreliminary(final int reply)
@@ -127,7 +127,7 @@ public final class FTPReply
      * successful completion of a command.
      *
      * @param reply  The reply code to test.
-     * @return True if a reply code is a postive completion response, false
+     * @return True if a reply code is a positive completion response, false
      *         if not.
      */
     public static boolean isPositiveCompletion(final int reply)
@@ -145,7 +145,7 @@ public final class FTPReply
      * ready for the PASS command.
      *
      * @param reply  The reply code to test.
-     * @return True if a reply code is a postive intermediate response, false
+     * @return True if a reply code is a positive intermediate response, false
      *         if not.
      */
     public static boolean isPositiveIntermediate(final int reply)
diff --git a/src/main/java/org/apache/commons/net/nntp/NNTPReply.java b/src/main/java/org/apache/commons/net/nntp/NNTPReply.java
index 010d6b3..a62b950 100644
--- a/src/main/java/org/apache/commons/net/nntp/NNTPReply.java
+++ b/src/main/java/org/apache/commons/net/nntp/NNTPReply.java
@@ -94,7 +94,7 @@ public final class NNTPReply
      * successful completion of a command.
      * <p>
      * @param reply  The reply code to test.
-     * @return True if a reply code is a postive completion response, false
+     * @return True if a reply code is a positive completion response, false
      *         if not.
      */
     public static boolean isPositiveCompletion(final int reply)
@@ -112,7 +112,7 @@ public final class NNTPReply
      * server is ready to receive the article to be posted.
      * <p>
      * @param reply  The reply code to test.
-     * @return True if a reply code is a postive intermediate response, false
+     * @return True if a reply code is a positive intermediate response, false
      *         if not.
      */
     public static boolean isPositiveIntermediate(final int reply)
diff --git a/src/main/java/org/apache/commons/net/smtp/SMTPReply.java b/src/main/java/org/apache/commons/net/smtp/SMTPReply.java
index b03703f..ea363f8 100644
--- a/src/main/java/org/apache/commons/net/smtp/SMTPReply.java
+++ b/src/main/java/org/apache/commons/net/smtp/SMTPReply.java
@@ -65,7 +65,7 @@ public final class SMTPReply
      * type of reply. </em>
      * <p>
      * @param reply  The reply code to test.
-     * @return True if a reply code is a postive preliminary response, false
+     * @return True if a reply code is a positive preliminary response, false
      *         if not.
      */
     public static boolean isPositivePreliminary(final int reply)
@@ -80,7 +80,7 @@ public final class SMTPReply
      * successful completion of a command.
      * <p>
      * @param reply  The reply code to test.
-     * @return True if a reply code is a postive completion response, false
+     * @return True if a reply code is a positive completion response, false
      *         if not.
      */
     public static boolean isPositiveCompletion(final int reply)
@@ -98,7 +98,7 @@ public final class SMTPReply
      * ready to receive the message data.
      * <p>
      * @param reply  The reply code to test.
-     * @return True if a reply code is a postive intermediate response, false
+     * @return True if a reply code is a positive intermediate response, false
      *         if not.
      */
     public static boolean isPositiveIntermediate(final int reply)


[commons-net] 01/03: Refactor and avoid extra array creations.

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 dfdb53ac809c9694cfc5364f753f61d1bf75388f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 17 12:33:51 2020 -0500

    Refactor and avoid extra array creations.
---
 src/main/java/org/apache/commons/net/ftp/FTP.java      | 13 +++++++++++++
 .../java/org/apache/commons/net/ftp/FTPClient.java     | 18 +++++++++---------
 2 files changed, 22 insertions(+), 9 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 871808f..2476563 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTP.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTP.java
@@ -733,6 +733,19 @@ public class FTP extends SocketClient
     }
 
     /**
+     * Returns the noth line of text from the last FTP server response as a string. The end of line markers of each are
+     * stripped from the line.
+     *
+     * @param index The index of the line to return, 0-based.
+     *
+     * @return The lines of text from the last FTP response as an array.
+     */
+    String getReplyString(final int index)
+    {
+        return _replyLines.get(index);
+    }
+
+    /**
      * Returns the entire text of the last FTP server response exactly
      * as it was received, including all end of line markers in NETASCII
      * format.
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 f22f6ae..d309e32 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPClient.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPClient.java
@@ -2414,16 +2414,16 @@ implements Configurable
             if (!success) {
                 return false;
             }
-            for (final String l : getReplyStrings()) {
-                if (l.startsWith(" ")) { // it's a FEAT entry
+            for (final String line : _replyLines) {
+                if (line.startsWith(" ")) { // it's a FEAT entry
                     String key;
                     String value="";
-                    final int varsep = l.indexOf(' ', 1);
+                    final int varsep = line.indexOf(' ', 1);
                     if (varsep > 0) {
-                        key = l.substring(1, varsep);
-                        value = l.substring(varsep+1);
+                        key = line.substring(1, varsep);
+                        value = line.substring(varsep+1);
                     } else {
-                        key = l.substring(1);
+                        key = line.substring(1);
                     }
                     key = key.toUpperCase(Locale.ENGLISH);
                     Set<String> entries = featuresMap.get(key);
@@ -2535,7 +2535,7 @@ implements Configurable
     {
         final boolean success = FTPReply.isPositiveCompletion(sendCommand(FTPCmd.MLST, pathname));
         if (success){
-            String reply = getReplyStrings()[1];
+            String reply = getReplyString(1);
             // some FTP server reply not contains space before fact(s)
             if(reply.charAt(0) != ' ') { reply = " " + reply; }
             /* check the response makes sense.
@@ -3579,7 +3579,7 @@ implements Configurable
     public String getSize(final String pathname) throws IOException
     {
         if (FTPReply.isPositiveCompletion(size(pathname))) {
-            return getReplyStrings()[0].substring(4); // skip the return code (e.g. 213) and the space
+            return getReplyString(0).substring(4); // skip the return code (e.g. 213) and the space
         }
         return null;
     }
@@ -3599,7 +3599,7 @@ implements Configurable
     public String getModificationTime(final String pathname) throws IOException {
         if (FTPReply.isPositiveCompletion(mdtm(pathname))) {
             // skip the return code (e.g. 213) and the space
-            return getReplyStrings()[0].substring(4);
+            return getReplyString(0).substring(4);
         }
         return null;
     }


[commons-net] 03/03: Log Maven/Java version in GitHub builds.

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 862f4932732d91b477bd2c887c21406ec9766d42
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 17 12:37:07 2020 -0500

    Log Maven/Java version in GitHub builds.
---
 .github/workflows/maven.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 0d10b6e..fd5d37b 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -43,4 +43,4 @@ jobs:
       with:
         java-version: ${{ matrix.java }}
     - name: Build with Maven
-      run: mvn --batch-mode -Ddoclint=all --file pom.xml --no-transfer-progress
+      run: mvn -V --batch-mode -Ddoclint=all --file pom.xml --no-transfer-progress