JDK-4061287 : SimpleDateFormat.parse accepts invalid date string
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 1.1.2
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1997-06-25
  • Updated: 1998-02-17
  • Resolved: 1998-02-17
Related Reports
Relates :  
Description

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 - ###@###.###
======================================================================

Comments
EVALUATION User error; use setLenient() to control whether out-of-range fields are allowed or not. -asl
11-06-2004

WORK AROUND Name: tb29552 Date: 06/25/97 ======================================================================
11-06-2004