You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Rory Winston (JIRA)" <ji...@apache.org> on 2006/12/20 11:18:22 UTC

[jira] Resolved: (NET-142) FTPClient.listFiles() returns null for entries with space in group name

     [ http://issues.apache.org/jira/browse/NET-142?page=all ]

Rory Winston resolved NET-142.
------------------------------

    Fix Version/s: 2.0
       Resolution: Cannot Reproduce

Hi Dmitry 

I have tried the FTP entry that you gave me and the NTFTPEntryParser parses the group name correctly (including spaces). Im not sure what the actual problem is here - if you have any more info, please send it on.

> FTPClient.listFiles() returns null for entries with space in group name
> -----------------------------------------------------------------------
>
>                 Key: NET-142
>                 URL: http://issues.apache.org/jira/browse/NET-142
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 1.4 Final
>         Environment: Windows FTP server
>            Reporter: Dmitry Negoda
>             Fix For: 2.0
>
>
> FTPClient fails parsing file list if the group name contains spaces, for example "Domain users" in Windows. The following patch helps:
> --- commons-net-1.4.1/src/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java    Sat Dec  3 19:05:48 2005
> +++ /u/ndv/sns_commons_io/src/org/apache/commons/net/ftp/parser/FTPTimestampParserImpl.java     Sat Sep  2 16:47:03 2006
> @@ -21,6 +21,7 @@
>  import java.text.SimpleDateFormat;
>  import java.util.Calendar;
>  import java.util.Date;
> +import java.util.Locale;
>  import java.util.TimeZone;
>  
>  import org.apache.commons.net.ftp.Configurable;
> @@ -98,9 +99,16 @@
>                         if (parsed != null && pp.getIndex() == timestampStr.length()) {
>                                 working.setTime(parsed);
>                         } else {
> -                               throw new ParseException(
> -                                       "Timestamp could not be parsed with older or recent DateFormat", 
> -                                       pp.getIndex());
> +                               // H4cK3D by mAXm
> +                               SimpleDateFormat dmy = new SimpleDateFormat("d MMM yyyy");
> +                               SimpleDateFormat dmh = new SimpleDateFormat("d MMM HH:ss");
> +
> +                               try {
> +                                       working.setTime(dmh.parse(timestampStr));
> +                                       working.set(Calendar.YEAR, Calendar.getInstance().get(Calendar.YEAR));
> +                               } catch (ParseException ex) {
> +                                       working.setTime(dmy.parse(timestampStr));
> +                               }
>                         }
>                 }
>                 return working;

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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