You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Stuart McCulloch (JIRA)" <ji...@codehaus.org> on 2013/03/06 03:26:52 UTC

[jira] (MNG-5446) AM/PM inconsistency in mng-3827 and mng-3864 ITs?

Stuart McCulloch created MNG-5446:
-------------------------------------

             Summary: AM/PM inconsistency in mng-3827 and mng-3864 ITs?
                 Key: MNG-5446
                 URL: https://jira.codehaus.org/browse/MNG-5446
             Project: Maven 2 & 3
          Issue Type: Test
          Components: Integration Tests
            Reporter: Stuart McCulloch
            Priority: Minor


The mng-3827 and mng-3864 ITs both include the following Date parameter in their plugin test configuration:

{code}
<dateParam>2008-11-09 11:59:03.0 PM</dateParam>
{code}

https://github.com/apache/maven-integration-testing/blob/master/core-it-suite/src/test/resources/mng-3827/pom.xml#L63
https://github.com/apache/maven-integration-testing/blob/master/core-it-suite/src/test/resources/mng-3864/pom.xml#L69

This parameter is then expected to be written out as:

{code}
2008-11-09 11:59:03
{code}

https://github.com/apache/maven-integration-testing/blob/master/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3827PluginConfigTest.java#L72
https://github.com/apache/maven-integration-testing/blob/master/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3864PerExecPluginConfigTest.java#L72

This looks odd - I would expect "23:59:03" since the time is being written back out without the AM/PM flag and {code}System.err.println(new Date());{code} uses the 24 hour clock on my local JVM.

I suspect there's a long-standing bug in the Plexus DateConverter where it parses the date using a SimpleDateFormat of "yyyy-MM-dd HH:mm:ss.S a" for values with an AM/PM flag. This format uses 'HH' to parse the hour as 'Hour in day (0-23)' rather than 'hh' to parse it as 'Hour in am/pm (1-12)', which would explain why "11:59:03.0 PM" is written back as "11:59:03" and not "23:59:03".

If that's the case then I'd like to suggest the dateParam in the mng-3827 and mng-3864 ITs is changed to:

{code}
<dateParam>2008-11-09 11:59:03.0 AM</dateParam>
{code}

because that way the result would still match the expected "11:59:03" string if/when the DateConverter is fixed (I'm doing some refactoring in the Sisu-Plexus internals to improve re-use which touches on configuration).

AFAICT these ITs don't appear to be testing this specific Date conversion behaviour (ie. silently ignoring / dropping the PM flag), but if this isn't the case and the current behaviour should be maintained for legacy reasons then I'd also like to know.

Thanks in advance!

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira