-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.2
-
x86
-
windows_2000
FULL PRODUCT VERSION :
1.4.x
ADDITIONAL OS VERSION INFORMATION :
win2ksp4
A DESCRIPTION OF THE PROBLEM :
SimpleDateFormat.setTimeZone(TimeZone) (or perhaps some base class) does not throw a NPE if a null is passed in.
This may create difficult to trace / ambiguous NPEs at a later time, such as in the exmaple of calling DateFormat.format():
java.lang.NullPointerException
at java.util.GregorianCalendar.computeFieldsImpl(GregorianCalendar.java:1321)
at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:1298)
at java.util.Calendar.setTimeInMillis(Calendar.java:927)
at java.util.Calendar.setTime(Calendar.java:902)
at java.text.SimpleDateFormat.format(SimpleDateFormat.java:782)
at java.text.SimpleDateFormat.format(SimpleDateFormat.java:775)
at java.text.DateFormat.format(DateFormat.java:314)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Pass a null to SimpleDateFormat.setTimeZone; no Exception is thrown.
REPRODUCIBILITY :
This bug can be reproduced always.
1.4.x
ADDITIONAL OS VERSION INFORMATION :
win2ksp4
A DESCRIPTION OF THE PROBLEM :
SimpleDateFormat.setTimeZone(TimeZone) (or perhaps some base class) does not throw a NPE if a null is passed in.
This may create difficult to trace / ambiguous NPEs at a later time, such as in the exmaple of calling DateFormat.format():
java.lang.NullPointerException
at java.util.GregorianCalendar.computeFieldsImpl(GregorianCalendar.java:1321)
at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:1298)
at java.util.Calendar.setTimeInMillis(Calendar.java:927)
at java.util.Calendar.setTime(Calendar.java:902)
at java.text.SimpleDateFormat.format(SimpleDateFormat.java:782)
at java.text.SimpleDateFormat.format(SimpleDateFormat.java:775)
at java.text.DateFormat.format(DateFormat.java:314)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Pass a null to SimpleDateFormat.setTimeZone; no Exception is thrown.
REPRODUCIBILITY :
This bug can be reproduced always.
- duplicates
-
JDK-4651757 API: Calendar.setTime() throws NullPointerException with a null TimeZone
- Closed