You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Franck Lefebure <fl...@orangecaraibe.com> on 2003/10/02 00:41:52 UTC

file upload and IllegalArgumentException:

Hi,
I have an action form <html:form action="/doServer" focus="name"
method="post" enctype="multipart/form-data" >
with an <html:file property='file'>

the file of this form is optional.
but if the user doesn't choose file before submit  then there is an
IllegalArgumentException (stacktrace below):

I put some tracelogs in beanutils.PropertyUtils, I see that when struts is
populating the ActionForm from the Html form,
he tries to set a FormFile property with a (blank) String value, causing the
exception

Is there a workaround ?

Thanks

--
Franck Lefebure

--------------------------------------------------------

<PRE> <B>/servers/doServer.do:</B> BeanUtils.populate
java.lang.IllegalArgumentException: argument type mismatch at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.j
ava:1790) at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j
ava:1685) at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:17
14) at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019) at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) at






---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org