RE: ParametersInterceptor setting values using a String[]
Your right: looks like SiteMesh was sending the parameters through to another action. Thanks for the help. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 14 February 2008 11:17 To: Struts Users Mailing List Subject: Re: ParametersInterceptor setting values using a String[] Hi Matthew, The params interceptor is calling setId on ActionSupport (the default action), not on your action that has the setId method, so an exception is being thrown as there's no matching setter whatsoever. You may have a config error. All params are treated as arrays because its valid in HTTP for the same parameter to be specified multiple times in the same request. The default type conversion will call setId(Integer id) using the first element in the array if that's the first property to be matched. The error is only logged when the exception occurs and this is *infrequent* in normal use. Hope that helps! regards, Jeromy Evans This appears to have been mentioned a number of times in the Struts 2 and XWork forums but I cannot find a real answer: Using Struts 2.0.11 I am experiencing the following problem. I have an action with the method setId(Integer id) { ... } When this value is set via a HTTP request through the ParametersInterceptor it succeeds when using both GET and POST. However when a GET is performed I get the following exception logged SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'id' on 'class com.opensymphony.xwork2.ActionSupport: Error setting expression 'id' with value '[Ljava.lang.String;@1a1f635' XWork appears to store the a single GET parameters as an array of Strings and attempt to set the value using the String[] first, when that errors tries to convert it. The problem with this is it logs the first failure as an ERROR. Why is this happening and short of creating my own TypeConverter or blocking it in the logger config, how can I stop this error being logged for GET requests? Matthew Seaborn Software Architect t+44(0) 208 484 0729 m +44(0) 7949 465 142 e [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Sussex House Plane Tree Crescent Feltham, Middlesex, TW13 7HE United Kingdom http://www.performgroup.com/ http://www.performgroup.com/ CONFIDENTIALITY - This email and any files transmitted with it, are confidential, may be legally privileged and are intended solely for the use of the individual or entity to whom they are addressed. If this has come to you in error, you must not copy, distribute, disclose or use any of the information it contains. Please notify the sender immediately and delete them from your system. SECURITY - Please be aware that communication by email, by its very nature, is not 100% secure and by communicating with Perform Group by email you consent to us monitoring and reading any such correspondence. VIRUSES - Although this email message has been scanned for the presence of computer viruses, the sender accepts no liability for any damage sustained as a result of a computer virus and it is the recipient's responsibility to ensure that email is virus free. AUTHORITY - Any views or opinions expressed in this email are solely those of the sender and do not necessarily represent those of Perform Group. COPYRIGHT - Copyright of this email and any attachments belongs to Perform Group, Companies House Registration number 6324278. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] CONFIDENTIALITY - This email and any files transmitted with it, are confidential, may be legally privileged and are intended solely for the use of the individual or entity to whom they are addressed. If this has come to you in error, you must not copy, distribute, disclose or use any of the information it contains. Please notify the sender immediately and delete them from your system. SECURITY - Please be aware that communication by email, by its very nature, is not 100% secure and by communicating with Perform Group by email you consent to us monitoring and reading any such correspondence. VIRUSES - Although this email message has been scanned for the presence of computer viruses, the sender accepts no liability for any damage sustained as a result of a computer virus and it is the recipients responsibility to ensure that email is virus free. AUTHORITY - Any views or opinions expressed in this email are solely those of the sender and do not necessarily represent those of Perform Group. COPYRIGHT - Copyright of this email and any attachments belongs to Perform Group, Companies House Registration number 6324278
ParametersInterceptor setting values using a String[]
This appears to have been mentioned a number of times in the Struts 2 and XWork forums but I cannot find a real answer: Using Struts 2.0.11 I am experiencing the following problem. I have an action with the method setId(Integer id) { ... } When this value is set via a HTTP request through the ParametersInterceptor it succeeds when using both GET and POST. However when a GET is performed I get the following exception logged SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'id' on 'class com.opensymphony.xwork2.ActionSupport: Error setting expression 'id' with value '[Ljava.lang.String;@1a1f635' XWork appears to store the a single GET parameters as an array of Strings and attempt to set the value using the String[] first, when that errors tries to convert it. The problem with this is it logs the first failure as an ERROR. Why is this happening and short of creating my own TypeConverter or blocking it in the logger config, how can I stop this error being logged for GET requests? Matthew Seaborn Software Architect t+44(0) 208 484 0729 m +44(0) 7949 465 142 e [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Sussex House Plane Tree Crescent Feltham, Middlesex, TW13 7HE United Kingdom http://www.performgroup.com/ http://www.performgroup.com/ CONFIDENTIALITY - This email and any files transmitted with it, are confidential, may be legally privileged and are intended solely for the use of the individual or entity to whom they are addressed. If this has come to you in error, you must not copy, distribute, disclose or use any of the information it contains. Please notify the sender immediately and delete them from your system. SECURITY - Please be aware that communication by email, by its very nature, is not 100% secure and by communicating with Perform Group by email you consent to us monitoring and reading any such correspondence. VIRUSES - Although this email message has been scanned for the presence of computer viruses, the sender accepts no liability for any damage sustained as a result of a computer virus and it is the recipients responsibility to ensure that email is virus free. AUTHORITY - Any views or opinions expressed in this email are solely those of the sender and do not necessarily represent those of Perform Group. COPYRIGHT - Copyright of this email and any attachments belongs to Perform Group, Companies House Registration number 6324278.
Re: ParametersInterceptor setting values using a String[]
Matthew Seaborn wrote: Why is this happening and short of creating my own TypeConverter or blocking it in the logger config, how can I stop this error being logged for GET requests? AFAIK this error is only logged in devMode. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ParametersInterceptor setting values using a String[]
Thanks for the prompt response. Having had a look at the code in Xwork that comes as part of Struts 2 (included below) it seems to log it regardless of the devMode. This is the same for 2.0.4 and 2.1.0. I cannot believe this hasn't been spotted before now, so I assume I am doing something wrong. try { stack.setValue(name, value); } catch (RuntimeException e) { if (devMode) { String developerNotification = LocalizedTextUtil.findText(ParametersInterceptor.class, devmode.notification, ActionContext.getContext().getLocale(), Developer Notification:\n{0}, new Object[]{ e.getMessage() }); LOG.error(developerNotification); if (action instanceof ValidationAware) { ((ValidationAware) action).addActionMessage(developerNotification); } } else { LOG.error(ParametersInterceptor - [setParameters]: Unexpected Exception caught setting '+name+' on '+action.getClass()+: + e.getMessage()); } } -Original Message- From: Daniel Baldes [mailto:[EMAIL PROTECTED] Sent: 14 February 2008 10:14 To: Struts Users Mailing List Subject: Re: ParametersInterceptor setting values using a String[] Matthew Seaborn wrote: Why is this happening and short of creating my own TypeConverter or blocking it in the logger config, how can I stop this error being logged for GET requests? AFAIK this error is only logged in devMode. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] CONFIDENTIALITY - This email and any files transmitted with it, are confidential, may be legally privileged and are intended solely for the use of the individual or entity to whom they are addressed. If this has come to you in error, you must not copy, distribute, disclose or use any of the information it contains. Please notify the sender immediately and delete them from your system. SECURITY - Please be aware that communication by email, by its very nature, is not 100% secure and by communicating with Perform Group by email you consent to us monitoring and reading any such correspondence. VIRUSES - Although this email message has been scanned for the presence of computer viruses, the sender accepts no liability for any damage sustained as a result of a computer virus and it is the recipients responsibility to ensure that email is virus free. AUTHORITY - Any views or opinions expressed in this email are solely those of the sender and do not necessarily represent those of Perform Group. COPYRIGHT - Copyright of this email and any attachments belongs to Perform Group, Companies House Registration number 6324278. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ParametersInterceptor setting values using a String[]
Hi Matthew, The params interceptor is calling setId on ActionSupport (the default action), not on your action that has the setId method, so an exception is being thrown as there's no matching setter whatsoever. You may have a config error. All params are treated as arrays because its valid in HTTP for the same parameter to be specified multiple times in the same request. The default type conversion will call setId(Integer id) using the first element in the array if that's the first property to be matched. The error is only logged when the exception occurs and this is *infrequent* in normal use. Hope that helps! regards, Jeromy Evans This appears to have been mentioned a number of times in the Struts 2 and XWork forums but I cannot find a real answer: Using Struts 2.0.11 I am experiencing the following problem. I have an action with the method setId(Integer id) { ... } When this value is set via a HTTP request through the ParametersInterceptor it succeeds when using both GET and POST. However when a GET is performed I get the following exception logged SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'id' on 'class com.opensymphony.xwork2.ActionSupport: Error setting expression 'id' with value '[Ljava.lang.String;@1a1f635' XWork appears to store the a single GET parameters as an array of Strings and attempt to set the value using the String[] first, when that errors tries to convert it. The problem with this is it logs the first failure as an ERROR. Why is this happening and short of creating my own TypeConverter or blocking it in the logger config, how can I stop this error being logged for GET requests? Matthew Seaborn Software Architect t+44(0) 208 484 0729 m +44(0) 7949 465 142 e [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Sussex House Plane Tree Crescent Feltham, Middlesex, TW13 7HE United Kingdom http://www.performgroup.com/ http://www.performgroup.com/ CONFIDENTIALITY - This email and any files transmitted with it, are confidential, may be legally privileged and are intended solely for the use of the individual or entity to whom they are addressed. If this has come to you in error, you must not copy, distribute, disclose or use any of the information it contains. Please notify the sender immediately and delete them from your system. SECURITY - Please be aware that communication by email, by its very nature, is not 100% secure and by communicating with Perform Group by email you consent to us monitoring and reading any such correspondence. VIRUSES - Although this email message has been scanned for the presence of computer viruses, the sender accepts no liability for any damage sustained as a result of a computer virus and it is the recipients responsibility to ensure that email is virus free. AUTHORITY - Any views or opinions expressed in this email are solely those of the sender and do not necessarily represent those of Perform Group. COPYRIGHT - Copyright of this email and any attachments belongs to Perform Group, Companies House Registration number 6324278. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]