[
https://issues.apache.org/jira/browse/NET-745?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary D. Gregory updated NET-745:
--------------------------------
Summary: [Javadoc] Improve UnixFTPEntryParser when filename with leading
space when listing contains a year instead of time (IBM i example) (was:
OS400FTPEntryParser returns filename with leading space when listing contains a
year instead of time)
> [Javadoc] Improve UnixFTPEntryParser when filename with leading space when
> listing contains a year instead of time (IBM i example)
> ----------------------------------------------------------------------------------------------------------------------------------
>
> Key: NET-745
> URL: https://issues.apache.org/jira/browse/NET-745
> Project: Commons Net
> Issue Type: Bug
> Reporter: Sarankumar Baskar
> Priority: Major
>
> OS400FTPEntryParser produces a filename with a leading space when the FTP
> directory listing contains a year (previous-year entries) instead of a time
> (current-year entries).
> In standard Unix-style directory listings, the date/time column is
> fixed-width. When the listing shows a year like "2025" instead of a time like
> "15:46", the output is padded with an extra space to maintain column
> alignment. The parser's regex captures that extra space as part of the
> filename.
> Reproduction:
> Current-year entry (parsed correctly):
> Raw: "-rwxrwxrwx 1 TLXDRIVER 0 1592686 Jul 14 15:46 cloudfax.jar"
> Name: "cloudfax.jar"
> Previous-year entry (leading space in name):
> Raw: "-rwxrwxrwx 1 TLXDRIVER 0 27432520 Apr 24 2025
> itextpdf-5.2.1.jar"
> Name: " itextpdf-5.2.1.jar"
> Expected: FTPFile.getName() should return "itextpdf-5.2.1.jar" without a
> leading space.
> Suggested fix: adjust the regex in OS400FTPEntryParser to allow one or more
> whitespace characters before the filename capture group, or trim the captured
> filename.
> Reported on dev mailing list by Matt Pryor.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)