On 1/27/06, Paul Benedict <[EMAIL PROTECTED]> wrote:
> Niall,
>
> Okay. I understand now.... I now prefer throwing an exception because it 
> stops a corner case which
> I haven't mentioned yet. I was going to ask if we should also remove the 
> CANCEL_KEY from the
> request attribute if cancelling is disabled, but the Exception won't even let 
> it pass.
>
> So I guess this is the docket:
>
> * Rename "validateCancelable" to "cancellable". Kudos for Ted for catching it 
> since our
> DispatchActions use cancelled() with two L's
>
> * Throw an Exception in processValidate() if the html.CANCEL token is 
> present. But what Exception
> should be thrown, just an Exception, a RuntimeException, or a subclass of 
> Exception
> (InvalidCancelRequestException)?? I prefer a subclass so that the <exception> 
> block can handle
> this unique case, otherwise you can't do it declaratively.

Currently the struts exception handling only works for exceptions
thrown in the Action's exceute method. So if we just throw an
exception in processValidate() then it should be either a
ServletException or an IOException - which are the only two that the
process() method of RequestProcessor declares. However IMO it would be
good if this exception or exceptions thrown in the ActionForm's
validate method were also able to be handled by the struts exception
handling as well (I'm sure this has come up in the past). So my
preference would be to  do as you suggest - throw a
InvalidCancelRequestException - and also change the process() method
to use the exception handler:

try {
    if (!processValidate(request, response, form, mapping) {
        return;
    }
} catch (Exception e) {
    ActionForward forward = processException(request, response, e,
form, mapping);
    processForwardConfig(request, response, forward);
    return;
}

However, maybe doing this is too much of a change and we should stick
to just resolving the issue at hand (and throw a ServletException).
Would be good to hear other opnions on this before going ahead with
this approach.

Niall

> I'll work on it tonight. I just need a roadmap. Thanks guys.
>
> Paul

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

Reply via email to