[ https://issues.apache.org/jira/browse/WW-4921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16373258#comment-16373258 ]
Yasser Zamani commented on WW-4921: ----------------------------------- I analysed this issue and to sum up, I saw WW-3442 adds session creation to StrutsTestCase but I'm not sure if it's good idea to also follow such policy for StrutsJUnit4TestCase (?) because what should we do then when a user wants to run it's test with no invocation session (on) ... so I decided to revert back it's logic to previous stable logic from WW-4741 while keeping it fixed. > NPE in I18nInterceptor$SessionLocaleHandler.read > ------------------------------------------------ > > Key: WW-4921 > URL: https://issues.apache.org/jira/browse/WW-4921 > Project: Struts 2 > Issue Type: Bug > Components: Core Interceptors > Reporter: Michael Hintenaus > Priority: Major > Labels: test > Fix For: 2.5.16 > > > Calling > {code:java} > getActionProxy("/index.action").getInvocation().invoke(){code} > in a TestCase which extends from StrutsJUnit4TestCase will lead to a > NullPointerException. > Overriding getActionProxy like this will help: > {code:java} > @Override > protected ActionProxy getActionProxy(final String uri) { > final ActionProxy proxy = super.getActionProxy(uri); > final ActionContext context = > proxy.getInvocation().getInvocationContext(); > if (context.getSession() == null) { > context.setSession(new SessionMap<>(request)); > } > return proxy; > }{code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)