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

j.text.ChoiceFormat provides no specification on quoting behavior

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 22
    • None
    • core-libs
    • b21
    • generic
    • generic

    Description

      java.text.ChoiceFormat provides the ability to quote values within the String pattern but does not make it apparent or explain the behavior in the API docs.

      For example,

      var cf = new ChoiceFormat(" 1#'example' ");
      var otherCf = new ChoiceFormat(" 1#example ");
      cf.format(1) == otherCf.format(1); // returns true

      or

      var cf = new ChoiceFormat(" 1#'#' "); // works
      var cf = new ChoiceFormat(" 1## "); // throws an exception

      The single quotes can be used to escape the values of "#", "<", "≤" and "|" which are usually recognized as special characters by ChoiceFormat otherwise. The other Format classes such as Decimal, CompactNumber, and Message all provide specification on single quotes within a pattern; choiceFormat should as well.



      Attachments

        Issue Links

          Activity

            People

              jlu Justin Lu
              jlu Justin Lu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: