Issue Details (XML | Word | Printable)

Key: NET-205
Type: Improvement Improvement
Status: Reopened Reopened
Priority: Major Major
Assignee: Unassigned
Reporter: Sebb
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Net

Allow FTPFile entries to be generated even if date parsing fails

Created: 15/Mar/08 02:04 AM   Updated: 15/Aug/08 07:20 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works AllowUnparseableDates.patch 2008-03-15 02:19 AM Sebb 6 kB
Text File Licensed for inclusion in ASF works net-205-invalidDates.diff.txt 2008-04-08 03:40 PM Martin Oberhuber 0.6 kB
Issue Links:
Reference
 


 Description  « Hide
Most of the FTPEntryParser classes return null if date parsing fails.

This can cause an otherwise good entry to be ignored, when perhaps the only problem is that the parsing is faulty.

The suggestion is to allow such entries to be kept, but with a null date.

This is already done by the EnterpriseUnixFTPEntryParser.

Patches to follow.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Sebb added a comment - 15/Mar/08 02:19 AM
Patch to allow unparseable dates.

Also fixes test suite to check for null date as well as null entry when checking for failures.


Martin Oberhuber added a comment - 08/Apr/08 03:40 PM
I've observed one problem with this change, that a totally wrong FTP parser now easily produces invalid entries when the text that should be a date isn't even remotely a date.

For instance, parsing output of a VMS server with the NTFTPEntryParser, results in this text being parsed as follows:

Total of 5 files, 470/606 blocks

--> datestr = "Total of"
--> size = 5
--> name = "files, 470/606 blocks"

Attached patch gives up when the time parser doesn't even get past the first 4 characters - not sure if that's a good idea, but at least it is closer to what Commons Net was like in previous releases.


Sebb added a comment - 08/Apr/08 04:19 PM
Not entirely sure this is needed, given that the problem only occurs if the wrong parser is used.

However, assuming that it does make sense to protect against using the wrong parser, then perhaps this check - or something like it - should be applied to any of the other parsers?