This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git
The following commit(s) were added to refs/heads/master by this push:
new ba6d2d68 [NET-745] Clarify UnixFTPEntryParser trimLeadingSpaces in
Javadoc (#405)
ba6d2d68 is described below
commit ba6d2d687bfe677dc7adcaee133dcf5899919e5e
Author: Sarankumar Baskar <[email protected]>
AuthorDate: Wed Jul 22 20:06:38 2026 +0530
[NET-745] Clarify UnixFTPEntryParser trimLeadingSpaces in Javadoc (#405)
* [NET-745] Clarify UnixFTPEntryParser trimLeadingSpaces in Javadoc
* Refine comments on leading spaces in UnixFTPEntryParser
Updated comments to clarify handling of leading spaces in file names.
---------
Co-authored-by: Sarankumar Baskar <[email protected]>
Co-authored-by: Gary Gregory <[email protected]>
---
.../java/org/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 a3b2a927..a6badea6 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 @@ import org.apache.commons.net.ftp.FTPFile;
* 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.
* </p>
+ * <p>
+ * 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}.
+ * </p>
*
* @see org.apache.commons.net.ftp.FTPFileEntryParser FTPFileEntryParser (for
usage instructions)
*/