You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Martin Cooper <ma...@tumbleweed.com> on 2002/07/31 08:58:01 UTC

RE: Incompatibilities with new fileupload package in nightly buil d


> -----Original Message-----
> From: Erich Meier [mailto:emr@methodpark.de]
> Sent: Monday, July 29, 2002 3:04 AM
> To: struts-user@jakarta.apache.org
> Subject: Incompatibilities with new fileupload package in 
> nightly build
> 
> 
> Hi!
> 
> I tried the new fileuploader from the commons package and ran into two
> incompatibilities. The first one is a small semantic change, 
> the second one
> seems to be a bug.

Thanks so much for trying out the new file upload code. This kind of report
is exactly what we need.

> Before ranting about errors and shortcomings, let me say that the new
> fileuploader seems to be much more speedy than the old one. I 
> didn't measure
> it, though.
> 
> Now for the problems I found...
> 
> First, the new fileuploader returns the whole file path in 
> getFileName().
> It uses the client's representation, i.e. "C:\Program 
> File\bla\foo\a.jpg".
> The old one only returned the file name ("a.jpg") which seems 
> to be the
> better alternative. If you want to store the file name of 
> uploaded content
> to send it back to the client via the Content-Disposition 
> header, the file
> name would suffice. With the new semantics, I'd have to stuff 
> the path name into
> a File object to retrieve the file name in a platform 
> independent manner.
> This seems clumsy for me. YMMV.

This is a bug, and has been fixed in the 20020731 nightly build.

> Second, if I submit an upload page without content being 
> uploaded (user did
> not select a file), an exception occurs:

Interesting. I also get an exception, but not the same one. Which Struts
build are you using, and what version of BeanUtils?

--
Martin Cooper


> 
> javax.servlet.ServletException: BeanUtils.populate
> 	at 
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:974)
> 	at 
> org.apache.struts.action.RequestProcessor.processPopulate(Requ
> estProcessor.java:779)
> 	at 
> org.apache.struts.action.RequestProcessor.process(RequestProce
> ssor.java:246)
> 	at 
> org.apache.struts.action.ActionServlet.process(ActionServlet.j
> ava:1292)
> 	at 
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> 
> root cause 
> 
> java.lang.IllegalArgumentException: 
> java.lang.ClassCastException@7e942f
> 	at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source)
> 	at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> odAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:324)
> 	at 
> org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(P
> ropertyUtils.java:1650)
> 	at 
> org.apache.commons.beanutils.PropertyUtils.setNestedProperty(P
> ropertyUtils.java:1545)
> 	at 
> org.apache.commons.beanutils.PropertyUtils.setProperty(Propert
> yUtils.java:1574)
> 	at 
> org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:919)
> 	at 
> org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:726)
> 	at 
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:972)
> 	at 
> org.apache.struts.action.RequestProcessor.processPopulate(Requ
> estProcessor.java:779)
> 	at 
> org.apache.struts.action.RequestProcessor.process(RequestProce
> ssor.java:246)
> 
> Hope this helps weeding out the bugs out of the new 
> fileupload package.
> 
> Erich
> 
> -- 
> Dr. Erich Meier, Software Process Improvement
> method park Software AG, Wetterkreuz 19a, 91058 Erlangen, Germany
> Tel. +49-9131-97206-316  mailto:Erich.Meier@methodpark.de
> Fax. +49-9131-97206-200  http://www.methodpark.de/
> 
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Incompatibilities with new fileupload package in nightly buil d

Posted by Erich Meier <em...@methodpark.de>.
> > First, the new fileuploader returns the whole file path in 
> > getFileName().
[...]
> 
> This is a bug, and has been fixed in the 20020731 nightly build.

Thanks a lot! I'll check it out when it is available.

> > Second, if I submit an upload page without content being 
> > uploaded (user did
> > not select a file), an exception occurs:
> 
> Interesting. I also get an exception, but not the same one. Which Struts
> build are you using, and what version of BeanUtils?

I am using struts 20020728 and beanutils 20020725.

The form property is named "content" and has type FormFile. The jsp form
contains a
	<html:file property="content"/>
to invoke the upload.

Erich

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>