Martin,

Thanks for the reply. 

If I throw a ServletException in my Action, my app catches it. The question
here is if there is a way to catch this FileUploadException wraped as a
ServletExcption, maybe tweaking the web container somehow? I am using
Websphere 5.0.2

Jing Teng



-----Original Message-----
From: Martin Cooper [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 22, 2004 5:46 PM
To: [EMAIL PROTECTED]
Subject: Re: Where can I catch FileUploadException?


"Jing Teng" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to