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:
Donald J. Brown
2007-01-20 08:21:22 +00:00
parent 02424af910
commit 9ed7fce11a
@@ -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;