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

ValueRange.of(long, long, long) does not throw IAE on invalid inputs

    XMLWordPrintable

Details

    • CSR
    • Status: Closed
    • P4
    • Resolution: Approved
    • 15
    • core-libs
    • None
    • behavioral
    • low
    • IAE is now correctly thrown when (smallest) minimum is greater than smallest maximum. Applications that incorrectly set values for ValueRange will see this exception.
    • Java API
    • SE

    Description

      Summary

      java.time.temporal.ValueRange.of(long, long, long) should throw an InvalidArgumentException on invalid inputs. Similarly of(long, long, long, long) method should throw IAE appropriately.

      Problem

      of(min, maxSmallest, maxLargest) does not throw an IAE when min is greater than maxSmallest even though it is specified in the method description. The four-argument overload method also has this issue, as well as it lacks the IAE condition for "minSmallest > minLargest" on which the implementation is throwing the exception.

      Solution

      • of(min, maxSmallest, maxLargest) should throw an IAE when min is greater than maxSmallest.
      • of(minSmallest, minLargest, maxSmallest, maxLargest) should throw an IAE when minSmallest is greater than maxSmallest.
      • The method description for of(minSmallest, minLargest, maxSmallest, maxLargest) should describe the IAE condition for minSmallest is greater than minLargest.

      Specification

      The @throws clause in the method description for java.time.temporal.ValueRange.of(long, long, long, long) should change from:

        * @throws IllegalArgumentException if
        *     the smallest minimum is greater than the smallest maximum,
        *  or the smallest maximum is greater than the largest maximum
        *  or the largest minimum is greater than the largest maximum

      to:

       * @throws IllegalArgumentException if
       *     the smallest minimum is greater than the smallest maximum,
       *  or the smallest maximum is greater than the largest maximum,
       *  or the largest minimum is greater than the largest maximum,
       *  or the smallest minimum is greater than the largest minimum

      Attachments

        Issue Links

          There are no Sub-Tasks for this issue.

          Activity

            People

              naoto Naoto Sato
              webbuggrp Webbug Group
              Roger Riggs
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: