From 6e083d7a9783355cc10c8e3d3683dad94854fbff Mon Sep 17 00:00:00 2001 From: Sarankumar Baskar Date: Wed, 22 Jul 2026 10:18:40 +0530 Subject: [PATCH 1/2] [NET-745] Clarify UnixFTPEntryParser trimLeadingSpaces in Javadoc --- .../apache/commons/net/ftp/parser/UnixFTPEntryParser.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java b/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java index a3b2a9279..39b0479cf 100644 --- a/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java +++ b/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java @@ -30,6 +30,12 @@ * This class is based on the logic of Daniel Savarese's DefaultFTPListParser, but adapted to use regular expressions and to fit the new FTPFileEntryParser * interface. *

+ *

+ * By default, leading spaces in parsed file names are preserved because Unix file names can legitimately contain leading spaces. However, some FTP servers + * (including IBM i / OS/400 systems returning Unix-style listings) pad the date column with extra spaces when showing a year instead of a time for + * older entries. This can result in file names with an unintended leading space. Use the {@link #UnixFTPEntryParser(FTPClientConfig, boolean)} constructor + * with {@code trimLeadingSpaces} set to {@code true} to remove leading spaces from file names. + *

* * @see org.apache.commons.net.ftp.FTPFileEntryParser FTPFileEntryParser (for usage instructions) */ From 4cf1f577ae86eddaead05abe9bca1fd06f792306 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Wed, 22 Jul 2026 10:29:11 -0400 Subject: [PATCH 2/2] Refine comments on leading spaces in UnixFTPEntryParser Updated comments to clarify handling of leading spaces in file names. --- .../apache/commons/net/ftp/parser/UnixFTPEntryParser.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java b/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java index 39b0479cf..a6badea69 100644 --- a/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java +++ b/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java @@ -31,10 +31,10 @@ * interface. *

*

- * By default, leading spaces in parsed file names are preserved because Unix file names can legitimately contain leading spaces. However, some FTP servers - * (including IBM i / OS/400 systems returning Unix-style listings) pad the date column with extra spaces when showing a year instead of a time for - * older entries. This can result in file names with an unintended leading space. Use the {@link #UnixFTPEntryParser(FTPClientConfig, boolean)} constructor - * with {@code trimLeadingSpaces} set to {@code true} to remove leading spaces from file names. + * By default, leading spaces in parsed file names are preserved because Unix file names may legitimately begin with spaces. However, some FTP servers, + * including IBM i (formerly OS/400) systems that return Unix-style listings, pad the date field with additional spaces when displaying a year instead + * of a time for older entries. As a result, parsed file names may incorrectly include a leading space. To remove these unintended spaces, use the + * {@link #UnixFTPEntryParser(FTPClientConfig, boolean)} constructor with {@code trimLeadingSpaces} set to {@code true}. *

* * @see org.apache.commons.net.ftp.FTPFileEntryParser FTPFileEntryParser (for usage instructions)