commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <>
Subject [jira] Updated: (NET-198) FTPTimestampParserImpl#parseTimeStamp() is not fully testable
Date Sun, 09 Mar 2008 16:57:46 GMT


Sebb updated NET-198:

    Attachment: FTPTimestampParserImpl2.patch

The original patch was changed slightly when it was applied, and one of the lines was moved
to the wrong method.

Also, it's important that the fix to the year is taken from the provided year, not the current
year (which may be different in testing).
This was omitted in the original patch.

> FTPTimestampParserImpl#parseTimeStamp() is not fully testable
> -------------------------------------------------------------
>                 Key: NET-198
>                 URL:
>             Project: Commons Net
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 1.5, 2.0
>         Attachments: FTPTimestampParserImpl.patch, FTPTimestampParserImpl2.patch
> The FTPTimestampParserImpl#parseTimeStamp() method is not fully testable, because it
unconditionally creates Calendar items using the current time.
> In order to test for leap years and DST, the test code needs to be able to set arbitrary
> I suggest adding a package-private method that takes an additional Calendar parameter,
as follows:
> 	Calendar parseTimestamp(String timestampStr, Calendar now) throws ParseException {
>         // etc
> This would replace the original code; the public interface would delegate to the package-private
> 	public Calendar parseTimestamp(String timestampStr) throws ParseException {
> 		Calendar now = Calendar.getInstance();
> 		return parseTimestamp(timestampStr, now);
> 	}
> Patch to follow.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message