Project: bamboo
Issue BAM-8957: Strange errors with disappearing OAuth consumers on JBAC when talking to JDOG
So I was trying to make some gadgets work on JDOG. I was getting the "Login & Approve" button on JDOG. I clicked it and got redirected to JBAC where I approved access. Once back in JDOG I'd still get the Login & Approve button. I tried to then reduce the JDOG OAuth consumer from JBAC but when I clicked delete I'd get an error popup with something along the lines of 'Failed to remove OAuth consumer. I tried this several times with the same result. Refreshed the page and the consumer was still there. I then visited https://jira.bamboo.atlassian.com/plugins/servlet/oauth/users/access-tokens to look at my access tokens but got this: {noformat} com.atlassian.templaterenderer.RenderingException: java.lang.NullPointerException: consumer com.atlassian.templaterenderer.velocity.one.six.internal.VelocityTemplateRendererImpl.render(VelocityTemplateRendererImpl.java:99) sun.reflect.GeneratedMethodAccessor2870.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58) org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56) org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) $Proxy208.render(Unknown Source) com.atlassian.oauth.serviceprovider.internal.servlet.user.AccessTokensServlet.doGet(AccessTokensServlet.java:60) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) com.atlassian.plugin.servlet.DelegatingPluginServlet.service(DelegatingPluginServlet.java:42) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) com.atlassian.plugin.servlet.ServletModuleContainerServlet.service(ServletModuleContainerServlet.java:52) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66) com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25) com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118) com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) com.atlassian.bamboo.filter.AccessLogFilter.doFilter(AccessLogFilter.java:66) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265) org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) com.atlassian.bamboo.filter.SeraphLoginFilter.doFilter(SeraphLoginFilter.java:74) org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149) org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98) com.atlassian.bamboo.filter.BambooAcegiProxyFilter.doFilter(BambooAcegiProxyFilter.java:25) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) com.atlassian.bamboo.filter.LicenseFilter.doFilter(LicenseFilter.java:73) com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) com.atlassian.johnson.filters.AbstractJohnsonFilter.doFilter(AbstractJohnsonFilter.java:71) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:211) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:150) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66) com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:71) com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42) com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66) com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:98) com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:170) com.atlassian.bamboo.persistence.BambooSessionInViewFilter.doFilterInternal(BambooSessionInViewFilter.java:31) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77) com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200) org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283) org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773) org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703) org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895) org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685) java.lang.Thread.run(Thread.java:662) Caused by: java.lang.NullPointerException: consumer com.atlassian.oauth.util.Check.notNull(Check.java:37) com.atlassian.oauth.Token$TokenBuilder.consumer(Token.java:178) com.atlassian.oauth.serviceprovider.sal.PluginSettingsServiceProviderTokenStore.get(PluginSettingsServiceProviderTokenStore.java:92) com.atlassian.oauth.serviceprovider.sal.PluginSettingsServiceProviderTokenStore$KeyToToken.apply(PluginSettingsServiceProviderTokenStore.java:232) com.atlassian.oauth.serviceprovider.sal.PluginSettingsServiceProviderTokenStore$KeyToToken.apply(PluginSettingsServiceProviderTokenStore.java:221) com.google.common.collect.Iterators$8.next(Iterators.java:751) org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:346) org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175) org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87) org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336) org.apache.velocity.Template.merge(Template.java:328) org.apache.velocity.Template.merge(Template.java:235) com.atlassian.templaterenderer.velocity.one.six.internal.VelocityTemplateRendererImpl.render(VelocityTemplateRendererImpl.java:90)	... 113 more {noformat} When I went back to the Oauth consumers page the consumer was gone. I re-added it and now https://jira.bamboo.atlassian.com/plugins/servlet/oauth/users/access-tokens works again. I can also get the gadgets to authenticate. Very weird I know and not the best of bug reports but it happend :).
Story points: 3