Re: FormFile: Catching IllegalArgumentException
On 6/8/07, Eric Jain <[EMAIL PROTECTED]> wrote: I have a form with a FormFile field, which works great, except that when someone submits a plain string for this field (e.g. a spammer crawling the site and doing random submissions) I get an ugly stack trace logged... I wonder is there a way to catch this? For Struts 1.3.x you could define an exception handler for IllegalArgumentException - although I'm not sure if that would prevent this getting logged or not - but its worth a try. Other than that then the only other thing I can think of is changing the configuration of your logging implementation (or maybe a combination of the two). Niall 2007-06-08 16:04 org.apache.commons.beanutils.PropertyUtils ERROR: Method invocation failed. java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773) at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759) at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648) at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677) at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022) at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:451) at org.apache.struts.chain.commands.servlet.PopulateActionForm.populate(PopulateActionForm.java:45) at org.apache.struts.chain.commands.AbstractPopulateActionForm.execute(AbstractPopulateActionForm.java:57) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormFile: Catching IllegalArgumentException
Vincent Lin wrote: Do you have this setting in your form? enctype="multipart/form-data" As mentioned, submissions via the form in the web page work fine. The issue is that if someone bypasses the form and POSTs an (invalid) non-multipart request that puts some random string in the parameter that the application expects to contain a file, this triggers an internal server error. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormFile: Catching IllegalArgumentException
Do you have this setting in your form? enctype="multipart/form-data" On 6/8/07, Eric Jain <[EMAIL PROTECTED]> wrote: I have a form with a FormFile field, which works great, except that when someone submits a plain string for this field (e.g. a spammer crawling the site and doing random submissions) I get an ugly stack trace logged... I wonder is there a way to catch this? 2007-06-08 16:04 org.apache.commons.beanutils.PropertyUtils ERROR: Method invocation failed. java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod( PropertyUtilsBean.java:1773) at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty( PropertyUtilsBean.java:1759) at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty( PropertyUtilsBean.java:1648) at org.apache.commons.beanutils.PropertyUtilsBean.setProperty( PropertyUtilsBean.java:1677) at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java :1022) at org.apache.commons.beanutils.BeanUtilsBean.populate( BeanUtilsBean.java:811) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java :298) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java :451) at org.apache.struts.chain.commands.servlet.PopulateActionForm.populate( PopulateActionForm.java:45) at org.apache.struts.chain.commands.AbstractPopulateActionForm.execute( AbstractPopulateActionForm.java:57) at org.apache.struts.chain.commands.ActionCommandBase.execute( ActionCommandBase.java:48) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java :190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java :304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java :190) at org.apache.struts.chain.ComposableRequestProcessor.process( ComposableRequestProcessor.java:280) at org.apache.struts.action.ActionServlet.process( ActionServlet.java:1858) at org.apache.struts.action.ActionServlet.doPost( ActionServlet.java:459) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FormFile: Catching IllegalArgumentException
I have a form with a FormFile field, which works great, except that when someone submits a plain string for this field (e.g. a spammer crawling the site and doing random submissions) I get an ugly stack trace logged... I wonder is there a way to catch this? 2007-06-08 16:04 org.apache.commons.beanutils.PropertyUtils ERROR: Method invocation failed. java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773) at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759) at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648) at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677) at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022) at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:451) at org.apache.struts.chain.commands.servlet.PopulateActionForm.populate(PopulateActionForm.java:45) at org.apache.struts.chain.commands.AbstractPopulateActionForm.execute(AbstractPopulateActionForm.java:57) at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304) at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]