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

Missing @throws in DateTimeFormatterBuilder.appendInstant

    Details

    • Subcomponent:
    • Resolved In Build:
      b50

      Backports

        Description

        The method DateTimeFormatterBuilder.appendInstant(int) can throw an exception that is not properly specified. The current spec implies an exception by defining the accepted values as follows: "Specifying zero will cause no fractional digits to be output. From 1 to 9 will output an increasing number of digits, using zero right-padding if necessary. The special value -1 is used to output as many digits as necessary to avoid any trailing zeroes.", however there is no @throws clause. Use of IllegalArgumentException is implied from other similar methods on the class.

        Fix proposed as follows:

             * @param fractionalDigits the number of fractional second digits to format with,
             * from 0 to 9, or -1 to use as many digits as necessary
             * @return this, for chaining, not null
             * @throws IllegalArgumentException if the number of fractional digits is invalid
             */
            public DateTimeFormatterBuilder appendInstant(int fractionalDigits) {

        (around line 854)

        While fixing this issue, the leap second time should be fixed in the Javadoc of the same method. It is currently "23:59:59" but it should be "23:59:60". (The leap second time is a known fact, thus the Javadoc is simply wrong, and this is not a spec change).

          Activity

          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/bd4d6a62e1fd
          User: rriggs
          Date: 2015-01-30 21:17:52 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/bd4d6a62e1fd User: rriggs Date: 2015-01-30 21:17:52 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/bd4d6a62e1fd
          User: lana
          Date: 2015-02-11 23:06:32 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/bd4d6a62e1fd User: lana Date: 2015-02-11 23:06:32 +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: