You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Erich Meier <em...@methodpark.de> on 2002/07/29 12:03:48 UTC

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.

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.

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

javax.servlet.ServletException: BeanUtils.populate
	at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:974)
	at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:779)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:246)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java: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(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1650)
	at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1545)
	at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.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(RequestProcessor.java:779)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.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>