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/06 10:46:22 UTC

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

    [ http://issues.apache.org/jira/browse/NET-142?page=comments#action_12455944 ] 
            
Rory Winston commented on NET-142:
----------------------------------

Dmitry

Can you provide an example of the listing output from the Windows server, with spaces in the group names?

> 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
>
> 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