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

DecimalFormat bug added in 1.1.6

XMLWordPrintable

    • b01
    • generic, x86, sparc
    • generic, solaris_2.5, windows_95, windows_nt
    • Not verified



        Name: el35337 Date: 05/01/98


        import java.text.*;

        /*
        JDK 1.1.6 Bug, did NOT occur in 1.1.5
        Possibly related to bug 4125885.

        This class demonstrates a regression in version 1.1.6
        of DecimalFormat class.

        1.1.6 Results
        Value 1.2 Format #.00 Result '01.20' !!!wrong
        Value 1.2 Format 0.00 Result '001.20' !!!wrong
        Value 1.2 Format 00.00 Result '0001.20' !!!wrong
        Value 1.2 Format #0.0# Result '1.2'
        Value 1.2 Format #0.00 Result '001.20' !!!wrong

        1.1.5 Results
        Value 1.2 Format #.00 Result '1.20'
        Value 1.2 Format 0.00 Result '1.20'
        Value 1.2 Format 00.00 Result '01.20'
        Value 1.2 Format #0.0# Result '1.2'
        Value 1.2 Format #0.00 Result '1.20'
        */

        public class JDK116Bug
        {
          public static void main(String[] args)
          {
            show(1.2, "#.00");
            show(1.2, "0.00");
            show(1.2, "00.00");
            show(1.2, "#0.0#");
            show(1.2, "#0.00");
          }
          
          private static void show(double d, String s)
          {
            String result = new DecimalFormat(s).format(d);
            System.out.println("Value " + d + " Format " + s
               + " Result '" + result + "'");
          }
        }
        (Review ID: 29357)
        ======================================================================

              aliusunw Alan Liu (Inactive)
              elarsen Erik Larsen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: