commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bing...@idx.com
Subject Found and fixed a bug in FTPClient class in Commons Net project.
Date Thu, 07 Jul 2005 15:23:12 GMT
Hi,

I tried to use FTP in my Ant task, so I downloaded the latest 
commons-net-1.4.0.jar and jakarta-oro-2.0.8.jar, however, I got the 
following error:

org.apache.commons.net.ftp.parser.ParserInitializationException: Error 
initializing parser

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.

I am enclosing the modified method below:

    public String getSystemName() throws IOException
    {
      //if (syst() == FTPReply.NAME_SYSTEM_TYPE)
      // Technically, we should expect a NAME_SYSTEM_TYPE response, but
      // in practice FTP servers deviate, so we soften the condition to
      // a positive completion.
        if (__systemName != null) {
            return __systemName;
        }

        if (__systemName == null && FTPReply.isPositiveCompletion(syst())) 
{
            __systemName = 
((String)_replyLines.elementAt(0)).substring(4);
        }
        else {
            //For some system, such as HP's NonStop (Tandem) platform, we 
get:
            //500 'SYST': command not understood. Defaults to UNIX for the 
case.
            __systemName = "UNIX";
        }

        return __systemName;
    }

If anybody can take a look to see if it's appropriate to include the fix 
to the project, that'll be greatly appreciated.

BTW, I sent to the group for three times with an attachment of 
FTPClient.java and all three emails got bounced back. It seems we can't 
use attachment.

Thanks!

Bing

-----------------------------------------------
IMPORTANT NOTIFICATION
-----------------------------------------------
The contents of this e-mail and its attachments are confidential and may be privileged.  If
you are not the intended recipient of this e-mail, please notify IDX immediately (by return
e-mail to either the sender or security@idx.com), destroy all copies of this message along
with any attachments and do not disclose, copy and/or distribute the contents.  The views
expressed in this message are those of the author and not necessarily those of IDX.  In the
absence of a prior written agreement with you authorizing commitments of IDX via e-mail, the
above message shall not bind IDX, unless from a duly authorized officer of the company in
a context indicating an intention to bind the company. 

This e-mail and its attachments are protected by copyright and other laws. (c) IDX Systems
Corporation 2005.  All rights reserved.  IDX is a registered trademark of IDX Investment Corporation.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message