What mozilla is doing is not populating the necessary information to the server for the file upload when the user does not enter a file at all (not just failing to use a FormFile versus a String) . If you read the thread on the bug report I attached below this will become more clear Cynthia. Mozilla fixed this bug in order to be compatible with other browsers so this leads me to believe this behavior is not present in other browsers. I have not confirmed this though on IE, but Netscape is probably okay since it is Mozilla-based.

As for a workaround, the best I got before I found that upgrading Mozilla fixed my problem, was to do client-side validation with JavaScript. In the end though this only ensured the user did specify a value for the file to upload. It did not ensure the file was valid, which BTW if the file is not valid you will get the same error :(

If I had to write a more elegant workaround, I would look specifically for this error condition in an exception handler and return a more sophisticated error to the user if the did not enter a file or entered an invalid file (e.g. file does not exist in path specified).

Good luck, let me know how it turns out!
-Joey

Cynthia Jeness wrote:

Since I am running Mozilla 0.99, this may be the cause of the problem;
however, we have little control over what browsers our customers choose to
run. If Mozilla does not send back a file name, then that piece of
information can be missing from my error message to the client. However,
the error itself needs to be handled more gracefully. It would be daunting
to the normal user to be presented with an invalid argument exception on
"bean populate" and a stack trace. I have tried to understand where the
error occurs. It seems to me that when Mozilla cannot process the filename
that the user has entered, the file name is sent back as part of the
request parameter stream and the commons "populate" routine is handling it
like a string. It fails because it cannot find a write method for the
parameter which accepts a String. I have tried providing a setter which
accepts an Object; however, then the file transfer does not occur when a
proper file name is supplied. I have also tried two different setters --
one with a String and one with the FormFile. This also does not work.

So, in short, are there any suggestions for a workaround or plans to handle
the error situation more gracefully in Struts or the "commons-beanutils"
routines?

Of course, if Mozilla 0.99 is the only browser that has this problem and
Netscape 4.6+ or IE work correctly along with later versions of Mozilla,
then a workaround may not be as necessary.

Cynthia Jeness

Joey Ebright wrote:


I found that my problem stemmed from a bug in Mozilla 0.99. Once I
upgraded my Mozilla browser to version 1.2.1 the problem went away. You
can find details on this bug here:
http://bugzilla.mozilla.org/show_bug.cgi?id=132069

Thanks for all who offered feedback!!!

Joey Ebright wrote:


I too have the same problem - whenever the user does not supply a file
to upload I get an exception. I have tried the 1.1-b3 release of
struts and the 1.6 release of the commons and recieve the same error
from BeanUtils.populate - IllegalArgumentException...

Have you made any progress on this front?

-Joey



---------------------------------------------------------------------
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





Reply via email to