struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Cooper" <mart...@apache.org>
Subject Re: Where can I catch FileUploadException?
Date Thu, 22 Apr 2004 21:46:20 GMT

"Jing Teng" <jteng@urbanout.com> wrote in message
news:97A3CDE111494E47B6534BBDABBE351856F2FA@mail.urbanout.com...
> Hi All,
>
> I am using the file upload features in a web application. Basically the
app
> has three components. Application.jsp has a html form, the form is
captured
> in JobApplicationActionForm,  the action of the form is to apply.do.
>
> The application runs well at most of the time, but when the resume file
that
> is to be uploaded is locked by another process(meaning the file can't be
> read.), the application blows up.
>
> Following is the code:

<snip/>

> I inserted the debug code in the constructor and execute() method of
> ApplyForJobAction, I found that ApplyForJobAction is actually not called.
I
> tried to catch the exception in process() method of my overriden
> ActionServlet, had no luck.
>
> Where else can I try to catch the exception?

You can't, at least not without extending RequestProcessor or modifying (or
wrapping) CommonsMultipartRequestHandler. The FileUploadException is thrown
when the request is being parsed, which is at the time the form bean is
being populated. That happens before your action is invoked. The exception
is caught by Struts, and converted to a ServletException. Unfortunately,
this doesn't propagate to the global exception handler (although perhaps it
should), so it bubbles right out the top.

--
Martin Cooper


>
> Thanks
> Jing
>
>
> DISCLAIMER: This message contains information which may be confidential
> and/or privileged, and is intended only for the use of the addressee(s).
> Any use, disclosure or copying of this message or any part thereof by any
> person other than such addressee(s) is unauthorized and strictly
prohibited.
> If you have received this message in error, please notify the sender by
> return e-mail and delete the message.  Thank you for your cooperation.




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


Mime
View raw message