Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
1.4
-
None
-
None
-
Windows FTP server
Description
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())
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;