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

LocalDate.ofEpochDay input validation

XMLWordPrintable

    • b130

      The boundaries of LocalDate.ofEpochDay(long) are not correctly checked. In addition, the boundaries specified by ChronoField.EPOCH_DAY are wrong.

      The following line must be added as the first line of LocalDate.ofEpochDay(long):

      EPOCH_DAY.checkValidValue(epochDay);

      The declaration of ChronoField.EPOCH_DAY must be changed to the following:

      EPOCH_DAY("EpochDay", DAYS, FOREVER, ValueRange.of(-365243219162L, 365241780471L)),

      Tests should be added to ensure that an exception is thrown when ofEpochDay() is invoked with an out of range value.

            ntv Nadeesh Tv
            scolebourne Stephen Colebourne
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: