Return-Path: X-Original-To: apmail-struts-issues-archive@minotaur.apache.org Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4026D9901 for ; Thu, 23 May 2013 10:43:21 +0000 (UTC) Received: (qmail 14991 invoked by uid 500); 23 May 2013 10:43:20 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 14959 invoked by uid 500); 23 May 2013 10:43:20 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 14936 invoked by uid 99); 23 May 2013 10:43:20 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 May 2013 10:43:20 +0000 Date: Thu, 23 May 2013 10:43:20 +0000 (UTC) From: "Lukasz Lenart (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (WW-4052) "params" attribute in ExceptionMapping not propagated during exception handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/WW-4052?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Lukasz Lenart updated WW-4052: ------------------------------ Description: I am using the convention plugin to configure ExceptionMappings for my action. Example: {code:java} exceptionMappings = {@ExceptionMapping(exception = "xxx.core.SCFServiceException", result = "scfHome" , params = {"errorMessage", "scf.svc.exception", "operationName", SCFHelper.FACILITY_OVERVIEW}) {code} 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. {noformat} 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 exceptionMappings, Throwable t) { > ExceptionMappingConfig result = null; 262c272 < result = exceptionMappingConfig.getResult(); --- > result = exceptionMappingConfig; {nofotmat} was: 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 exceptionMappings, Throwable t) { > ExceptionMappingConfig result = null; 262c272 < result = exceptionMappingConfig.getResult(); --- > result = exceptionMappingConfig; > "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 > Fix For: 2.3.15 > > Attachments: ExceptionMappingInterceptor.patch > > > I am using the convention plugin to configure ExceptionMappings for my action. > Example: > {code:java} > exceptionMappings = {@ExceptionMapping(exception = "xxx.core.SCFServiceException", result = "scfHome" , params = {"errorMessage", "scf.svc.exception", "operationName", SCFHelper.FACILITY_OVERVIEW}) > {code} > 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. > {noformat} > 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 exceptionMappings, Throwable t) { > > ExceptionMappingConfig result = null; > 262c272 > < result = exceptionMappingConfig.getResult(); > --- > > result = exceptionMappingConfig; > {nofotmat} -- 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