Name: stC104175 Date: 03/31/2000
java version "1.3beta"
Java(TM) 2 Runtime Environment, Standard Edition (build
Java(TM) HotSpot Client VM (build 1.3beta-O, mixed mode)
1) Just run and see.
2) a test source....
import java.text.*;
public class SDFTest
{
public static void main (String[] args)
{
String dateFormat = null;
try
{
// Note: the dateFormat is a 'null'.
// This -was- becourse it should come from a database
// and returnd a null object.
// The workaround is just build in the -normal- null
check.
SimpleDateFormat df = new SimpleDateFormat (dateFormat);
df.parse("01-01-2000");
}
catch (ParseException e)
{
System.out.println ("[SDFTest] Unparsable date");
}
catch (Exception e)
{
System.out.println ("[SDFTest] Another Exception.");
e.printStackTrace();
}
}
}
3) The error message:
c:\java\jdk1.3\bin\java.exe SDFTest
[SDFTest] Another Exception.
java.lang.NullPointerException
at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:640)
at java.text.DateFormat.parse(DateFormat.java:329)
at SDFTest.main(SDFTest.java:16)
4) Info:
This is not only -not- working on 1.3 but also on 1.1.8 and 1.2.2
5) Configuration...
On different windows (nt4) configurations this will get a nullpointer...
(Review ID: 103143)
======================================================================
- relates to
-
JDK-5061061 SimpleDateFormat: unspecified behavior for reserved pattern letter
-
- Resolved
-
-
JDK-4493297 performance regression in SimpleDateFormat.<init>
-
- Closed
-
-
JDK-4491595 java.text.SimpleDateFormat incorrectly works with patterns
-
- Closed
-