Inf1mum opened a new pull request, #420: URL: https://github.com/apache/commons-net/pull/420
## Overview [NET-200](https://issues.apache.org/jira/browse/NET-200): `UnixFTPEntryParser` maps listing entries whose type character is `b` (block device) or `c` (character device) to `FTPFile.FILE_TYPE`, so `FTPFile#isFile()` reports device nodes as regular files. The code carries a `// TODO change this if DEVICE_TYPE implemented` note, and the JIRA thread agrees these entries should not be files. ## Changes - **`UnixFTPEntryParser.parseFTPEntry()`**: `b` and `c` entries now map to `FTPFile.UNKNOWN_TYPE` instead of `FTPFile.FILE_TYPE`. As before, the hard-link count is not parsed for device entries (`isDevice` flag kept), and name/permissions/timestamp parsing is unchanged. - `src/changes/changes.xml`: added a `fix` action for 3.13.1. ## Tests - `UnixFTPEntryParserTest#testNET200BlockAndCharacterDevicesAreNotFiles` (new): block and character device entries parse to `FTPFile.UNKNOWN_TYPE`, are not `isFile()`/`isDirectory()`, are `isUnknown()`, keep a hard-link count of 0, and still carry a parsed timestamp. - `UnixFTPEntryParserTest#doAdditionalGoodTests`: the existing `b`/`c` device samples now assert `UNKNOWN_TYPE` (previously they fell through to the `FILE_TYPE` assertion next to the same TODO). `mvn test -Dtest=UnixFTPEntryParserTest` passes (24/24), and the full FTP parser suite (`DefaultFTPFileEntryParserFactoryTest, EnterpriseUnixFTPEntryParserTest, FTPConfigEntryParserTest, FTPTimestampParserImplTest, MLSxEntryParserTest, MVSFTPEntryParserTest, MacOsPeterFTPEntryParserTest, NTFTPEntryParserTest, NetwareFTPEntryParserTest, OS2FTPEntryParserTest, OS400FTPEntryParserAdditionalTest, OS400FTPEntryParserTest, UnixFTPEntryParserTest, VMSFTPEntryParserTest`) passes (134 tests, 0 failures). ## Notes - Behavior change: consumers filtering `FTPClient.listFiles()` results with `isFile()` will no longer pick up device nodes; that is the requested fix for NET-200. - No new API; `FTPFile` constants are unchanged. Thanks for considering this contribution! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
