[
https://issues.apache.org/struts/browse/WW-1662?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ted Husted updated WW-1662:
---------------------------
Fix Version/s: (was: 2.0.4)
2.0.3
WW1580 - Update fix version for 2.0.3
> NullPointerException in ServletRedirectResult
> ---------------------------------------------
>
> Key: WW-1662
> URL: https://issues.apache.org/struts/browse/WW-1662
> Project: Struts 2
> Issue Type: Bug
> Components: Dispatch
> Affects Versions: 2.0.3
> Reporter: Nate Drake
> Assigned To: Don Brown
> Fix For: 2.0.3
>
> Attachments: struts2-blank.war
>
>
> I've found a case where actionMapper can be null in ServletRedirectResult.
> We have a custom ActionMapper, which is based on DefaultActionMapper. One of
> the differences
> between the two is that our implementation of getUriFromActionMapping()
> sometimes returns values without a / on the front. This results in an NPE
> during our login process.
> Login is setup like this:
> o Login.jsp submits to LoginAction
> o On a successful login, LoginAction redirects (via a "redirect-action"
> result in struts.xml) to HomeAction.
> o HomeAction redirects to different actions based on the logged in users role.
> An NPE is thrown when trying to redirect after HomeAction.execute() returns.
> The NPE occurs in ServletRedirectResult.java at line 127. It is thrown
> because actionMapper is null. The ActionMapper isn't being injected into
> ServletRedirectResult via setActionMapper(). I'm guessing this is because
> ServletRedirectResult.doExecute() is being called from
> ServletActionRedirectResult (via super.execute()), as opposed to the
> framework creating a new instance. I was able to fix it by removing the
> actionMapper instance from ServletActionRedirectResult.java, and making
> ServletRedirectResult's actionMapper protected instead of private. I not sure
> if this is really a valid fix. Our custom mapper includes the changes made in
> DefaultActionMapper to fix WW-1571, so I think this may be a separate issue.
> I've created an updated version of the Struts 2 blank application which
> demonstrates the problem. This includes a version of the struts2-core jar
> which includes some debug, as well as a tweak to DefaultActionMapper that
> removes the leading / from URIs returned by getUriFromActionMapping(). This
> is to simulate what our custom ActionMapper does. To cause the NPE, all you
> need to do is attempt to login.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira