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

java.text.DecimalFormat.applyPattern doesn't set minimum integer digits

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1.6
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Verified

      Backports

        Description



        Name: avC70361 Date: 12/29/97



        The java.text.DecimalFormat.applyPattern(String pattern) doesn't set minimum
        integer digits correctly. For example, when applying "#,##0" pattern minimum
        integer digits should be equal to 1, but getMinimumIntegerDigits() returns 0.

        Here is the test demonstrating the bug.
        ---------Test.java------------------------
        import java.text.*;
        public class Test {
            public static void main (String args[]){
                DecimalFormat sdf = new DecimalFormat();
                String pattern = "#,##0";
                System.out.println("Applying pattern " + pattern);
                sdf.applyPattern(pattern);
                System.out.println("Minimum integer digits : " +sdf.getMinimumIntegerDigits());
                System.out.println("Pattern :" + sdf.toPattern());
            }
        }
        ----------The output from the test--------
        #> java Test
        Applying pattern #,##0
        Minimum integer digits : 0
        Pattern :#,###
        ------------------------------------------
        ======================================================================

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                joconnersunw John Oconner (Inactive)
                Reporter:
                ovlasov Oleksandr Vlasov (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: