Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5.8k views
in .NET FTP by (560 points)
Howdy All;

Love the component. It is making my life easier, and I will get my client to license it ASAP.

I found an interesting bug - but it may not be yours.

The environment my code is a "client of" uses a Microsoft Windows FTP server - with it's directory listing set to "Unix". Your "swap parsers" routine works well - the first time it encounters an error (thinking it is going to be MSDOS style listings) - however, the next error encountered is missing "year" information. All fine and dandy - you have code in-place to handle that.

But ... occasionally the timestamp does not include a leading zereo, if the time is less than 10am/pm... boom, another format exception is thrown.

I have managed to find an offending FTP location in the "wild", open ftp://ftp.microsoft.com as anon, and navigate to the following path:
"/developr/MSDN/NewUp/Glossary"

If you use FTPClient.DirDetails it will generate a "FormatException".

However, I managed a quick fix, and am posting it here, hope it makes it into the next release:

Within the 'UnixFileParser.cs', replace the following lines:
/// <summary>Date format 2</summary>
private const string format2a = "MMM'-'d'-'yyyy'-'HH':'mm";

/// <summary>Date format 2</summary>
private const string format2b = "MMM'-'dd'-'yyyy'-'HH':'mm";   

/// <summary>array of format 2 formats</summary>
private string[] format2 = {format2a,format2b};

With:
/// <summary>Date format 2</summary>
private const string format2a = "MMM'-'d'-'yyyy'-'HH':'mm";

/// <summary>Date format 2</summary>
private const string format2b = "MMM'-'d'-'yyyy'-'H':'mm";

/// <summary>Date format 2</summary>
private const string format2c = "MMM'-'dd'-'yyyy'-'HH':'mm";   

/// <summary>Date format 2</summary>
private const string format2d = "MMM'-'dd'-'yyyy'-'H':'mm";   

/// <summary>array of format 2 formats</summary>
private string[] format2 = {format2a,format2b,format2c,format2d};


Thanks again!

2 Answers

0 votes
by (162k points)
Many thanks for the fix - it will go into the next release.

Howdy All;

Love the component. It is making my life easier, and I will get my client to license it ASAP.

I found an interesting bug - but it may not be yours.

0 votes
by (560 points)
Cool - hope you see my next bug, I *don't* think it will affect me, and I don't have the time to figure out how to handle this in your parsing logic - it's one thing to add a couple date/time formats, quite another to change the parser.

Categories

...