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

java.text.DecimalFormat.parse() fails when multiplier is not set to 1

XMLWordPrintable

    • 1.1.6
    • sparc
    • solaris_2.5
    • Verified



        Name: dfC67450 Date: 11/13/97



        java.text.DecimalFormat.parse(String text, ParsePosition pp) incorrectly parses
        Long.MIN_VALUE if multiplier is not set to 1.
         
        Here is the test demonstrating the bug:

        -----------------TestP.java------------------------
        import java.text.*;

        public class TestP {
            public static void main (String args[]){
                DecimalFormat df = new DecimalFormat();
                String str = Long.toString(Long.MIN_VALUE);
                System.out.println(df.parse(str, new ParsePosition(0)));
                df.setMultiplier(100);
                System.out.println(df.parse(str, new ParsePosition(0)));
            }
        }
        ---------Output from the test---------------------
        -9223372036854775808
        9.223372036854776E16
        --------------------------------------------------

        ======================================================================

              joconnersunw John Oconner (Inactive)
              dfazunensunw Dmitri Fazunenko (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: