SimpleDateFormat.parse accepts invalid date string

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P4
    • None
    • Affects Version/s: 1.1.2
    • Component/s: core-libs
    • x86
    • windows_nt



      Name: tb29552 Date: 06/25/97


      SimpleDateFormat("dd/MM/yyyy").parse(...) accepts invalid
      input strings (e.g. "35/01/1971") without raising an exception.

      Sample program:

      import java.text.*;
      import java.util.*;

      public class DateFormatBug {

      public static void main(String [] args) {
        try {
          System.out.println(new SimpleDateFormat("dd/MM/yyyy").parse("35/01/1971").toString());
        } catch (ParseException e) {
          System.out.println("Exception: " + e);
        }
      }
      }

      Console output:
      Thu Feb 04 03:00:00 EST 1971


      company - Footprint Software Inc. , email - ###@###.###
      ======================================================================

            Assignee:
            Alan Liu (Inactive)
            Reporter:
            Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: