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

javadoc is unclear about digit ranges java.text.DecimalFormat.parse() uses

XMLWordPrintable

    • 1.2fcs
    • sparc
    • solaris_2.5
    • Verified



      Name: dfC67450 Date: 06/10/98



      Until jdk1.2beta2 java.text.DecimalFormat.parse(String str, ParsePosition pp) used
      one set of digit represetation: zeroDigit .. zeroDigit + 9, where zeroDigit is a
      symbol from DecimalFormatSymbols.
      Starting with jdk1.2beta3 method parse recognizes all Unicode characters with
      digit attribute as digits as well.
      This change of behaviour should be reflected in the javadoc.
       
      Here is the test demonstrating the bug:

      -----------------Test.java------------------------
      import java.text.*;

      public class Test {
          public static void main (String args[]){
            DecimalFormatSymbols dfs = new DecimalFormatSymbols(java.util.Locale.ENGLISH);
            dfs.setZeroDigit('n');
            DecimalFormat df = new DecimalFormat("#,##0", dfs);
            System.out.println("parse(0) : " + df.parse("0", new ParsePosition(0)));
          }
      }
      ---------Output from the test (JDK1.2-Beta2)---------------------
      parse(0) : null
      ---------Output from the test (JDK1.2-Beta3)---------------------
      parse(0) : 0
      --------------------------------------------------

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

            dgreensunw Dale Green (Inactive)
            dfazunensunw Dmitri Fazunenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: