NumberFormat.parse doesn't return null

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P3
    • None
    • Affects Version/s: 1.2.0
    • Component/s: core-libs
    • generic
    • generic



      Name: bb33257 Date: 02/23/98


      The javadoc says that if NumberFormat.parse(String, ParsePosition)
      fails, it will return null. However, instead it is returning
      new Long(0) (or something like that).

      import java.text.*;

      public class Bug {
              public static void main(String[] args) {
                      NumberFormat format = NumberFormat.getInstance();
                      String text = "time 10:x";
                      ParsePosition pos = new ParsePosition(8);
                      Number result = format.parse(text, pos);
                      System.out.println(result); // Should be null; it isn't
              }
      }
      ======================================================================

            Assignee:
            J. Duke
            Reporter:
            Brian Beck (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: