Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.14
-
None
-
Any
-
Patch
Description
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;