Bug #32119 NullPointerException when no "good" default timezone is found
Submitted: 5 Nov 2007 16:02 Modified: 7 Aug 2008 15:51
Reporter: Monty Taylor Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Enterprise Monitor: Web Severity:S3 (Non-critical)
Version:2.0 OS:Linux (Ubuntu)
Assigned to: Mark Matthews CPU Architecture:Any

[5 Nov 2007 16:02] Monty Taylor
Description:
On ubuntu gutsy, when I try to log in for the first time, I get the following exception. Upon further exploration, it seems this is caused by: 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6456628

In short, on ubuntu nothing sets the TZ environment variable. Ubuntu stores this information in /etc/timezone, but Java does not check this, so java gets the wrong default timezone info. 

java.lang.NullPointerException at com.mysql.merlin.ui.actions.monitor.dashboard.FirstRunInfo.execute(FirstRunInfo.java:13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:167) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at com.mysql.merlin.ui.interceptors.InitializeInterceptor.intercept(InitializeInterceptor.java:57) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at com.mysql.merlin.ui.interceptors.AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:92) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:507) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685) at java.lang.Thread.run(Thread.java:595)

How to repeat:
Install on ubuntu gutsy

Suggested fix:
A simple workaround is to set the TZ environment variable in the startup script. However, this is a little fragile. More proactive checking of /etc/timezone would be nicer. 

Also, checking for the condition in the UI code and not throwing a NullPointerException would probably be good.
[13 Nov 2007 18:25] Joshua Ganderson
patch sent to protect against this issue
[14 Nov 2007 19:02] Sloan Childers
I've asked Monty Taylor to test this patch to see if it fixes his problem.
[27 Nov 2007 3:00] Sloan Childers
Monty ran several tests for me all which failed.  Gary needs to approve the untested patch which has no unit tests to verify behavior or defer the issue to 2.0.
[28 Nov 2007 18:55] Joshua Ganderson
My patch included new unit tests to verify that an "invalid" timezone did not cause an exception and added a matching zone to our list. See "testGetUserTimezoneNoMatch" and "testGetTimeZoneOptionsInvalid".

Was there any feedback on the failures?
[28 Nov 2007 20:38] Gary Whizin
waiting for feedback from monty...
[4 Dec 2007 21:10] Joshua Ganderson
Custom build provided to Monty to test at https://intranet.mysql.com/~jganderson/downloads/merlin.war
[19 Dec 2007 19:05] Joshua Ganderson
r8650 - Per Mark, adding unknown timezone protection in despite not hearing back from Monty on whether the fix works for his situation. Note that there is contention on timezone handling for the 2.0 project and this fix may not make it into that release.

I doubt this could be tested on windows, a good test would be to run on a system that can have a timezone of GMT -8 set.
[17 Apr 2008 0:30] Joshua Ganderson
Since Sloan changed this to display all timezones available to the system, this should not be an issue in 2.0.
[7 Aug 2008 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".