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

DateFormat does not mention IllegalArgumentException for invalid style args

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 22
    • core-libs
    • None
    • behavioral
    • minimal
    • None, simply a specification update.
    • Java API
    • SE

    Description

      Summary

      Make IllegalArgumentException apparent for the DateFormat factory methods in the specification.

      Problem

      The DateFormat static factory methods throw an IllegalArgumentException if the style parameter is less than 0 (FULL) or greater than 3 (SHORT). This is not specified in the class description or method descriptions.

      Solution

      There are a number of static factory methods that take the style parameter. To avoid redundancy, introduce a sentence in the class description to make this behavior apparent (as opposed to each method).

      Specification

      In the class description,

      - * <p>{@code DateFormat} provides many class methods for obtaining default date/time
      + * <p>{@code DateFormat} provides static factory methods for obtaining default date/time
        * formatters based on the default or a given locale and a number of formatting
      - * styles. The formatting styles include {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, and {@link #SHORT}. More
      - * detail and examples of using these styles are provided in the method
      + * styles. The formatting styles include {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, and {@link #SHORT}.
      + * For any of the factory methods with the parameter <i>style</i>, an {@code
      + * IllegalArgumentException} will be thrown if <i>style</i> is not equal to any
      + * of the defined formatting styles. More detail and examples of using these styles are provided in the method
        * descriptions.
        *

      Attachments

        Issue Links

          Activity

            People

              jlu Justin Lu
              webbuggrp Webbug Group
              Naoto Sato
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: