-
Defect
-
Resolution: Done
-
Major
-
1.3.0-M2
-
None
For some reason the SecurityContextHolder is not returning the correct security context in the ExceptionFilter.
Perhaps because of the placement of the ExceptionFilter in the filter chain the SecurityContext is already removed from the thread local?
2011-03-23 13:55:41,801 sgf.gateway.web.filters.exception.UnhandledExceptionFilter [ERROR]: This exception occurred reporting an unhandled exception, please see the 'cause by' exception above
java.lang.NullPointerException
at sgf.gateway.service.security.impl.acegi.AcegiRuntimeUserServiceImpl.getUser(AcegiRuntimeUserServiceImpl.java:63)
at sgf.gateway.service.security.impl.acegi.AcegiRuntimeUserServiceImpl.getUser(AcegiRuntimeUserServiceImpl.java:42)
at sgf.gateway.web.filters.exception.UnhandledExceptionFilter.getUserDescription(UnhandledExceptionFilter.java:200)
at sgf.gateway.web.filters.exception.UnhandledExceptionFilter.setupExceptionDetails(UnhandledExceptionFilter.java:182)
at sgf.gateway.web.filters.exception.UnhandledExceptionFilter.reportException(UnhandledExceptionFilter.java:157)
at sgf.gateway.web.filters.exception.UnhandledExceptionFilter.doHandleException(UnhandledExceptionFilter.java:141)
at sgf.gateway.web.filters.exception.UnhandledExceptionFilter.handleException(UnhandledExceptionFilter.java:114)
at sgf.gateway.web.filters.exception.UnhandledExceptionFilter.doFilter(UnhandledExceptionFilter.java:92)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
Perhaps because of the placement of the ExceptionFilter in the filter chain the SecurityContext is already removed from the thread local?
2011-03-23 13:55:41,801 sgf.gateway.web.filters.exception.UnhandledExceptionFilter [ERROR]: This exception occurred reporting an unhandled exception, please see the 'cause by' exception above
java.lang.NullPointerException
at sgf.gateway.service.security.impl.acegi.AcegiRuntimeUserServiceImpl.getUser(AcegiRuntimeUserServiceImpl.java:63)
at sgf.gateway.service.security.impl.acegi.AcegiRuntimeUserServiceImpl.getUser(AcegiRuntimeUserServiceImpl.java:42)
at sgf.gateway.web.filters.exception.UnhandledExceptionFilter.getUserDescription(UnhandledExceptionFilter.java:200)
at sgf.gateway.web.filters.exception.UnhandledExceptionFilter.setupExceptionDetails(UnhandledExceptionFilter.java:182)
at sgf.gateway.web.filters.exception.UnhandledExceptionFilter.reportException(UnhandledExceptionFilter.java:157)
at sgf.gateway.web.filters.exception.UnhandledExceptionFilter.doHandleException(UnhandledExceptionFilter.java:141)
at sgf.gateway.web.filters.exception.UnhandledExceptionFilter.handleException(UnhandledExceptionFilter.java:114)
at sgf.gateway.web.filters.exception.UnhandledExceptionFilter.doFilter(UnhandledExceptionFilter.java:92)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)