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 96FBAF2C3 for ; Thu, 18 Apr 2013 18:26:14 +0000 (UTC) Received: (qmail 77071 invoked by uid 500); 18 Apr 2013 18:26:14 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 76992 invoked by uid 500); 18 Apr 2013 18:26:14 -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 76971 invoked by uid 99); 18 Apr 2013 18:26:14 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Apr 2013 18:26:14 +0000 Date: Thu, 18 Apr 2013 18:26:14 +0000 (UTC) From: "Stefan Reich (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 ] Stefan Reich updated WW-4052: ----------------------------- Attachment: ExceptionMappingInterceptor.patch Here we go. Patch tested like this: /Users/u205947/Downloads/struts-2.3.14/src/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor C02FH1RDDF8X:interceptor u205947$ patch <~/Desktop/ExceptionMappingInterceptor.patch patching file ExceptionMappingInterceptor.java > "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: > 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; -- 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