You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mr...@apache.org on 2007/01/20 09:21:22 UTC

svn commit: r498087 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java

Author: mrdon
Date: Sat Jan 20 00:21:22 2007
New Revision: 498087

URL: http://svn.apache.org/viewvc?view=rev&rev=498087
Log:
Fixed NPE when action mapper for current request is null
WW-1662

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java?view=diff&rev=498087&r1=498086&r2=498087
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java Sat Jan 20 00:21:22 2007
@@ -27,6 +27,7 @@
 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 @@
 
         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;