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 53d9fd41073141a0a9cb5761cbde8fc3e9fe5dd6
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Dec 17 12:25:30 2020 -0500

    Eat own dog food.
---
 src/main/java/org/apache/commons/net/ftp/FTPClient.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 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 cda4ceb..f22f6ae 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPClient.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPClient.java
@@ -3598,7 +3598,8 @@ implements Configurable
      */
     public String getModificationTime(final String pathname) throws 
IOException {
         if (FTPReply.isPositiveCompletion(mdtm(pathname))) {
-            return getReplyStrings()[0].substring(4); // skip the return code 
(e.g. 213) and the space
+            // skip the return code (e.g. 213) and the space
+            return getReplyStrings()[0].substring(4);
         }
         return null;
     }
@@ -3617,12 +3618,12 @@ implements Configurable
      * @since 3.4
      */
     public FTPFile mdtmFile(final String pathname) throws IOException {
-        if (FTPReply.isPositiveCompletion(mdtm(pathname))) {
-            final String reply = getReplyStrings()[0].substring(4); // skip 
the return code (e.g. 213) and the space
+        final String modificationTime = getModificationTime(pathname);
+        if (modificationTime != null) {
             final FTPFile file = new FTPFile();
             file.setName(pathname);
-            file.setRawListing(reply);
-            file.setTimestamp(MLSxEntryParser.parseGMTdateTime(reply));
+            file.setRawListing(modificationTime);
+            
file.setTimestamp(MLSxEntryParser.parseGMTdateTime(modificationTime));
             return file;
         }
         return null;

Reply via email to