Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8040058

IsoFields.WEEK_BASED_YEAR adjustInto incorrect

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b11

      Backports

        Description

        The implementation of IsoFields.WEEK_BASED_YEAR is completely invalid. As a result, addition using WEEK_BASED_YEARS is broken.

        Given an input date 2012-W30-6 setting the week-based-year should only change the year and leave the week and day-of-week unaltered (except where week 53 becomes week 52). The current implementation does not achieve this.

        In addition, the current code does not reset back to the input temporal, which results in JDK-8038490.

        Sadly, this code managed to make it into the JDK with no tests, which also needs addressing.
        1. FixIsoFieldsWeekBasedYear.patch
          14 kB
          Stephen Colebourne
        2. FixWeekFieldsWOWBYRange.patch
          2 kB
          Stephen Colebourne

          Issue Links

            Activity

            Hide
            scolebourne Stephen Colebourne added a comment -
            Patch to solve the issue
            Show
            scolebourne Stephen Colebourne added a comment - Patch to solve the issue
            Hide
            scolebourne Stephen Colebourne added a comment -
            A related issue is that WeekFields.weekOfWeekBasedYear().range should return 1 to 52/53 but does not. The second patch fixes this related issue and should be applied on top of the first patch.
            Show
            scolebourne Stephen Colebourne added a comment - A related issue is that WeekFields.weekOfWeekBasedYear().range should return 1 to 52/53 but does not. The second patch fixes this related issue and should be applied on top of the first patch.
            Hide
            rriggs Roger Riggs added a comment -
            Verifying and applying patches provided by scolebourne.
            Show
            rriggs Roger Riggs added a comment - Verifying and applying patches provided by scolebourne.
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/ea141745e90d
            User: rriggs
            Date: 2014-04-19 15:38:34 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/ea141745e90d User: rriggs Date: 2014-04-19 15:38:34 +0000
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/ea141745e90d
            User: lana
            Date: 2014-04-30 20:10:04 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/ea141745e90d User: lana Date: 2014-04-30 20:10:04 +0000

              People

              • Assignee:
                rriggs Roger Riggs
                Reporter:
                scolebourne Stephen Colebourne
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: