You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Min Lu <MI...@oracle.com> on 2009/02/15 19:48:49 UTC

[Trinidad] Introduce UpdateModelSkipMessageException

I would like to propose that we introduce a new exception class UpdateModelSkipMessageException extends RuntimeException, which indicates failure in UpdateModel phase, however the error message has been added in the model layer for reporting, so UpdateModel can skip adding the message for this type of exception (done at the end of UIXEditableValue.updateModel() ).

 

Thanks,

Min Lu

 

Re: [Trinidad] Introduce UpdateModelSkipMessageException

Posted by Gabrielle Crawford <ga...@oracle.com>.
Oh, and it will blow away the local value, say localValueSet is false 
because it thinks it succeeded....

Thanks,

Gab

Gabrielle Crawford wrote:
> UpdateModel also sets valid to false when it sees an exception, 
> although I'm not sure Min needs that. If she has access to the 
> component she could also set valid to false I guess.
>
> Thanks,
>
> Gab
>
> Andrew Robinson wrote:
>> I'm missing something, why not just call 
>> FacesContext.getCurrentInstance().renderResponse()? This is the "JSF 
>> way" to skip any following phases and also what happens when UIInput 
>> catches validation exceptions. I see no need for a new exception, no 
>> to mention Exceptions are not cheap to throw, relatively speaking.
>>
>> -Andrew
>>
>> On Sun, Feb 15, 2009 at 11:48 AM, Min Lu <MIN.LU 
>> <http://MIN.LU>@oracle.com <http://oracle.com>> wrote:
>>
>>     I would like to propose that we introduce a new exception class
>>     UpdateModelSkipMessageException extends RuntimeException, which
>>     indicates failure in UpdateModel phase, however the error message
>>     has been added in the model layer for reporting, so UpdateModel
>>     can skip adding the message for this type of exception (done at
>>     the end of UIXEditableValue.updateModel() ).
>>
>>     
>>     Thanks,
>>
>>     Min Lu
>>
>>     
>>

Re: [Trinidad] Introduce UpdateModelSkipMessageException

Posted by Gabrielle Crawford <ga...@oracle.com>.
UpdateModel also sets valid to false when it sees an exception, although 
I'm not sure Min needs that. If she has access to the component she 
could also set valid to false I guess.

Thanks,

Gab

Andrew Robinson wrote:
> I'm missing something, why not just call 
> FacesContext.getCurrentInstance().renderResponse()? This is the "JSF 
> way" to skip any following phases and also what happens when UIInput 
> catches validation exceptions. I see no need for a new exception, no 
> to mention Exceptions are not cheap to throw, relatively speaking.
>
> -Andrew
>
> On Sun, Feb 15, 2009 at 11:48 AM, Min Lu <MIN.LU 
> <http://MIN.LU>@oracle.com <http://oracle.com>> wrote:
>
>     I would like to propose that we introduce a new exception class
>     UpdateModelSkipMessageException extends RuntimeException, which
>     indicates failure in UpdateModel phase, however the error message
>     has been added in the model layer for reporting, so UpdateModel
>     can skip adding the message for this type of exception (done at
>     the end of UIXEditableValue.updateModel() ).
>
>      
>
>     Thanks,
>
>     Min Lu
>
>      
>
>

Re: [Trinidad] Introduce UpdateModelSkipMessageException

Posted by Andrew Robinson <an...@gmail.com>.
I'm missing something, why not just call
FacesContext.getCurrentInstance().renderResponse()? This is the "JSF way" to
skip any following phases and also what happens when UIInput catches
validation exceptions. I see no need for a new exception, no to mention
Exceptions are not cheap to throw, relatively speaking.

-Andrew

On Sun, Feb 15, 2009 at 11:48 AM, Min Lu <MI...@oracle.com> wrote:

>  I would like to propose that we introduce a new exception class
> UpdateModelSkipMessageException extends RuntimeException, which indicates
> failure in UpdateModel phase, however the error message has been added in
> the model layer for reporting, so UpdateModel can skip adding the message
> for this type of exception (done at the end of
> UIXEditableValue.updateModel() ).
>
>
>
> Thanks,
>
> Min Lu
>
>
>

Re: [Trinidad] Introduce UpdateModelSkipMessageException

Posted by Gabrielle Crawford <ga...@oracle.com>.
Hmmm, if anyone is relying on the current behavior then this is not a 
backward compatible change.

Plus, even if the user can't fix the issue, don't they need to know 
there is an issue, because the model update did indeed fail. At a 
minimum isn't some message saying an error occurred required?

Looking at the link Matthias sent here's what it will do in jsf 2.0? 
Does this look right?

    * they added support for setting exception handlers on facesContext
      (or is this supported now, I'm not familiar with this if it's
      supported in 1.2).
    * in the updateModel code when they find an exception they wrap it
      in an updateModelException, so it doesn't look like they expect
      this exception to be thrown from the model, they are actually
      creating one of these in the UIInput.updateModel method.
    * pass the UpdateModelException to the exception handler.



So in theory in jsf 2.0 the user could wire up an exception handler 
configured to not add a faces message for certain types of exceptions?

Without the ability to configure an exception handler now I still think 
Min's original solution to fire a special exception to tell updateModel 
not to add a messageseems reasonable, not to mention backward 
compatible. We could add it as deprecated assuming we could wire up our 
own exception handler in jsf 2.0?


Thanks,

Gab



Min Lu wrote:
> The patch below is for message reformat. We need a solution to skip reporting message.
>
> Since other than ValiatorException, the end users cannot fix other types of exception, we can change the updateModel() logic to only report error messages for ValidatorException type. 
> If error messages are reported by the model layer already, model layer can throw a RuntimeException to indicate failure to updateModel but let updateModel skip reporting errors.
>
> Thanks,
> Min
>
> -----Original Message-----
> From: Matthias Wessendorf [mailto:matzew@apache.org] 
> Sent: Monday, February 16, 2009 12:21 AM
> To: MyFaces Development
> Subject: Re: [Trinidad] Introduce UpdateModelSkipMessageException
>
> Hi Min,
>
> Looks like the JSF 2.0 spec will contain an UpdateModelException, see
> the gobal exception_handling item in their bug-system:
> https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=248
>
> and the proposed patch:
> https://javaserverfaces-spec-public.dev.java.net/nonav/issues/showattachment.cgi/186/changebundle.txt
>
> Greetings,
> Matthias
>
> On Sun, Feb 15, 2009 at 10:19 PM, Matthias Wessendorf
> <mw...@gmail.com> wrote:
>   
>> Hi,
>> IMO this makes sense. I think I saw an item for JSF 2 that does this too. If
>> possible we should take a look at it so that our solution is not to
>> different from the standard.
>>
>> Sent from my iPod.
>> On 15.02.2009, at 19:48, Min Lu <MI...@oracle.com> wrote:
>>
>> I would like to propose that we introduce a new exception class
>> UpdateModelSkipMessageException extends RuntimeException, which indicates
>> failure in UpdateModel phase, however the error message has been added in
>> the model layer for reporting, so UpdateModel can skip adding the message
>> for this type of exception (done at the end of
>> UIXEditableValue.updateModel() ).
>>
>>
>>
>> Thanks,
>>
>> Min Lu
>>
>>
>>     
>
>
>
>   

Re: [Trinidad] Introduce UpdateModelSkipMessageException

Posted by Blake Sullivan <bl...@oracle.com>.
I think that we need to decide whether we want to introduce the 
UpdateModelException and if so, we want to introduce special handling 
for the case where it wraps a ValidatorException.  If we do introduce 
special behavior for ValidatorExceptions, should this behavior be 
identical to the handling of ValidatorExceptions earlier in the lifecycle?

-- Blake Sullivan

Min Lu said the following On 2/16/2009 10:33 AM PT:
> The patch below is for message reformat. We need a solution to skip reporting message.
>
> Since other than ValiatorException, the end users cannot fix other types of exception, we can change the updateModel() logic to only report error messages for ValidatorException type. 
> If error messages are reported by the model layer already, model layer can throw a RuntimeException to indicate failure to updateModel but let updateModel skip reporting errors.
>
> Thanks,
> Min
>
> -----Original Message-----
> From: Matthias Wessendorf [mailto:matzew@apache.org] 
> Sent: Monday, February 16, 2009 12:21 AM
> To: MyFaces Development
> Subject: Re: [Trinidad] Introduce UpdateModelSkipMessageException
>
> Hi Min,
>
> Looks like the JSF 2.0 spec will contain an UpdateModelException, see
> the gobal exception_handling item in their bug-system:
> https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=248
>
> and the proposed patch:
> https://javaserverfaces-spec-public.dev.java.net/nonav/issues/showattachment.cgi/186/changebundle.txt
>
> Greetings,
> Matthias
>
> On Sun, Feb 15, 2009 at 10:19 PM, Matthias Wessendorf
> <mw...@gmail.com> wrote:
>   
>> Hi,
>> IMO this makes sense. I think I saw an item for JSF 2 that does this too. If
>> possible we should take a look at it so that our solution is not to
>> different from the standard.
>>
>> Sent from my iPod.
>> On 15.02.2009, at 19:48, Min Lu <MI...@oracle.com> wrote:
>>
>> I would like to propose that we introduce a new exception class
>> UpdateModelSkipMessageException extends RuntimeException, which indicates
>> failure in UpdateModel phase, however the error message has been added in
>> the model layer for reporting, so UpdateModel can skip adding the message
>> for this type of exception (done at the end of
>> UIXEditableValue.updateModel() ).
>>
>>
>>
>> Thanks,
>>
>> Min Lu
>>
>>
>>     
>
>
>
>   


RE: [Trinidad] Introduce UpdateModelSkipMessageException

Posted by Min Lu <MI...@oracle.com>.
The patch below is for message reformat. We need a solution to skip reporting message.

Since other than ValiatorException, the end users cannot fix other types of exception, we can change the updateModel() logic to only report error messages for ValidatorException type. 
If error messages are reported by the model layer already, model layer can throw a RuntimeException to indicate failure to updateModel but let updateModel skip reporting errors.

Thanks,
Min

-----Original Message-----
From: Matthias Wessendorf [mailto:matzew@apache.org] 
Sent: Monday, February 16, 2009 12:21 AM
To: MyFaces Development
Subject: Re: [Trinidad] Introduce UpdateModelSkipMessageException

Hi Min,

Looks like the JSF 2.0 spec will contain an UpdateModelException, see
the gobal exception_handling item in their bug-system:
https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=248

and the proposed patch:
https://javaserverfaces-spec-public.dev.java.net/nonav/issues/showattachment.cgi/186/changebundle.txt

Greetings,
Matthias

On Sun, Feb 15, 2009 at 10:19 PM, Matthias Wessendorf
<mw...@gmail.com> wrote:
> Hi,
> IMO this makes sense. I think I saw an item for JSF 2 that does this too. If
> possible we should take a look at it so that our solution is not to
> different from the standard.
>
> Sent from my iPod.
> On 15.02.2009, at 19:48, Min Lu <MI...@oracle.com> wrote:
>
> I would like to propose that we introduce a new exception class
> UpdateModelSkipMessageException extends RuntimeException, which indicates
> failure in UpdateModel phase, however the error message has been added in
> the model layer for reporting, so UpdateModel can skip adding the message
> for this type of exception (done at the end of
> UIXEditableValue.updateModel() ).
>
>
>
> Thanks,
>
> Min Lu
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

Re: [Trinidad] Introduce UpdateModelSkipMessageException

Posted by Matthias Wessendorf <ma...@apache.org>.
Hi Min,

Looks like the JSF 2.0 spec will contain an UpdateModelException, see
the gobal exception_handling item in their bug-system:
https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=248

and the proposed patch:
https://javaserverfaces-spec-public.dev.java.net/nonav/issues/showattachment.cgi/186/changebundle.txt

Greetings,
Matthias

On Sun, Feb 15, 2009 at 10:19 PM, Matthias Wessendorf
<mw...@gmail.com> wrote:
> Hi,
> IMO this makes sense. I think I saw an item for JSF 2 that does this too. If
> possible we should take a look at it so that our solution is not to
> different from the standard.
>
> Sent from my iPod.
> On 15.02.2009, at 19:48, Min Lu <MI...@oracle.com> wrote:
>
> I would like to propose that we introduce a new exception class
> UpdateModelSkipMessageException extends RuntimeException, which indicates
> failure in UpdateModel phase, however the error message has been added in
> the model layer for reporting, so UpdateModel can skip adding the message
> for this type of exception (done at the end of
> UIXEditableValue.updateModel() ).
>
>
>
> Thanks,
>
> Min Lu
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

Re: [Trinidad] Introduce UpdateModelSkipMessageException

Posted by Matthias Wessendorf <mw...@gmail.com>.
Hi,

IMO this makes sense. I think I saw an item for JSF 2 that does this  
too. If possible we should take a look at it so that our solution is  
not to different from the standard.

Sent from my iPod.

On 15.02.2009, at 19:48, Min Lu <MI...@oracle.com> wrote:

> I would like to propose that we introduce a new exception class  
> UpdateModelSkipMessageException extends RuntimeException, which  
> indicates failure in UpdateModel phase, however the error message  
> has been added in the model layer for reporting, so UpdateModel can  
> skip adding the message for this type of exception (done at the end  
> of UIXEditableValue.updateModel() ).
>
>
>
> Thanks,
>
> Min Lu
>
>