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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]