We're updating the issue view to help you get more done. 

Null pointer exception in TimeZone class initialization when default TimeZone not found

Description

On the Solaris 7 box I'm working on the TimeZone environment variable is set as
"TZ=Canada/Pacific". When the class loader loads the TimeZone class a null
pointer exception is thrown. It appears that the default time zone is not found
and the fallback in TimeZone.getTimeZone() is to use GMT, but the static GMT
variable has not been initialized yet. I can fix the problem by specifying a
different timezone, but I still wouldn't expect a crash in this situation.

My sample app:
import com.ibm.icu.util.TimeZone;
public class icutest {
static public void main(String[] args) {
TimeZone GMT = TimeZone.getTimeZone("GMT");
}
}

The resulting stack trace:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.ibm.icu.util.TimeZone.<clinit>(TimeZone.java:567)
at icutest.main(icutest.java:10)
Caused by: java.lang.NullPointerException
at com.ibm.icu.util.TimeZone.getTimeZone(TimeZone.java:350)
at com.ibm.icu.util.TimeZone.getDefault(TimeZone.java:494)
at com.ibm.icu.util.GregorianCalendar.<init>(GregorianCalendar.java:365)
at com.ibm.icu.util.SimpleTimeZone.<clinit>(SimpleTimeZone.java:927)
... 2 more

Environment

Status

Assignee

TracBot

Reporter

TracBot

Labels

tracCreated

Nov 21, 2002, 1:05 AM

tracOwner

alan

tracProject

ICU4C,ICU4J and ICU4JNI

tracReporter

david.mosimann@976a4a25fe92c4b5

tracResolution

fixed

tracReviewer

syn wee

tracStatus

closed

Components

Fix versions

Priority

blocker