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

SimpleDateFormat.parse accepts invalid date string

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.1.2
    • 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 - ###@###.###
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: