Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4921

NPE in I18nInterceptor$SessionLocaleHandler.read

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.16
    • Component/s: Core Interceptors
    • Labels:

      Description

      Calling

      getActionProxy("/index.action").getInvocation().invoke()

      in a TestCase which extends from StrutsJUnit4TestCase will lead to a NullPointerException.

      Overriding getActionProxy like this will help:

       @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;
          }

       

        Attachments

          Activity

            People

            • Assignee:
              yasserzamani Yasser Zamani
              Reporter:
              Michael Hintenaus Michael Hintenaus
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: