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 2022/05/26 14:49:24 UTC

[commons-net] branch master updated (08275786 -> 83942e11)

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 08275786 Remove redundant semi-colon
     new 91f4fe45 Remove redundant type casts and simplify
     new 83942e11 No need to nest and typo

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:
 .../net/ftp/parser/CompositeFileEntryParser.java        | 17 +++++++----------
 .../commons/net/ftp/FTPClientConfigFunctionalTest.java  | 10 ++--------
 2 files changed, 9 insertions(+), 18 deletions(-)


[commons-net] 02/02: No need to nest and typo

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 83942e11cad88857dedde6f34cf70fe74e26d483
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu May 26 10:49:20 2022 -0400

    No need to nest and typo
---
 .../net/ftp/parser/CompositeFileEntryParser.java        | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/ftp/parser/CompositeFileEntryParser.java b/src/main/java/org/apache/commons/net/ftp/parser/CompositeFileEntryParser.java
index 090c84ce..d405039f 100644
--- a/src/main/java/org/apache/commons/net/ftp/parser/CompositeFileEntryParser.java
+++ b/src/main/java/org/apache/commons/net/ftp/parser/CompositeFileEntryParser.java
@@ -23,9 +23,9 @@ import org.apache.commons.net.ftp.FTPFileEntryParserImpl;
 
 /**
  * This implementation allows to pack some FileEntryParsers together
- * and handle the case where to returned dirstyle isnt clearly defined.
+ * and handle the case where to returned dir style isn't clearly defined.
  * The matching parser will be cached.
- * If the cached parser wont match due to the server changed the dirstyle,
+ * If the cached parser wont match due to the server changed the dir style,
  * a new matching parser will be searched.
  */
 public class CompositeFileEntryParser extends FTPFileEntryParserImpl
@@ -46,16 +46,13 @@ public class CompositeFileEntryParser extends FTPFileEntryParserImpl
         {
             return cachedFtpFileEntryParser.parseFTPEntry(listEntry);
         }
-        else
+        for (final FTPFileEntryParser ftpFileEntryParser : ftpFileEntryParsers)
         {
-            for (final FTPFileEntryParser ftpFileEntryParser : ftpFileEntryParsers)
+            final FTPFile matched = ftpFileEntryParser.parseFTPEntry(listEntry);
+            if (matched != null)
             {
-                final FTPFile matched = ftpFileEntryParser.parseFTPEntry(listEntry);
-                if (matched != null)
-                {
-                    cachedFtpFileEntryParser = ftpFileEntryParser;
-                    return matched;
-                }
+                cachedFtpFileEntryParser = ftpFileEntryParser;
+                return matched;
             }
         }
         return null;


[commons-net] 01/02: Remove redundant type casts and simplify

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 91f4fe45f354ac07c3e1fb33a450bf0845c0ad75
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu May 26 10:49:05 2022 -0400

    Remove redundant type casts and simplify
---
 .../apache/commons/net/ftp/FTPClientConfigFunctionalTest.java  | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/test/java/org/apache/commons/net/ftp/FTPClientConfigFunctionalTest.java b/src/test/java/org/apache/commons/net/ftp/FTPClientConfigFunctionalTest.java
index 080b9397..bb549c0a 100644
--- a/src/test/java/org/apache/commons/net/ftp/FTPClientConfigFunctionalTest.java
+++ b/src/test/java/org/apache/commons/net/ftp/FTPClientConfigFunctionalTest.java
@@ -66,15 +66,9 @@ public class FTPClientConfigFunctionalTest extends TestCase {
     private TreeSet<FTPFile> getSortedSet(final FTPFile[] files) {
         // create a TreeSet which will sort each element
         // as it is added.
-        final TreeSet<FTPFile> sorted = new TreeSet<>((o1, o2) -> {
-            final FTPFile f1 = (FTPFile) o1;
-            final FTPFile f2 = (FTPFile) o2;
-            return f1.getTimestamp().getTime().compareTo(f2.getTimestamp().getTime());
-        });
+        final TreeSet<FTPFile> sorted = new TreeSet<>((o1, o2) -> o1.getTimestamp().getTime().compareTo(o2.getTimestamp().getTime()));
 
-
-        for (final FTPFile file : files)
-        {
+        for (final FTPFile file : files) {
             // The directory contains a few additional files at the beginning
             // which aren't in the series we want. The series we want consists
             // of files named sn.dddd. This adjusts the file list to get rid