Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
Name: rmT116609 Date: 03/02/2004 FULL PRODUCT VERSION : java version "1.4.1_01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01) Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode) java version "1.4.2" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28) Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode) FULL OS VERSION : Microsoft Windows 2000 [Version 5.00.2195] A DESCRIPTION OF THE PROBLEM : According to the API documents of above JDK versions, the static method java.sql.Timestamp.valueOf() should take only JDBC timestamp escape format which is yyyy-mm-dd hh:mm:ss.fffffffff. It throws an IllegalArgumentException if the given argument does not have the format yyyy-mm-dd hh:mm:ss.fffffffff. In my test with the above versions, I used an invalid argument format "05-2003-02 0:0:0.0". The expected IllegalArgumentException was not thrown. Instead, the invalid argument was converted to a Timestamp with a String value equals "0171-11-02 00:00:00.0" under JDK version "1.4.1_01" and "171-11-02 00:00:00.0" under JDK version "1.3.1_06". STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Compile the source code provided below and run under either JDK version "1.4.1_01" or JDK version "1.3.1_06". EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - An IllegalArgumentException is expected to be thrown. ACTUAL - The invalid argument used was converted to a Timestamp with a String value equals "0171-11-02 00:00:00.0" under JDK version "1.4.1_01" and "171-11-02 00:00:00.0" under JDK version "1.3.1_06". REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public class TestTimestamp { public static void main(java.lang.String[] args) { System.out.println(java.sql.Timestamp.valueOf("05-2003-02 0:0:0.0")); } } ---------- END SOURCE ---------- (Incident Review ID: 190668) ======================================================================
|