On 1 May 2016 at 16:16, Mailing User <mailingl...@mail.com> wrote: > I searched Google for examples uses of Apache Commons FTP library, but only > found very basic examples. For efficiency and not to reach user limit, I used > only one client. > > When I called mlistFile(), I got an > "java.lang.ArrayIndexOutOfBoundsException: length=1; index=1." at > String entry = getReplyStrings()[1].substring(1); > > I found that at that time, getReplyStrings returned a String array that had > only one element, and it was > 226 Successfully transferred "/somefile.mp4" > instead of the expected > 250-Listing /somefile.mp4 > type=file;size=1834618;modify=20090501101746; /somefile.mp4 > 250 End > > It seems that the response for MLST was mixed with a file close > (InputStream.close()) response. What is the best way to avoid this? Should I > use a separate client for retrieveFileStream()?
The Javadoc http://commons.apache.org/proper/commons-net/javadocs/api-3.4/org/apache/commons/net/ftp/FTPClient.html#retrieveFileStream(java.lang.String) says: "To finalize the file transfer you must call completePendingCommand and check its return value to verify success. If this is not done, subsequent commands may behave unexpectedly. " > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > For additional commands, e-mail: user-h...@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org