struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r498087 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
Date Sat, 20 Jan 2007 08:21:22 GMT
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;



Mime
View raw message