struts-user mailing list archives

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

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


> I inserted the debug code in the constructor and execute() method of
> ApplyForJobAction, I found that ApplyForJobAction is actually not called.
> 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
> 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:
For additional commands, e-mail:

View raw message