[Fmt-Ch] Invalid code in java.text.ChoiceFormat.applyPattern(String)

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 6
    • Affects Version/s: 6
    • Component/s: core-libs
    • b43
    • x86
    • windows_xp



      Name: js151677 Date: 07/29/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      In java.text.ChoiceFormat

      The method

          public void applyPattern(String newPattern) {

      does the following on line 184

                      if (segments[0].equals("")) {
                          throw new IllegalArgumentException();

      But segments[0] is a StringBuffer, and so this test will always be false, as StringBuffer doesn't override equals.

      I'm assuming you want

                      if (segments[0].length() == 0) {
                          throw new IllegalArgumentException();



      REPRODUCIBILITY :
      This bug can be reproduced always.
      (Incident Review ID: 290249)
      ======================================================================

            Assignee:
            Yuka Kamiya (Inactive)
            Reporter:
            Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: