FTPClientConfig: setServerLanguageCode and setShortMonthNames do not work
-------------------------------------------------------------------------

                 Key: NET-366
                 URL: https://issues.apache.org/jira/browse/NET-366
             Project: Commons Net
          Issue Type: Bug
          Components: FTP
    Affects Versions: 2.2
            Reporter: Johannes Katelaan


The methods {{setServerLanguageCode}} and {{setShortMonthNames}} of 
{{FTPClientConfig}} do not work.

The reason for this is, that the config object is not passed to 
{{ConfigurableFTPFileEntryParserImpl.configure}}.

The reason for this can be found in class {{UnixFTPEntryParser}}:

{noformat}
public UnixFTPEntryParser()
{
    this(null);
}

public UnixFTPEntryParser(FTPClientConfig config)
{
    super(REGEX);
    configure(config);
}
{noformat}

The contructor {{UnixFTPEntryParser(FTPClientConfig config)}} is never called 
from outside this class. It is only called once, by the other constructor 
{{UnixFTPEntryParser()}}.

Therefore in {{UnixFTPEntryParser(FTPClientConfig config)}} the parameter 
{{config}} is always null.

So the settings of {{serverLanguageCode}} and {{shortMonthNames}} will never be 
passed to {{ConfigurableFTPFileEntryParserImpl.configure}}.

This can be fixed by changing class {{DefaultFTPFileEntryParserFactory}}.

Change from
{noformat}
public FTPFileEntryParser createUnixFTPEntryParser()
{
    return new UnixFTPEntryParser();
}
{noformat}

to

{noformat}
public FTPFileEntryParser createUnixFTPEntryParser()
{
    return new UnixFTPEntryParser(config);
}
{noformat}

Then the config object will be passed to {{UnixFTPEntryParser}}.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to