Perform null check on super.getAsyncContext()

Fixes gh-3780
This commit is contained in:
Rob Winch 2016-04-01 09:51:44 -05:00
parent 14fb2276e2
commit d900c78f11
2 changed files with 9 additions and 0 deletions

View File

@ -177,6 +177,9 @@ final class HttpServlet3RequestFactory implements HttpServletRequestFactory {
public AsyncContext getAsyncContext() {
AsyncContext asyncContext = super.getAsyncContext();
if (asyncContext == null) {
return null;
}
return new SecurityContextAsyncContext(asyncContext);
}

View File

@ -300,6 +300,12 @@ public class SecurityContextHolderAwareRequestFilterTests {
this.logoutHandler);
}
// gh-3780
@Test
public void getAsyncContextNullFromSuper() throws Exception {
assertThat(wrappedRequest().getAsyncContext()).isNull();
}
@Test
public void getAsyncContextStart() throws Exception {
ArgumentCaptor<Runnable> runnableCaptor = ArgumentCaptor.forClass(Runnable.class);