Details
Description
Calling FTPClient.listFiles(String pathname) results in an inaccurate file list being returned. The following test illustrates the issue:
@Test public void remoteListFilesFailure() throws Exception { FTPClient client = new FTPClient(); client.connect(REMOTE_SERVER); client.enterLocalPassiveMode(); client.login(REMOTE_USERNAME, REMOTE_PASSWORD); client.setFileType(FTP.BINARY_FILE_TYPE); int reply = client.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { client.disconnect(); log.error("FTP server refused connection. reply=" + reply); } FTPFile[] rootFiles = client.listFiles("78/1295213/0/476312ca9c653ffc6cc8fb6e1649dae6/ModComp PO # 1054.pdf"); Assert.assertEquals(1, rootFiles.length); // <-- fails with rootFiles.length = 0 }