struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Hintenaus (JIRA)" <j...@apache.org>
Subject [jira] [Created] (WW-4921) NPE in I18nInterceptor$SessionLocaleHandler.read
Date Mon, 19 Feb 2018 13:01:00 GMT
Michael Hintenaus created WW-4921:
-------------------------------------

             Summary: 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


Calling
{code:java}
getActionProxy("/index.action").getInvocation().invoke(){code}
in a TestCase which extendsStrutsJUnit4TestCase 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)

Mime
View raw message