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

[Fmt-*] Doc: Inconsistencies in handling of null FieldPosition in Format and subclasses

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 5.0
    • Fix Version/s: 9
    • Component/s: core-libs
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      java.text.Format and its subclasses in java.text have format methods that accept FieldPosition arguments. The specifications and implementations disagree on the behavior resulting when a NullPointerException is passed in:

      Format.format(Object, StringBuffer, FieldPosition):
      specification: NPE; no implementation

      DateFormat.format(Object, StringBuffer, FieldPosition):
      specification: unspecified; implementation: pass-through

      DateFormat.format(Date, StringBuffer, FieldPosition):
      specification: unspecified; no implementation

      SimpleDateFormat.format(Date, StringBuffer, FieldPosition):
      specification: unspecified; implementation: NPE

      MessageFormat.format(Object, StringBuffer, FieldPosition):
      specification: unspecified; implementation: no exception

      MessageFormat.format(Object[], StringBuffer, FieldPosition):
      specification: unspecified; implementation: no exception

      NumberFormat.format(Object, StringBuffer, FieldPosition):
      specification: NPE; implementation: pass-through

      NumberFormat.format(double, StringBuffer, FieldPosition):
      specification: unspecified; no implementation

      NumberFormat.format(long, StringBuffer, FieldPosition):
      specification: unspecified; no implementation

      DecimalFormat.format(Object, StringBuffer, FieldPosition):
      specification: NPE; implementation: pass-through

      DecimalFormat.format(double, StringBuffer, FieldPosition):
      specification: unspecified; implementation: NPE

      DecimalFormat.format(long, StringBuffer, FieldPosition):
      specification: unspecified; implementation: NPE

      ChoiceFormat.format(double, StringBuffer, FieldPosition):
      specification: unspecified; implementation: no exception

      ChoiceFormat.format(long, StringBuffer, FieldPosition):
      specification: unspecified; implementation: pass-through

      The specifications and implementations need to be made consistent. Allowing null FieldPositions in general seems the best approach.
      ###@###.### 2005-03-03 02:45:20 GMT

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nishjain Nishit Jain
                Reporter:
                nlindenbsunw Norbert Lindenberg (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: