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:26 UTC

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

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;