diff --git a/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java index e08fb07bea..0a001f34a9 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java @@ -108,8 +108,13 @@ protected String handleToken(ActionInvocation invocation) throws Exception { if (!TokenHelper.validToken()) { return handleInvalidToken(invocation); } - return handleValidToken(invocation); + // we know the token name and token must be there + String key = TokenHelper.getTokenName(); + String token = TokenHelper.getToken(key); + String sessionTokenName = TokenHelper.buildTokenSessionAttributeName(key); + InvocationSessionStore.storeInvocation(sessionTokenName, token, invocation); } + return handleValidToken(invocation); } @Override @@ -155,12 +160,6 @@ protected String handleInvalidToken(ActionInvocation invocation) throws Exceptio @Override protected String handleValidToken(ActionInvocation invocation) throws Exception { - // we know the token name and token must be there - String key = TokenHelper.getTokenName(); - String token = TokenHelper.getToken(key); - String sessionTokenName = TokenHelper.buildTokenSessionAttributeName(key); - InvocationSessionStore.storeInvocation(sessionTokenName, token, invocation); - return invocation.invoke(); }