Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
Background
The 1st of April 2018, Namibia changed their time zone and they don't observe DST anymore, they changed from Western African Time (WAST) to Central African Time (CAST), this change was rolled out in JDK 1.8u161 (Search for tzdata2017c here, and check the database in wikipedia).
The Axis2 code in the ConverterUtil (java/org/apache/axis2/databinding/utils/ConverterUtil.java) creates a Calendar object which is historically aware (returns the date offsets for the date that is being set, in other words returns that in Feb 2007, Namibia had DST), then pulls the raw offset from the time zone, which returns the current offset (no DST) and then sets it to the calendar again.
This discrepancy causes that the calendar is off by one hour this time of the year:
setting time zone to Africa/Windhoek testing with TimeZone Central African Time uses daylight time: false we are in daylight time: false testValue ==> 2007-02-15T14:54:29 calendar ==> 2007-02-15T13:54:29+02:00 <---- HERE back ==> 2007-02-15T14:54:29.000+03:00
Proposed Design
We can default the test date time zone to GMT+1 as WAST used to be or to a different country in this TZ. It seems that this test is very outdated as Namibia hasn't been GMT+1 for a while and currently there is no GMT+1 that observes DST in the southern hemisphere.
Therefore:
- Update the offending test to switch from "Africa/Windhoek" to "Africa/Tunis" (capital of Tunisia) to fix the broken build.
- Or refactor the ConverterUtil so it doesn't overwrites the TZ offset (this might be sensitive to specific JVM implementations).
[INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running org.apache.axis2.databinding.utils.BeanUtilTest [INFO] Tests run: 18, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.418 s - in org.apache.axis2.databinding.utils.BeanUtilTest [INFO] Running org.apache.axis2.databinding.utils.ConverterUtilTest [ERROR] Tests run: 12, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.204 s <<< FAILURE! - in org.apache.axis2.databinding.utils.ConverterUtilTest [ERROR] testConvertToDateTime(org.apache.axis2.databinding.utils.ConverterUtilTest) Time elapsed: 0.027 s <<< FAILURE! junit.framework.ComparisonFailure: expected:<2007-02-15T1[4]:54:29> but was:<2007-02-15T1[3]:54:29> at junit.framework.Assert.assertEquals(Assert.java:100) at junit.framework.Assert.assertEquals(Assert.java:107) at junit.framework.TestCase.assertEquals(TestCase.java:269) at org.apache.axis2.databinding.utils.ConverterUtilTest.internalTestConvertToDateTime(ConverterUtilTest.java:385) at org.apache.axis2.databinding.utils.ConverterUtilTest.testConvertToDateTime(ConverterUtilTest.java:165) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at junit.framework.TestCase.runTest(TestCase.java:176) at junit.framework.TestCase.runBare(TestCase.java:141) at junit.framework.TestResult$1.protect(TestResult.java:122) at junit.framework.TestResult.runProtected(TestResult.java:142) at junit.framework.TestResult.run(TestResult.java:125) at junit.framework.TestCase.run(TestCase.java:129) at junit.framework.TestSuite.runTest(TestSuite.java:252) at junit.framework.TestSuite.run(TestSuite.java:247) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:386) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:323) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:143) [INFO] Running org.apache.axis2.databinding.utils.MultirefHelperTest [INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 s - in org.apache.axis2.databinding.utils.MultirefHelperTest [INFO] Running org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest [INFO] Tests run: 22, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest [INFO] [INFO] Results: [INFO] [ERROR] Failures: [ERROR] ConverterUtilTest.testConvertToDateTime:165->internalTestConvertToDateTime:385 expected:<2007-02-15T1[4]:54:29> but was:<2007-02-15T1[3]:54:29> [INFO] [ERROR] Tests run: 56, Failures: 1, Errors: 0, Skipped: 0 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:19 min [INFO] Finished at: 2018-07-12T14:22:28-05:00 [INFO] Final Memory: 31M/254M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20:test (default-test) on project axis2-adb: There are test failures.