mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
Fixed NPE when action mapper for current request is null
WW-1662 git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@498087 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -27,6 +27,7 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapper;
|
||||
import org.apache.struts2.dispatcher.mapper.ActionMapping;
|
||||
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
@@ -123,8 +124,12 @@ public class ServletRedirectResult extends StrutsResultSupport {
|
||||
|
||||
if (isPathUrl(finalLocation)) {
|
||||
if (!finalLocation.startsWith("/")) {
|
||||
String namespace = actionMapper.getMapping(
|
||||
request, Dispatcher.getInstance().getConfigurationManager()).getNamespace();
|
||||
ActionMapping mapping = actionMapper.getMapping(
|
||||
request, Dispatcher.getInstance().getConfigurationManager());
|
||||
String namespace = null;
|
||||
if (mapping != null) {
|
||||
namespace = mapping.getNamespace();
|
||||
}
|
||||
|
||||
if ((namespace != null) && (namespace.length() > 0) && (!"/".equals(namespace))) {
|
||||
finalLocation = namespace + "/" + finalLocation;
|
||||
|
||||
Reference in New Issue
Block a user