Dateformatter.parse does not seem to check the invalid date string.
REPRODUCE:
1) compile the attached program (test_format.java)
2) invoke the attached .bat file(exec_test_format.bat)
You will see the following messages 2st.
This is correct case.
c:\temp> java test_format "2004/12/07 11:15:30"
Tue Dec 07 11:15:30 JST 2004
Tue Dec 07 11:15:30 JST 2004
Then you will see the results of invalid date string cases.
c:\temp> java test_format "2004/12/07 11:15:3b"
Tue Dec 07 11:15:03 JST 2004
Tue Dec 07 11:15:03 JST 2004
c:\temp> java test_format "2004/12/07 11:15:3b1"
Tue Dec 07 11:15:03 JST 2004
Tue Dec 07 11:15:03 JST 2004
Even if we set the invalid date string like "2004/12/07 11:15:3b",
The invalid portin of string("3b" and "3b1") seems parsed as "03".
Such invalid string shoule be checked and VM should notify by an exception or
message.
CONFIGURATION :
- JRE : 1.3.1_12/1.4.2_06/5.0fcs/6.0b14
- OS : WindowsXP(SP1, Japanese)
###@###.### 2004-12-09 06:05:34 GMT