You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/11/16 17:46:03 UTC

[GitHub] [commons-net] sebbASF commented on a diff in pull request #95: NET-707: Process files with spaces in name for OS400

sebbASF commented on code in PR #95:
URL: https://github.com/apache/commons-net/pull/95#discussion_r1024318435


##########
src/test/java/org/apache/commons/net/ftp/parser/OS400FTPEntryParserTest.java:
##########
@@ -203,6 +203,20 @@ public void testParseFieldsOnFile() throws Exception
                      df.format(f.getTimestamp().getTime()));
     }
 
+    /**
+     * Method testParseFileNameWithSpaces.
+     * Provide a test to show that file which name contains spaces is parsed correctly.
+     * @throws Exception on error
+     */
+
+    public void testParseFileNameWithSpaces() throws Exception
+    {
+        final FTPFile f = getParser().parseFTPEntry("MYUSER              3 06/12/21 12:00:00 *STMF      file with space.txt");
+        assertNotNull("Could not parse entry.", f);
+        assertTrue("Should have been a file.", f.isFile());
+        assertEquals("file with space.txt", f.getName());

Review Comment:
   It should be easy enough to handle embedded and trailing spaces.
   However leading spaces can only be detected if the filename always starts in a specific column.
   
   This needs to be determined by experimentation on OS400, or by finding the appropriate documentation for OS400.
   I cannot personally help with that.



-- 
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: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org