You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2008/03/08 11:09:46 UTC

[jira] Created: (NET-198) FTPTimestampParserImpl#parseTimeStamp() is not fully testable

FTPTimestampParserImpl#parseTimeStamp() is not fully testable
-------------------------------------------------------------

                 Key: NET-198
                 URL: https://issues.apache.org/jira/browse/NET-198
             Project: Commons Net
          Issue Type: Bug
            Reporter: Sebb


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 times.

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 method:

	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.


[jira] Reopened: (NET-198) FTPTimestampParserImpl#parseTimeStamp() is not fully testable

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb reopened NET-198:
----------------------


Patch needs adjusting

> FTPTimestampParserImpl#parseTimeStamp() is not fully testable
> -------------------------------------------------------------
>
>                 Key: NET-198
>                 URL: https://issues.apache.org/jira/browse/NET-198
>             Project: Commons Net
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 1.5, 2.0
>
>         Attachments: FTPTimestampParserImpl.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 times.
> 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 method:
> 	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.


[jira] Updated: (NET-198) FTPTimestampParserImpl#parseTimeStamp() is not fully testable

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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: https://issues.apache.org/jira/browse/NET-198
>             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 times.
> 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 method:
> 	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.


[jira] Updated: (NET-198) FTPTimestampParserImpl#parseTimeStamp() is not fully testable

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated NET-198:
---------------------

    Attachment: FTPTimestampParserImpl.patch

> FTPTimestampParserImpl#parseTimeStamp() is not fully testable
> -------------------------------------------------------------
>
>                 Key: NET-198
>                 URL: https://issues.apache.org/jira/browse/NET-198
>             Project: Commons Net
>          Issue Type: Bug
>            Reporter: Sebb
>         Attachments: FTPTimestampParserImpl.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 times.
> 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 method:
> 	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.


[jira] Updated: (NET-198) FTPTimestampParserImpl#parseTimeStamp() is not fully testable

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated NET-198:
---------------------

    Comment: was deleted

> FTPTimestampParserImpl#parseTimeStamp() is not fully testable
> -------------------------------------------------------------
>
>                 Key: NET-198
>                 URL: https://issues.apache.org/jira/browse/NET-198
>             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 times.
> 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 method:
> 	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.


[jira] Closed: (NET-198) FTPTimestampParserImpl#parseTimeStamp() is not fully testable

Posted by "Rory Winston (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rory Winston closed NET-198.
----------------------------

       Resolution: Fixed
    Fix Version/s: 2.0
                   1.5

> FTPTimestampParserImpl#parseTimeStamp() is not fully testable
> -------------------------------------------------------------
>
>                 Key: NET-198
>                 URL: https://issues.apache.org/jira/browse/NET-198
>             Project: Commons Net
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 1.5, 2.0
>
>         Attachments: FTPTimestampParserImpl.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 times.
> 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 method:
> 	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.


[jira] Closed: (NET-198) FTPTimestampParserImpl#parseTimeStamp() is not fully testable

Posted by "Rory Winston (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rory Winston closed NET-198.
----------------------------

    Resolution: Fixed

> FTPTimestampParserImpl#parseTimeStamp() is not fully testable
> -------------------------------------------------------------
>
>                 Key: NET-198
>                 URL: https://issues.apache.org/jira/browse/NET-198
>             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 times.
> 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 method:
> 	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.