Author: wesw Date: Tue Jun 2 17:26:17 2009 New Revision: 781086 URL: http://svn.apache.org/viewvc?rev=781086&view=rev Log: WW-3107, fixing NPE, good catch Andrey Vasenin
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?rev=781086&r1=781085&r2=781086&view=diff ============================================================================== --- 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 Tue Jun 2 17:26:17 2009 @@ -167,17 +167,19 @@ } ResultConfig resultConfig = invocation.getProxy().getConfig().getResults().get(invocation.getResultCode()); - Map resultConfigParams = resultConfig.getParams(); - for (Iterator i = resultConfigParams.entrySet().iterator(); i.hasNext();) { - Map.Entry e = (Map.Entry) i.next(); - - if (!getProhibitedResultParams().contains(e.getKey())) { - requestParameters.put(e.getKey().toString(), - e.getValue() == null ? "" : - conditionalParse(e.getValue().toString(), invocation)); - String potentialValue = e.getValue() == null ? "" : conditionalParse(e.getValue().toString(), invocation); - if (!supressEmptyParameters || ((potentialValue != null) && (potentialValue.length() > 0))) { - requestParameters.put(e.getKey().toString(), potentialValue); + if (resultConfig != null ) { + Map resultConfigParams = resultConfig.getParams(); + for (Iterator i = resultConfigParams.entrySet().iterator(); i.hasNext();) { + Map.Entry e = (Map.Entry) i.next(); + + if (!getProhibitedResultParams().contains(e.getKey())) { + requestParameters.put(e.getKey().toString(), + e.getValue() == null ? "" : + conditionalParse(e.getValue().toString(), invocation)); + String potentialValue = e.getValue() == null ? "" : conditionalParse(e.getValue().toString(), invocation); + if (!supressEmptyParameters || ((potentialValue != null) && (potentialValue.length() > 0))) { + requestParameters.put(e.getKey().toString(), potentialValue); + } } } } @@ -232,7 +234,7 @@ /** * Sets the supressEmptyParameters option * - * @param suppress The new value for this option + * @param supressEmptyParameters The new value for this option */ public void setSupressEmptyParameters(boolean supressEmptyParameters) { this.supressEmptyParameters = supressEmptyParameters;