[
https://issues.apache.org/jira/browse/NET-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12717867#action_12717867
]
Larry West commented on NET-58:
-------------------------------
This is still an issue as of 1.4.1, and one we see often.
I don't think one needs any further information to fix this, as the bug is
right at the line indicated in the stack trace and amply described above:
reply = reply.substring(reply.indexOf('(') + 1,
reply.indexOf(')')).trim();
if "reply" contains no right parenthesis, then FTPClient throws a
StringIndexOutOfBoundsException.
This does *appear* to be fixed in 2.0.0, as __parsePassiveModeReply() has been
completely rewritten there.
> [net] FTPClient throws exception when passive mode reply lacks parentheses
> --------------------------------------------------------------------------
>
> Key: NET-58
> URL: https://issues.apache.org/jira/browse/NET-58
> Project: Commons Net
> Issue Type: Bug
> Environment: Operating System: Linux
> Platform: PC
> Reporter: Eliot Polk
>
> Commons net version 1.4.1 (this doesn't appear in the Bugzilla dropdown)
> When my application does a storeFile to an admittedly obscure FTP server
> (ActiveState ftpd.tcl), it gets this exception from FTPClient:
> [java] java.lang.StringIndexOutOfBoundsException: String index out of
> range: -1
> [java] at java.lang.String.substring(String.java:1444)
> [java] at
> org.apache.commons.net.ftp.FTPClient.__parsePassiveModeReply(FTPClient.java:341)
> [java] at
> org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:511)
> [java] at
> org.apache.commons.net.ftp.FTPClient.__storeFile(FTPClient.java:388)
> [java] at
> org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:1388)
> Looking at that code in __parsePassiveModeReply it appears to require the
> reply
> to be enclosed parentheses, which it should not, according to RFC 1123:
> IMPLEMENTATION:
> The format of the 227 reply to a PASV command is not
> well standardized. In particular, an FTP client cannot
> assume that the parentheses shown on page 40 of RFC-959
> will be present (and in fact, Figure 3 on page 43 omits
> them). Therefore, a User-FTP program that interprets
> the PASV reply must scan the reply for the first digit
> of the host and port numbers.
>
> My application and FTPClient work fine when connecting to a Fedora ftp server.
> Using Fedora command line ftp to do the ftp PUT to the ActiveState tcl ftp
> server also works fine.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.