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

[Fmt-Nu] DecimalFormat.applyPattern("##.##") is allowed

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5

      Description



      Name: saC57035 Date: 07/08/99



      Javadoc says:
      ----------------------
      pattern := subpattern{;subpattern}
       subpattern := {prefix}integer{.fraction}{suffix}
       prefix := '\\u0000'..'\\uFFFD' - specialCharacters
       suffix := '\\u0000'..'\\uFFFD' - specialCharacters
       integer := '#'* '0'* '0'
       ...
      Illegal patterns, such as "#.#.#" or mixing '_' and '*' in the same pattern,
      will cause an IllegalArgumentException to be thrown. From the message of
      IllegalArgumentException
      ----------------------
      So integer part of pattern have to contain at least one '0' special
      character and trying to apply pattern "##.##" should throw
      IllegalArgumentException
      jdk1.2.2 allow to apply pattern "##.##"

      If this behavour is correct it should be reflected in specification

      ------------ Test,java
      import java.text.DecimalFormat;

      class Test {
          public static void main(String [] args) {
              new DecimalFormat().applyPattern("##.##");
              System.out.println("No Exception");
          }
      }
      ------------ Output
      No exception
      -------------
                  
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            nishjain Nishit Jain
            Reporter:
            savzan Stanislav Avzan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: