Prevent NullPointerException when not loaded from application context
This commit is contained in:
parent
d847772c81
commit
27de814d54
|
@ -100,6 +100,10 @@ public class HttpSessionContextIntegrationFilter implements InitializingBean, Fi
|
|||
*/
|
||||
private boolean forceEagerSessionCreation = false;
|
||||
|
||||
public HttpSessionContextIntegrationFilter() throws ServletException {
|
||||
this.contextObject = generateNewContext();
|
||||
}
|
||||
|
||||
//~ Methods ========================================================================================================
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
|
@ -113,8 +117,6 @@ public class HttpSessionContextIntegrationFilter implements InitializingBean, Fi
|
|||
throw new IllegalArgumentException(
|
||||
"If using forceEagerSessionCreation, you must set allowSessionCreation to also be true");
|
||||
}
|
||||
|
||||
this.contextObject = generateNewContext();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -190,7 +190,8 @@ public class HttpSessionContextIntegrationFilterTests extends TestCase {
|
|||
// Prepare filter
|
||||
HttpSessionContextIntegrationFilter filter = new HttpSessionContextIntegrationFilter();
|
||||
filter.setContext(SecurityContextImpl.class);
|
||||
filter.afterPropertiesSet();
|
||||
// don't call afterPropertiesSet to test case when not instantiated by Spring
|
||||
//filter.afterPropertiesSet();
|
||||
|
||||
// Execute filter
|
||||
executeFilterInContainerSimulator(new MockFilterConfig(), filter, request, response, chain);
|
||||
|
|
Loading…
Reference in New Issue