You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Steve Cohen <sc...@javactivity.org> on 2005/07/08 12:57:09 UTC

Re: [net] Found and fixed a bug in FTPClient class in Commons Net project.

Daniel F. Savarese wrote:
> In message <OF...@idx.com>,
>  Bing_Wu@idx.com writes:
> 
>>I downloaded the source code and found the problem. It's in getSystemName 
>>method of FTPClient class in Commons Net project. The reason is that for 
>>some system, such as HP's NonStop (Tandem) platform, "SYST" command is not 
>>understood, so __systemName will be null thus causing the error above.
> 
> 
> The proper place to handle this would be in the caller to getSystemName,
> otherwise you will never be able to know that the system name is
> unknown.  The documentaton for getSystemName() says:
>   * @return The system type name obtained from the server.  null if the
>   *       information could not be obtained.
> 
> In other words, it is intended to return null.  It is up to the caller
> to decide what to do with the information.  If there's a need for a change,
> I would suggest making it higher up in the call chain.  Steve would
> know best if there's any need.  My guess is that the intent is for
> API users to catch that ParserInitializationException and select a
> default parser according their needs instead of having Commons Net
> make the decision for them.
> 
> daniel
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 
> 
Correct, Daniel.

Suppose there were some other system that didn't answer the SYST command 
which did not act like a UNIX server?  Then we'd be leading the user 
down the wrong path.

Bing Wu does not say which version of commons-net he/she is using.  I 
might suggest that Bugzilla would be appropriate for such issues as this 
- it will force you to say what version.  But the point of the version 
question is that commons-net 1.4.0 (the latest version) offers a way out 
of this problem: check out the FTPClientConfig class.  By specifying in 
advance the system type as UNIX, which, in this case you know to be the 
case, you completely unhook from dependence on the autodetection scheme 
which requires getSystemName() and simply assume UNIX.  This is what you 
want.



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org