commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry West (JIRA)" <>
Subject [jira] Commented: (NET-58) [net] FTPClient throws exception when passive mode reply lacks parentheses
Date Tue, 09 Jun 2009 23:43:07 GMT


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,

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:
>             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(
>      [java]     at
>      [java]     at
>      [java]     at
>      [java]     at
> Looking at that code in __parsePassiveModeReply it appears to require the reply
> to be enclosed parentheses, which it should not, according to RFC 1123: 
>  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.

View raw message