commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry Negoda (JIRA)" <j...@apache.org>
Subject [jira] Created: (NET-142) FTPClient.listFiles() returns null for entries with space in group name
Date Thu, 16 Nov 2006 15:38:39 GMT
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


Mime
View raw message