I've recently ran into a scenario where a connect enterprise server contains
file name with spaces. Because of this, the EnterpriseUnixFTPEntryParser does
not accurately parse the listing returned by the server. Below is the raw
listing of the server:
-AR-------TCP A ceunix 398082 2843 May 09 02:26 PGP EWN PREDAY
MEFSEWN.120509022645
-AR-------TCP A ceunix 451560 3022 May 10 02:24 PGP EWN PREDAY
MEFSEWN.120510022415
-ART------TCP A ceunix 427643 3485 May 11 02:22 PGP EWN PREDAY
MEFSEWN.120511022237
In this case, the file name returned by the parsing is simply PGP, but the file
name is indeed everything after the timestamp, so "PGP EWN PREDAY
MEFSEWN.120509022645" for example.
I am using commons net 2.2.1, but have reviewed the parser for the latest 3.1
and it is the same. Group 23 and 24 of the regex contain the entire filename
when combined, but group 24 is never used. I'm curious if there is a reason
why group 24 is being ignored and if there would be any problems changing group
23 to simply include everything after the minute group (22) and return that as
the file name.
By changing the REGEX in the parser to the following, the list parser works as
expected for this listing.
/**
* this is the regular expression used by this parser.
*/
private static final String REGEX =
"(([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])"
+
"([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z]))"
+ "(\\S*)\\s*"
+ "(\\S+)\\s*"
+ "(\\S*)\\s*"
+ "(\\d*)\\s*"
+ "(\\d*)\\s*"
+ MONTHS
+ "\\s*"
+ "((?:[012]\\d*)|(?:3[01]))\\s*"
+ "((\\d\\d\\d\\d)|((?:[01]\\d)|(?:2[0123])):([012345]\\d))\\s"
//+ "(\\S*)(\\s*.*)"; - updating group 23 to contain everything
after the date fields
+ "(.*)";
Is there a possibility to get this changed/updated in the api?
Regards,
E R I C K L I C H T A S
Linoma Software
Senior Software Engineer
p. 402.944.4242 x714
f. 402.944.4243
www.LinomaSoftware.com<http://www.linomasoftware.com/>
www.GoAnywhereMFT.com<http://www.goanywheremft.com/>