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 2023/09/13 13:33:51 UTC

[commons-net] 01/02: Refactor commons private code

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 9e2dee88f65fcddbf04f6eb194c66a22c7bba77e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Sep 13 09:33:11 2023 -0400

    Refactor commons private code
---
 .../commons/net/ftp/parser/MVSFTPEntryParser.java    | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/ftp/parser/MVSFTPEntryParser.java b/src/main/java/org/apache/commons/net/ftp/parser/MVSFTPEntryParser.java
index 2af22bec..13601e59 100644
--- a/src/main/java/org/apache/commons/net/ftp/parser/MVSFTPEntryParser.java
+++ b/src/main/java/org/apache/commons/net/ftp/parser/MVSFTPEntryParser.java
@@ -333,18 +333,7 @@ public class MVSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl {
      * @return null: entry was not parsed.
      */
     private FTPFile parseJeslevel1List(final String entry) {
-        if (matches(entry)) {
-            final FTPFile file = new FTPFile();
-            if (group(3).equalsIgnoreCase("OUTPUT")) {
-                file.setRawListing(entry);
-                final String name = group(2); /* Job Number, used by GET */
-                file.setName(name);
-                file.setType(FTPFile.FILE_TYPE);
-                return file;
-            }
-        }
-
-        return null;
+        return parseJeslevelList(entry, 3);
     }
 
     /**
@@ -371,9 +360,13 @@ public class MVSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl {
      * @return null: entry was not parsed.
      */
     private FTPFile parseJeslevel2List(final String entry) {
+        return parseJeslevelList(entry, 4);
+    }
+
+    private FTPFile parseJeslevelList(final String entry, final int matchNum) {
         if (matches(entry)) {
             final FTPFile file = new FTPFile();
-            if (group(4).equalsIgnoreCase("OUTPUT")) {
+            if (group(matchNum).equalsIgnoreCase("OUTPUT")) {
                 file.setRawListing(entry);
                 final String name = group(2); /* Job Number, used by GET */
                 file.setName(name);
@@ -381,7 +374,6 @@ public class MVSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl {
                 return file;
             }
         }
-
         return null;
     }