struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Reich (JIRA)" <j...@apache.org>
Subject [jira] [Created] (WW-4052) "params" attribute in ExceptionMapping not propagated during exception handling
Date Thu, 18 Apr 2013 17:11:15 GMT
Stefan Reich created WW-4052:
--------------------------------

             Summary: "params" attribute in ExceptionMapping not propagated during exception
handling
                 Key: WW-4052
                 URL: https://issues.apache.org/jira/browse/WW-4052
             Project: Struts 2
          Issue Type: Bug
          Components: Core Interceptors
    Affects Versions: 2.3.14
         Environment: Any
            Reporter: Stefan Reich


I am using the convention plugin to configure ExceptionMappings for my action.
Example:

exceptionMappings = {@ExceptionMapping(exception = "xxx.core.SCFServiceException", result
= "scfHome" , params = {"errorMessage", "scf.svc.exception", "operationName", SCFHelper.FACILITY_OVERVIEW})

In the exception case, "errorMessage" and "operationName" are not propagated to the action
mapped to "scfHome". 

It turns out that the method "getParams" from ExceptionMappingConfig has no callers after
its construction, so this feature never worked or was broken before version 2.3.8.

Patch below. Tested using the convention plugin.

22a23
> import java.util.HashMap;
23a25
> import java.util.Map;
193,195c195,200
<             String mappedResult = this.findResultFromExceptions(exceptionMappings, e);
<             if (mappedResult != null) {
<                 result = mappedResult;
---
>             ExceptionMappingConfig mappingConfig = this.findMappingFromExceptions(exceptionMappings,
e);
>             if (mappingConfig != null && mappingConfig.getResult()!=null) {
>                 Map parameterMap = mappingConfig.getParams();
>                 // create a mutable HashMap since some interceptors will remove parameters,
and parameterMap is immutable
>                 invocation.getInvocationContext().setParameters(new HashMap(parameterMap));
>                 result = mappingConfig.getResult();
252c257,262
<         String result = null;
---
>     	ExceptionMappingConfig result = findMappingFromExceptions(exceptionMappings, t);
>         return result==null?null:result.getResult();
>     }
> 
>     protected ExceptionMappingConfig findMappingFromExceptions(List<ExceptionMappingConfig>
exceptionMappings, Throwable t) {
>     	ExceptionMappingConfig result = null;
262c272
<                     result = exceptionMappingConfig.getResult();
---
>                     result = exceptionMappingConfig;




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message