NPE in SpaceHelper borks page....

2005-10-01T17:56:44
ID ATLASSIAN:CONF-4182
Type atlassian
Reporter nickminutello
Modified 2017-02-17T05:12:31

Description

If you have a url for Space admin :

http://server.name.com/spaces/listdecorators.action?key=BP2I

And you get the space key wrong, then rather than failing gracefully, you end up with an sitemesh decoration of an empty page....

Looking at the code, you can see why: public String getSpaceName() { return action.getSpace().getName(); }

You should do a null check there....

However, thats addressing the symptom more than the cause - the action should show some kind of friendly error page rather than try and render.

Here is the stacktrace:

INFO | jvm 1 | 2005/10/01 17:41:26 | org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getSpaceName' in class com.atlassian.confluence.themes.SpaceHelper threw exception class java.lang.NullPointerException : null INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:188) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:226) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:207) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:250) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:94) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:109) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:271) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.directive.Parse.render(Parse.java:232) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:153) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:271) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.Template.merge(Template.java:296) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.util.VelocityUtils.getRenderedTemplateWithoutSwallowingErrors(VelocityUtils.java:47) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.util.VelocityUtils.getRenderedTemplate(VelocityUtils.java:33) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:224) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:153) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:271) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:215) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:153) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:94) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.ASTElseIfStatement.render(ASTElseIfStatement.java:118) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:128) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:271) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.Template.merge(Template.java:296) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.util.VelocityUtils.getRenderedTemplateWithoutSwallowingErrors(VelocityUtils.java:47) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.util.VelocityUtils.getRenderedTemplate(VelocityUtils.java:33) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:224) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:153) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:271) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.velocity.Template.merge(Template.java:296) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.webwork.dispatcher.VelocityResult.doExecute(VelocityResult.java:91) INFO | jvm 1 | 2005/10/01 17:41:26 | at bucket.util.profiling.ProfiledVelocityResult.doExecute(ProfiledVelocityResult.java:18) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.webwork.dispatcher.WebWorkResultSupport.execute(WebWorkResultSupport.java:116) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:263) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:187) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor.intercept(DefaultWorkflowInterceptor.java:55) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.core.ConfluenceWorkflowInterceptor.intercept(ConfluenceWorkflowInterceptor.java:33) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.core.ConfluenceValidationInterceptor.intercept(ConfluenceValidationInterceptor.java:16) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.security.actions.PermissionCheckInterceptor.intercept(PermissionCheckInterceptor.java:40) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.pages.actions.PageAwareInterceptor.intercept(PageAwareInterceptor.java:87) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.core.ConfluenceAutowireInterceptor.intercept(ConfluenceAutowireInterceptor.java:25) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.util.XWorkTransactionInterceptor.intercept(XWorkTransactionInterceptor.java:133) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:115) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.webwork.dispatcher.ServletDispatcher.serviceAction(ServletDispatcher.java:229) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:199) INFO | jvm 1 | 2005/10/01 17:41:26 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.util.profiling.ProfilingPageFilter.parsePage(ProfilingPageFilter.java:150) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:168) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.seraph.filter.LoginFilter.doFilter(LoginFilter.java:181) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.johnson.filters.JohnsonFilter.doFilter(JohnsonFilter.java:96) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:170) INFO | jvm 1 | 2005/10/01 17:41:26 | at bucket.custom.FlushingSpringSessionInViewFilter.doFilterInternal(FlushingSpringSessionInViewFilter.java:31) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:73) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.util.profiling.filters.ProfilingFilter.doFilter(ProfilingFilter.java:132) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.confluence.util.error.ProfilingAndErrorFilter.doFilter(ProfilingAndErrorFilter.java:27) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.core.filters.gzip.GzipFilter.doFilter(GzipFilter.java:61) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) INFO | jvm 1 | 2005/10/01 17:41:26 | at com.atlassian.core.filters.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:36) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571) INFO | jvm 1 | 2005/10/01 17:41:26 | at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644) INFO | jvm 1 | 2005/10/01 17:41:26 | at java.lang.Thread.run(Thread.java:534)