Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6181

[classlib][text] SimpleDateFormatTest.test_set2DigitYearStartLjava_util_Date would fail

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.0M9
    • Fix Version/s: 5.0M10
    • Component/s: Classlib
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      Currently the testcase test_set2DigitYearStartLjava_util_Date of SimpleDateFormatTest would fail as below[1]. After investigation, I noticed that this failure was caused by the different interpretation for pattern "y" between ICU and RI. In ICU spec, it explicitly mentioned "ICU interprets a single 'y' differently than Java." As ICU's behavior doesn't comply with the Java spec, it results in the Harmony defect in fact. Luckily, I've got a fix by doing a trick to solve this issue.

      [1] Failure trace:
      junit.framework.AssertionFailedError: Incorrect year 2000 expected:<2000> but was:<2>
      at junit.framework.Assert.fail(Assert.java:47)
      at junit.framework.Assert.failNotEquals(Assert.java:277)
      at junit.framework.Assert.assertEquals(Assert.java:64)
      at junit.framework.Assert.assertEquals(Assert.java:195)
      at org.apache.harmony.text.tests.java.text.SimpleDateFormatTest.test_set2DigitYearStartLjava_util_Date(SimpleDateFormatTest.java:797)
      at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:25)
      at java.lang.reflect.Method.invoke(Method.java:258)
      at junit.framework.TestCase.runTest(TestCase.java:164)
      at junit.framework.TestCase.runBare(TestCase.java:130)
      at junit.framework.TestResult$1.protect(TestResult.java:110)
      at junit.framework.TestResult.runProtected(TestResult.java:128)
      at junit.framework.TestResult.run(TestResult.java:113)
      at junit.framework.TestCase.run(TestCase.java:120)
      at junit.framework.TestSuite.runTest(TestSuite.java:228)
      at junit.framework.TestSuite.run(TestSuite.java:223)
      at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

        Attachments

        1. HARMONY-6181_V2.diff
          2 kB
          Jim Yu
        2. HARMONY-6181.diff
          0.8 kB
          Jim Yu

          Activity

            People

            • Assignee:
              tellison Tim Ellison
              Reporter:
              junjie0122 Jim Yu
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified