Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Labels:
      None
    • Environment:
      osx 10.4.6, java 1.4.2_06
    • Testcase included:
      yes
    • Number of attachments :
      2

      Description

      The date test assertions all fail:

      junit.framework.AssertionFailedError: Test changelog 1 set 1 date/time expected:<239635800000> but was:< 239715000000 >
      at org.apache.maven.changelog.ChangeLogTest.testReadFile(ChangeLogTest.java:50)

      assertEquals( "Test changelog 1 set 1 date/time", 239635800000L, changeSet.getDate().getTime() );

      They just have the wrong date, and they are offset by the timezone ( 7 hours, in my case - I'm MST -0700)

      1. MCHANGELOG-36.patch
        3 kB
        Julian Wood
      2. MCHANGELOG-36a.patch
        4 kB
        Julian Wood

        Issue Links

          Activity

          Hide
          Julian Wood added a comment -

          This update patches the timezone problem, by offsetting the time by the amount of the local timezone in ChangeLogHandler. It also fixes the expectations on the test, which I guess were developed in the +0200 timezone?

          The tests should pass in all timezones now.

          Show
          Julian Wood added a comment - This update patches the timezone problem, by offsetting the time by the amount of the local timezone in ChangeLogHandler. It also fixes the expectations on the test, which I guess were developed in the +0200 timezone? The tests should pass in all timezones now.
          Hide
          Edwin Punzalan added a comment -

          Julian, I applied your patch and it failed in my machine. Maybe something's missing. Thanks.

          Show
          Edwin Punzalan added a comment - Julian, I applied your patch and it failed in my machine. Maybe something's missing. Thanks.
          Hide
          Carlos Sanchez added a comment -

          I get also an error

          -------------------------------------------------------------------------------
          Test set: org.apache.maven.changelog.ChangeLogTest
          -------------------------------------------------------------------------------
          Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec <<< FAILURE!
          testReadFile(org.apache.maven.changelog.ChangeLogTest) Time elapsed: 0.015 sec <<< FAILURE!
          junit.framework.AssertionFailedError: Test changelog 1 set 1 date/time expected:<239635800000> but was:<239747400000>
          at junit.framework.Assert.fail(Assert.java:47)
          at junit.framework.Assert.failNotEquals(Assert.java:282)
          at junit.framework.Assert.assertEquals(Assert.java:64)
          at junit.framework.Assert.assertEquals(Assert.java:136)
          at org.apache.maven.changelog.ChangeLogTest.testReadFile(ChangeLogTest.java:50)

          Show
          Carlos Sanchez added a comment - I get also an error ------------------------------------------------------------------------------- Test set: org.apache.maven.changelog.ChangeLogTest ------------------------------------------------------------------------------- Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec <<< FAILURE! testReadFile(org.apache.maven.changelog.ChangeLogTest) Time elapsed: 0.015 sec <<< FAILURE! junit.framework.AssertionFailedError: Test changelog 1 set 1 date/time expected:<239635800000> but was:<239747400000> at junit.framework.Assert.fail(Assert.java:47) at junit.framework.Assert.failNotEquals(Assert.java:282) at junit.framework.Assert.assertEquals(Assert.java:64) at junit.framework.Assert.assertEquals(Assert.java:136) at org.apache.maven.changelog.ChangeLogTest.testReadFile(ChangeLogTest.java:50)
          Hide
          Julian Wood added a comment -

          I think the real problem is that we don't get the timezone information into the changelog.xml. Thus I made the assumption that all change entries were in the timezone of the person creating the site, and just used that timezone to correct the date entry. I don't think that assumption is going to hold up. Let me see if I can correct the real problem.

          Show
          Julian Wood added a comment - I think the real problem is that we don't get the timezone information into the changelog.xml. Thus I made the assumption that all change entries were in the timezone of the person creating the site, and just used that timezone to correct the date entry. I don't think that assumption is going to hold up. Let me see if I can correct the real problem.
          Hide
          Julian Wood added a comment -

          MCHANGELOG-36a.patch does the following. It assumes that the change entry was made using the default time zone (on the machine invoking the changelog plugin). This assumption is made because the changelog.xml produced from scm reflects nothing about the timezone information of the event. To properly fix this problem, changes to maven-scm would need to be made. Either a new timezone element is needed, or the time element should not omit the timezone information that came from scm.

          When a Date is created while parsing the changelog.xml file, we adjust for the default timezone. Otherwise the Date created will not reflect the date in the changelog.xml - it will be offset by the timezone.

          ChangeLogTest.java is also modified so that tests will work no matter what the default timezone of the machine building the plugin.

          Show
          Julian Wood added a comment - MCHANGELOG-36 a.patch does the following. It assumes that the change entry was made using the default time zone (on the machine invoking the changelog plugin). This assumption is made because the changelog.xml produced from scm reflects nothing about the timezone information of the event. To properly fix this problem, changes to maven-scm would need to be made. Either a new timezone element is needed, or the time element should not omit the timezone information that came from scm. When a Date is created while parsing the changelog.xml file, we adjust for the default timezone. Otherwise the Date created will not reflect the date in the changelog.xml - it will be offset by the timezone. ChangeLogTest.java is also modified so that tests will work no matter what the default timezone of the machine building the plugin.
          Hide
          Julian Wood added a comment -

          MCHANGELOG-36a.patch supercedes MCHANGELOG-36.patch (ie ignore or delete MCHANGELOG-36.patch)

          Show
          Julian Wood added a comment - MCHANGELOG-36 a.patch supercedes MCHANGELOG-36 .patch (ie ignore or delete MCHANGELOG-36 .patch)
          Hide
          Julian Wood added a comment -

          While this patch is fine on it's own, if one then tries to apply the MCHANGELOG-3.patch, it won't work. Do it in the opposite order:

          MCHANGELOG-3.patch
          MCHANGELOG-36a.patch

          Show
          Julian Wood added a comment - While this patch is fine on it's own, if one then tries to apply the MCHANGELOG-3 .patch, it won't work. Do it in the opposite order: MCHANGELOG-3 .patch MCHANGELOG-36 a.patch
          Hide
          Edwin Punzalan added a comment -

          Patch applied. Thanks.

          Show
          Edwin Punzalan added a comment - Patch applied. Thanks.

            People

            • Assignee:
              Edwin Punzalan
              Reporter:
              Julian Wood
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: