You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Hongbing <ho...@oracle.com> on 2011/02/16 22:01:37 UTC

[Trinidad][API] New Exception tells whether JSF needs to report the exception for TRINIDAD-2038

Hi:
This is for JIRA TRINIDAD-2038, please let me know your suggestion.

There are cases that exception is thrown in update model phase, like 
model layer validation failure, by model outside of JSF and the 
exception is also handled and reported outside of JSF. To avoid the 
component's local value getting reset to null, JSF needs to be notified 
when it happens. The proposed solution is to re-throw a special 
exception to JSF to notify it and also let JSF know whether it needs to 
report the exception.

Here is the interface of the exception:
package org.apache.myfaces.trinidad.context;

/**
  * Interface for exceptions that tells whether the exception needs to 
be reported.
  * If an exception is thrown during JSF lifycycle and aleady reported, 
then it should let
  * JSF know not to report it again.
  *
  */
public interface Reportable
{

   /**
    * Return false if JSF doesn't need to report this exception, 
otherwise true.
    */
   public boolean isReportingMessage();

}

Thanks,
Hongbing



Re: [Trinidad][API] New Exception tells whether JSF needs to report the exception for TRINIDAD-2038

Posted by Scott O'Bryan <da...@gmail.com>.
Ahh cool.  Thanks Blake.  That clears things up consoderably.  I guess
I'm cool with it but I'm wondering if this might not be better served
by a RUNTIME annotation or even a new Trinidad exception class.

Having an interface on an exception seems a bit silly to me because it
requires some implementation.  Especially if that interface only
returns a Boolean.  An annotation marker might be a better thing to
use if you need to return exceptions with multiple origins or if these
wrapper exceptions can all come from the same base exception, a
special Trinidad exception type would be much more efficient because
we could simply return an instanceof and/or provide overloadable logic
to determine if logging is needed.

Just my .02, but I'm good with it.. ;)

Scott

On Feb 16, 2011, at 5:46 PM, Blake Sullivan <bl...@oracle.com> wrote:

> The issue isn't that the problem has been handled by the model.  It hasn't.  Therefore the model has to throw a RuntimeException in this case so that the component knows to preserve its local value.  That's all good.
>
> The problem occurs if the model has its own mechanisms for reporting problems.  In that case, we want to avoid reporting the same problem twice and that is where the interface comes in.  The model wants to tell the view that there was a problem, but that the model will take care of reporting it, so the view needn't bother.
>
> -- Blake Sullivan
>
> On 2/16/11 4:39 PM, Scott O'Bryan wrote:
>> If this exception is handled, why is it rethrown?  What would you
>> expect Trinidad to do in this case?
>>
>> On Feb 16, 2011, at 5:37 PM, Hongbing<ho...@oracle.com>  wrote:
>>
>>> Hi Scott:
>>> One example is in the following UIXEditableValue.updateModel(FacesContext context) code,
>>>
>>>  public void updateModel(FacesContext context)
>>>  {
>>>    ....
>>>    try
>>>    {
>>>      Object localValue = getLocalValue();
>>>      expression.setValue(context.getELContext(), localValue);
>>>      setValue(null);
>>>      setLocalValueSet(false);
>>>      if (_LOG.isFiner())
>>>      {
>>>        _LOG.finer("Wrote value {0} to model {1} in component {2}",
>>>                   new Object[]{localValue,
>>>                                expression.getExpressionString(),
>>>                                this});
>>>      }
>>>    }
>>>    catch (RuntimeException e)
>>>    {
>>>    ...
>>>
>>>  expression.setValue(context.getELContext(), localValue) calls binding code and then the model's code, where exception can be thrown.
>>>  In the catch part, we want to skip reporting the exception if it is handled by model/controller code.
>>>
>>>
>>> Thanks,
>>> Hongbing
>>>
>>>
>>>
>>> On 2/16/2011 4:23 PM, Scott O'Bryan wrote:
>>>> Hogbing,
>>>>
>>>> I'm taking a look at the bug now but just so I understand..  When you
>>>> refer to JSF, I assume you mean the Trinidad renderkit.  Is that
>>>> correct?
>>>>
>>>> Scott
>>>>
>>>> On Feb 16, 2011, at 4:23 PM, Hongbing<ho...@oracle.com>   wrote:
>>>>
>>>>> Hi Pavitra:
>>>>> It can happen in update model phase. For example, Model layer throws exception when attribute value validation fails, binding layer detects it and re-throwd new exception with the new interface to JSF. JSF then can handle it accordingly.
>>>>>
>>>>> thanks,
>>>>> Hongbing
>>>>>
>>>>> On 2/16/2011 2:09 PM, Pavitra Subramaniam wrote:
>>>>>> Hello Hongbing,
>>>>>>
>>>>>> You mentioned that exceptions get thrown by model layer outside of JSF. Can you give an e.g., of when this might occur?
>>>>>> How exactly will the interface get used?
>>>>>>
>>>>>> Thanks
>>>>>> Pavitra
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 2/16/2011 1:01 PM, Hongbing wrote:
>>>>>>> Hi:
>>>>>>> This is for JIRA TRINIDAD-2038, please let me know your suggestion.
>>>>>>>
>>>>>>> There are cases that exception is thrown in update model phase, like model layer validation failure, by model outside of JSF and the exception is also handled and reported outside of JSF. To avoid the component's local value getting reset to null, JSF needs to be notified when it happens. The proposed solution is to re-throw a special exception to JSF to notify it and also let JSF know whether it needs to report the exception.
>>>>>>>
>>>>>>> Here is the interface of the exception:
>>>>>>> package org.apache.myfaces.trinidad.context;
>>>>>>>
>>>>>>> /**
>>>>>>> * Interface for exceptions that tells whether the exception needs to be reported.
>>>>>>> * If an exception is thrown during JSF lifycycle and aleady reported, then it should let
>>>>>>> * JSF know not to report it again.
>>>>>>> *
>>>>>>> */
>>>>>>> public interface Reportable
>>>>>>> {
>>>>>>>
>>>>>>>  /**
>>>>>>>   * Return false if JSF doesn't need to report this exception, otherwise true.
>>>>>>>   */
>>>>>>>  public boolean isReportingMessage();
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Hongbing
>>>>>>>
>>>>>>>
>

Re: [Trinidad][API] New Exception tells whether JSF needs to report the exception for TRINIDAD-2038

Posted by Pavitra Subramaniam <pa...@oracle.com>.
Sounds good.  Thanks.

+1 with minor typo corrections in comments.


/**
  * Interface for exceptions that tells whether the exception needs to 
be reported.
  * If an exception is thrown during the JSF _lifecycle and already_  
reported, then
  * it should let JSF know not to report it again.
  *
  */

On 2/16/2011 4:45 PM, Blake Sullivan wrote:
> The issue isn't that the problem has been handled by the model.  It 
> hasn't.  Therefore the model has to throw a RuntimeException in this 
> case so that the component knows to preserve its local value.  That's 
> all good.
>
> The problem occurs if the model has its own mechanisms for reporting 
> problems.  In that case, we want to avoid reporting the same problem 
> twice and that is where the interface comes in.  The model wants to 
> tell the view that there was a problem, but that the model will take 
> care of reporting it, so the view needn't bother.
>
> -- Blake Sullivan
>
> On 2/16/11 4:39 PM, Scott O'Bryan wrote:
>> If this exception is handled, why is it rethrown?  What would you
>> expect Trinidad to do in this case?
>>
>> On Feb 16, 2011, at 5:37 PM, Hongbing<ho...@oracle.com>  wrote:
>>
>>> Hi Scott:
>>> One example is in the following 
>>> UIXEditableValue.updateModel(FacesContext context) code,
>>>
>>>   public void updateModel(FacesContext context)
>>>   {
>>>     ....
>>>     try
>>>     {
>>>       Object localValue = getLocalValue();
>>>       expression.setValue(context.getELContext(), localValue);
>>>       setValue(null);
>>>       setLocalValueSet(false);
>>>       if (_LOG.isFiner())
>>>       {
>>>         _LOG.finer("Wrote value {0} to model {1} in component {2}",
>>>                    new Object[]{localValue,
>>>                                 expression.getExpressionString(),
>>>                                 this});
>>>       }
>>>     }
>>>     catch (RuntimeException e)
>>>     {
>>>     ...
>>>
>>>   expression.setValue(context.getELContext(), localValue) calls 
>>> binding code and then the model's code, where exception can be thrown.
>>>   In the catch part, we want to skip reporting the exception if it 
>>> is handled by model/controller code.
>>>
>>>
>>> Thanks,
>>> Hongbing
>>>
>>>
>>>
>>> On 2/16/2011 4:23 PM, Scott O'Bryan wrote:
>>>> Hogbing,
>>>>
>>>> I'm taking a look at the bug now but just so I understand..  When you
>>>> refer to JSF, I assume you mean the Trinidad renderkit.  Is that
>>>> correct?
>>>>
>>>> Scott
>>>>
>>>> On Feb 16, 2011, at 4:23 PM, Hongbing<ho...@oracle.com>   
>>>> wrote:
>>>>
>>>>> Hi Pavitra:
>>>>> It can happen in update model phase. For example, Model layer 
>>>>> throws exception when attribute value validation fails, binding 
>>>>> layer detects it and re-throwd new exception with the new 
>>>>> interface to JSF. JSF then can handle it accordingly.
>>>>>
>>>>> thanks,
>>>>> Hongbing
>>>>>
>>>>> On 2/16/2011 2:09 PM, Pavitra Subramaniam wrote:
>>>>>> Hello Hongbing,
>>>>>>
>>>>>> You mentioned that exceptions get thrown by model layer outside 
>>>>>> of JSF. Can you give an e.g., of when this might occur?
>>>>>> How exactly will the interface get used?
>>>>>>
>>>>>> Thanks
>>>>>> Pavitra
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 2/16/2011 1:01 PM, Hongbing wrote:
>>>>>>> Hi:
>>>>>>> This is for JIRA TRINIDAD-2038, please let me know your suggestion.
>>>>>>>
>>>>>>> There are cases that exception is thrown in update model phase, 
>>>>>>> like model layer validation failure, by model outside of JSF and 
>>>>>>> the exception is also handled and reported outside of JSF. To 
>>>>>>> avoid the component's local value getting reset to null, JSF 
>>>>>>> needs to be notified when it happens. The proposed solution is 
>>>>>>> to re-throw a special exception to JSF to notify it and also let 
>>>>>>> JSF know whether it needs to report the exception.
>>>>>>>
>>>>>>> Here is the interface of the exception:
>>>>>>> package org.apache.myfaces.trinidad.context;
>>>>>>>
>>>>>>> /**
>>>>>>> * Interface for exceptions that tells whether the exception 
>>>>>>> needs to be reported.
>>>>>>> * If an exception is thrown during JSF lifycycle and aleady 
>>>>>>> reported, then it should let
>>>>>>> * JSF know not to report it again.
>>>>>>> *
>>>>>>> */
>>>>>>> public interface Reportable
>>>>>>> {
>>>>>>>
>>>>>>>   /**
>>>>>>>    * Return false if JSF doesn't need to report this exception, 
>>>>>>> otherwise true.
>>>>>>>    */
>>>>>>>   public boolean isReportingMessage();
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Hongbing
>>>>>>>
>>>>>>>
>

Re: [Trinidad][API] New Exception tells whether JSF needs to report the exception for TRINIDAD-2038

Posted by Blake Sullivan <bl...@oracle.com>.
The issue isn't that the problem has been handled by the model.  It 
hasn't.  Therefore the model has to throw a RuntimeException in this 
case so that the component knows to preserve its local value.  That's 
all good.

The problem occurs if the model has its own mechanisms for reporting 
problems.  In that case, we want to avoid reporting the same problem 
twice and that is where the interface comes in.  The model wants to tell 
the view that there was a problem, but that the model will take care of 
reporting it, so the view needn't bother.

-- Blake Sullivan

On 2/16/11 4:39 PM, Scott O'Bryan wrote:
> If this exception is handled, why is it rethrown?  What would you
> expect Trinidad to do in this case?
>
> On Feb 16, 2011, at 5:37 PM, Hongbing<ho...@oracle.com>  wrote:
>
>> Hi Scott:
>> One example is in the following UIXEditableValue.updateModel(FacesContext context) code,
>>
>>   public void updateModel(FacesContext context)
>>   {
>>     ....
>>     try
>>     {
>>       Object localValue = getLocalValue();
>>       expression.setValue(context.getELContext(), localValue);
>>       setValue(null);
>>       setLocalValueSet(false);
>>       if (_LOG.isFiner())
>>       {
>>         _LOG.finer("Wrote value {0} to model {1} in component {2}",
>>                    new Object[]{localValue,
>>                                 expression.getExpressionString(),
>>                                 this});
>>       }
>>     }
>>     catch (RuntimeException e)
>>     {
>>     ...
>>
>>   expression.setValue(context.getELContext(), localValue) calls binding code and then the model's code, where exception can be thrown.
>>   In the catch part, we want to skip reporting the exception if it is handled by model/controller code.
>>
>>
>> Thanks,
>> Hongbing
>>
>>
>>
>> On 2/16/2011 4:23 PM, Scott O'Bryan wrote:
>>> Hogbing,
>>>
>>> I'm taking a look at the bug now but just so I understand..  When you
>>> refer to JSF, I assume you mean the Trinidad renderkit.  Is that
>>> correct?
>>>
>>> Scott
>>>
>>> On Feb 16, 2011, at 4:23 PM, Hongbing<ho...@oracle.com>   wrote:
>>>
>>>> Hi Pavitra:
>>>> It can happen in update model phase. For example, Model layer throws exception when attribute value validation fails, binding layer detects it and re-throwd new exception with the new interface to JSF. JSF then can handle it accordingly.
>>>>
>>>> thanks,
>>>> Hongbing
>>>>
>>>> On 2/16/2011 2:09 PM, Pavitra Subramaniam wrote:
>>>>> Hello Hongbing,
>>>>>
>>>>> You mentioned that exceptions get thrown by model layer outside of JSF. Can you give an e.g., of when this might occur?
>>>>> How exactly will the interface get used?
>>>>>
>>>>> Thanks
>>>>> Pavitra
>>>>>
>>>>>
>>>>>
>>>>> On 2/16/2011 1:01 PM, Hongbing wrote:
>>>>>> Hi:
>>>>>> This is for JIRA TRINIDAD-2038, please let me know your suggestion.
>>>>>>
>>>>>> There are cases that exception is thrown in update model phase, like model layer validation failure, by model outside of JSF and the exception is also handled and reported outside of JSF. To avoid the component's local value getting reset to null, JSF needs to be notified when it happens. The proposed solution is to re-throw a special exception to JSF to notify it and also let JSF know whether it needs to report the exception.
>>>>>>
>>>>>> Here is the interface of the exception:
>>>>>> package org.apache.myfaces.trinidad.context;
>>>>>>
>>>>>> /**
>>>>>> * Interface for exceptions that tells whether the exception needs to be reported.
>>>>>> * If an exception is thrown during JSF lifycycle and aleady reported, then it should let
>>>>>> * JSF know not to report it again.
>>>>>> *
>>>>>> */
>>>>>> public interface Reportable
>>>>>> {
>>>>>>
>>>>>>   /**
>>>>>>    * Return false if JSF doesn't need to report this exception, otherwise true.
>>>>>>    */
>>>>>>   public boolean isReportingMessage();
>>>>>>
>>>>>> }
>>>>>>
>>>>>> Thanks,
>>>>>> Hongbing
>>>>>>
>>>>>>


Re: [Trinidad][API] New Exception tells whether JSF needs to report the exception for TRINIDAD-2038

Posted by Scott O'Bryan <da...@gmail.com>.
If this exception is handled, why is it rethrown?  What would you
expect Trinidad to do in this case?

On Feb 16, 2011, at 5:37 PM, Hongbing <ho...@oracle.com> wrote:

> Hi Scott:
> One example is in the following UIXEditableValue.updateModel(FacesContext context) code,
>
>  public void updateModel(FacesContext context)
>  {
>    ....
>    try
>    {
>      Object localValue = getLocalValue();
>      expression.setValue(context.getELContext(), localValue);
>      setValue(null);
>      setLocalValueSet(false);
>      if (_LOG.isFiner())
>      {
>        _LOG.finer("Wrote value {0} to model {1} in component {2}",
>                   new Object[]{localValue,
>                                expression.getExpressionString(),
>                                this});
>      }
>    }
>    catch (RuntimeException e)
>    {
>    ...
>
>  expression.setValue(context.getELContext(), localValue) calls binding code and then the model's code, where exception can be thrown.
>  In the catch part, we want to skip reporting the exception if it is handled by model/controller code.
>
>
> Thanks,
> Hongbing
>
>
>
> On 2/16/2011 4:23 PM, Scott O'Bryan wrote:
>> Hogbing,
>>
>> I'm taking a look at the bug now but just so I understand..  When you
>> refer to JSF, I assume you mean the Trinidad renderkit.  Is that
>> correct?
>>
>> Scott
>>
>> On Feb 16, 2011, at 4:23 PM, Hongbing<ho...@oracle.com>  wrote:
>>
>>> Hi Pavitra:
>>> It can happen in update model phase. For example, Model layer throws exception when attribute value validation fails, binding layer detects it and re-throwd new exception with the new interface to JSF. JSF then can handle it accordingly.
>>>
>>> thanks,
>>> Hongbing
>>>
>>> On 2/16/2011 2:09 PM, Pavitra Subramaniam wrote:
>>>> Hello Hongbing,
>>>>
>>>> You mentioned that exceptions get thrown by model layer outside of JSF. Can you give an e.g., of when this might occur?
>>>> How exactly will the interface get used?
>>>>
>>>> Thanks
>>>> Pavitra
>>>>
>>>>
>>>>
>>>> On 2/16/2011 1:01 PM, Hongbing wrote:
>>>>> Hi:
>>>>> This is for JIRA TRINIDAD-2038, please let me know your suggestion.
>>>>>
>>>>> There are cases that exception is thrown in update model phase, like model layer validation failure, by model outside of JSF and the exception is also handled and reported outside of JSF. To avoid the component's local value getting reset to null, JSF needs to be notified when it happens. The proposed solution is to re-throw a special exception to JSF to notify it and also let JSF know whether it needs to report the exception.
>>>>>
>>>>> Here is the interface of the exception:
>>>>> package org.apache.myfaces.trinidad.context;
>>>>>
>>>>> /**
>>>>> * Interface for exceptions that tells whether the exception needs to be reported.
>>>>> * If an exception is thrown during JSF lifycycle and aleady reported, then it should let
>>>>> * JSF know not to report it again.
>>>>> *
>>>>> */
>>>>> public interface Reportable
>>>>> {
>>>>>
>>>>>  /**
>>>>>   * Return false if JSF doesn't need to report this exception, otherwise true.
>>>>>   */
>>>>>  public boolean isReportingMessage();
>>>>>
>>>>> }
>>>>>
>>>>> Thanks,
>>>>> Hongbing
>>>>>
>>>>>

Re: [Trinidad][API] New Exception tells whether JSF needs to report the exception for TRINIDAD-2038

Posted by Hongbing <ho...@oracle.com>.
Hi Scott:
One example is in the following 
UIXEditableValue.updateModel(FacesContext context) code,

   public void updateModel(FacesContext context)
   {
     ....
     try
     {
       Object localValue = getLocalValue();
       expression.setValue(context.getELContext(), localValue);
       setValue(null);
       setLocalValueSet(false);
       if (_LOG.isFiner())
       {
         _LOG.finer("Wrote value {0} to model {1} in component {2}",
                    new Object[]{localValue,
                                 expression.getExpressionString(),
                                 this});
       }
     }
     catch (RuntimeException e)
     {
     ...

   expression.setValue(context.getELContext(), localValue) calls binding 
code and then the model's code, where exception can be thrown.
   In the catch part, we want to skip reporting the exception if it is 
handled by model/controller code.


Thanks,
Hongbing



On 2/16/2011 4:23 PM, Scott O'Bryan wrote:
> Hogbing,
>
> I'm taking a look at the bug now but just so I understand..  When you
> refer to JSF, I assume you mean the Trinidad renderkit.  Is that
> correct?
>
> Scott
>
> On Feb 16, 2011, at 4:23 PM, Hongbing<ho...@oracle.com>  wrote:
>
>> Hi Pavitra:
>> It can happen in update model phase. For example, Model layer throws exception when attribute value validation fails, binding layer detects it and re-throwd new exception with the new interface to JSF. JSF then can handle it accordingly.
>>
>> thanks,
>> Hongbing
>>
>> On 2/16/2011 2:09 PM, Pavitra Subramaniam wrote:
>>> Hello Hongbing,
>>>
>>> You mentioned that exceptions get thrown by model layer outside of JSF. Can you give an e.g., of when this might occur?
>>> How exactly will the interface get used?
>>>
>>> Thanks
>>> Pavitra
>>>
>>>
>>>
>>> On 2/16/2011 1:01 PM, Hongbing wrote:
>>>> Hi:
>>>> This is for JIRA TRINIDAD-2038, please let me know your suggestion.
>>>>
>>>> There are cases that exception is thrown in update model phase, like model layer validation failure, by model outside of JSF and the exception is also handled and reported outside of JSF. To avoid the component's local value getting reset to null, JSF needs to be notified when it happens. The proposed solution is to re-throw a special exception to JSF to notify it and also let JSF know whether it needs to report the exception.
>>>>
>>>> Here is the interface of the exception:
>>>> package org.apache.myfaces.trinidad.context;
>>>>
>>>> /**
>>>> * Interface for exceptions that tells whether the exception needs to be reported.
>>>> * If an exception is thrown during JSF lifycycle and aleady reported, then it should let
>>>> * JSF know not to report it again.
>>>> *
>>>> */
>>>> public interface Reportable
>>>> {
>>>>
>>>>   /**
>>>>    * Return false if JSF doesn't need to report this exception, otherwise true.
>>>>    */
>>>>   public boolean isReportingMessage();
>>>>
>>>> }
>>>>
>>>> Thanks,
>>>> Hongbing
>>>>
>>>>

Re: [Trinidad][API] New Exception tells whether JSF needs to report the exception for TRINIDAD-2038

Posted by Jing Wu <ji...@oracle.com>.
In an ideal world, validation occurs in PROCESS_VALIDATIONS phase of JSF 
lifecycle, so there shouldn't be any problems pushing the validated 
value to the model.

Our Trinidad renderkit implements the lifecycle in such a way that after 
PROCESS_VALIDATIONS phase, the submitted value is cleared, and after 
UPDATE_MODEL phase, the local value is cleared.

But in reality, depending on the implementation of the model, validation 
exception can occur in different phases other than PROCESS_VALIDATIONS 
phase. Thus Trinidad renderkit was enhanced to catch exception in 
UPDATE_MODEL phase and not clear the local value in case an exception is 
caught.

But what to do with this exception? Still, the model implementation 
could choose to have its own error handling logic to report this 
exception, and this exception could be a chain of errors that model 
wants to report all of them. In such case, we would like to have the 
ability to notify Trinidad renderkit that an exception occurs, don't 
clear the local value, but don't report it either since model will 
report it.

Thanks,
Jing

Scott O'Bryan wrote:
> Hogbing,
>
> I'm taking a look at the bug now but just so I understand..  When you
> refer to JSF, I assume you mean the Trinidad renderkit.  Is that
> correct?
>
> Scott
>
> On Feb 16, 2011, at 4:23 PM, Hongbing <ho...@oracle.com> wrote:
>
>   
>> Hi Pavitra:
>> It can happen in update model phase. For example, Model layer throws exception when attribute value validation fails, binding layer detects it and re-throwd new exception with the new interface to JSF. JSF then can handle it accordingly.
>>
>> thanks,
>> Hongbing
>>
>> On 2/16/2011 2:09 PM, Pavitra Subramaniam wrote:
>>     
>>> Hello Hongbing,
>>>
>>> You mentioned that exceptions get thrown by model layer outside of JSF. Can you give an e.g., of when this might occur?
>>> How exactly will the interface get used?
>>>
>>> Thanks
>>> Pavitra
>>>
>>>
>>>
>>> On 2/16/2011 1:01 PM, Hongbing wrote:
>>>       
>>>> Hi:
>>>> This is for JIRA TRINIDAD-2038, please let me know your suggestion.
>>>>
>>>> There are cases that exception is thrown in update model phase, like model layer validation failure, by model outside of JSF and the exception is also handled and reported outside of JSF. To avoid the component's local value getting reset to null, JSF needs to be notified when it happens. The proposed solution is to re-throw a special exception to JSF to notify it and also let JSF know whether it needs to report the exception.
>>>>
>>>> Here is the interface of the exception:
>>>> package org.apache.myfaces.trinidad.context;
>>>>
>>>> /**
>>>> * Interface for exceptions that tells whether the exception needs to be reported.
>>>> * If an exception is thrown during JSF lifycycle and aleady reported, then it should let
>>>> * JSF know not to report it again.
>>>> *
>>>> */
>>>> public interface Reportable
>>>> {
>>>>
>>>>  /**
>>>>   * Return false if JSF doesn't need to report this exception, otherwise true.
>>>>   */
>>>>  public boolean isReportingMessage();
>>>>
>>>> }
>>>>
>>>> Thanks,
>>>> Hongbing
>>>>
>>>>
>>>>         


Re: [Trinidad][API] New Exception tells whether JSF needs to report the exception for TRINIDAD-2038

Posted by Scott O'Bryan <da...@gmail.com>.
Hogbing,

I'm taking a look at the bug now but just so I understand..  When you
refer to JSF, I assume you mean the Trinidad renderkit.  Is that
correct?

Scott

On Feb 16, 2011, at 4:23 PM, Hongbing <ho...@oracle.com> wrote:

> Hi Pavitra:
> It can happen in update model phase. For example, Model layer throws exception when attribute value validation fails, binding layer detects it and re-throwd new exception with the new interface to JSF. JSF then can handle it accordingly.
>
> thanks,
> Hongbing
>
> On 2/16/2011 2:09 PM, Pavitra Subramaniam wrote:
>> Hello Hongbing,
>>
>> You mentioned that exceptions get thrown by model layer outside of JSF. Can you give an e.g., of when this might occur?
>> How exactly will the interface get used?
>>
>> Thanks
>> Pavitra
>>
>>
>>
>> On 2/16/2011 1:01 PM, Hongbing wrote:
>>> Hi:
>>> This is for JIRA TRINIDAD-2038, please let me know your suggestion.
>>>
>>> There are cases that exception is thrown in update model phase, like model layer validation failure, by model outside of JSF and the exception is also handled and reported outside of JSF. To avoid the component's local value getting reset to null, JSF needs to be notified when it happens. The proposed solution is to re-throw a special exception to JSF to notify it and also let JSF know whether it needs to report the exception.
>>>
>>> Here is the interface of the exception:
>>> package org.apache.myfaces.trinidad.context;
>>>
>>> /**
>>> * Interface for exceptions that tells whether the exception needs to be reported.
>>> * If an exception is thrown during JSF lifycycle and aleady reported, then it should let
>>> * JSF know not to report it again.
>>> *
>>> */
>>> public interface Reportable
>>> {
>>>
>>>  /**
>>>   * Return false if JSF doesn't need to report this exception, otherwise true.
>>>   */
>>>  public boolean isReportingMessage();
>>>
>>> }
>>>
>>> Thanks,
>>> Hongbing
>>>
>>>

Re: [Trinidad][API] New Exception tells whether JSF needs to report the exception for TRINIDAD-2038

Posted by Hongbing <ho...@oracle.com>.
Hi Pavitra:
It can happen in update model phase. For example, Model layer throws 
exception when attribute value validation fails, binding layer detects 
it and re-throwd new exception with the new interface to JSF. JSF then 
can handle it accordingly.

thanks,
Hongbing

On 2/16/2011 2:09 PM, Pavitra Subramaniam wrote:
> Hello Hongbing,
>
> You mentioned that exceptions get thrown by model layer outside of 
> JSF. Can you give an e.g., of when this might occur?
> How exactly will the interface get used?
>
> Thanks
> Pavitra
>
>
>
> On 2/16/2011 1:01 PM, Hongbing wrote:
>> Hi:
>> This is for JIRA TRINIDAD-2038, please let me know your suggestion.
>>
>> There are cases that exception is thrown in update model phase, like 
>> model layer validation failure, by model outside of JSF and the 
>> exception is also handled and reported outside of JSF. To avoid the 
>> component's local value getting reset to null, JSF needs to be 
>> notified when it happens. The proposed solution is to re-throw a 
>> special exception to JSF to notify it and also let JSF know whether 
>> it needs to report the exception.
>>
>> Here is the interface of the exception:
>> package org.apache.myfaces.trinidad.context;
>>
>> /**
>>  * Interface for exceptions that tells whether the exception needs to 
>> be reported.
>>  * If an exception is thrown during JSF lifycycle and aleady 
>> reported, then it should let
>>  * JSF know not to report it again.
>>  *
>>  */
>> public interface Reportable
>> {
>>
>>   /**
>>    * Return false if JSF doesn't need to report this exception, 
>> otherwise true.
>>    */
>>   public boolean isReportingMessage();
>>
>> }
>>
>> Thanks,
>> Hongbing
>>
>>

Re: [Trinidad][API] New Exception tells whether JSF needs to report the exception for TRINIDAD-2038

Posted by Pavitra Subramaniam <pa...@oracle.com>.
Hello Hongbing,

You mentioned that exceptions get thrown by model layer outside of JSF. Can you give an e.g., of when this might occur?
How exactly will the interface get used?

Thanks
Pavitra



On 2/16/2011 1:01 PM, Hongbing wrote:
> Hi:
> This is for JIRA TRINIDAD-2038, please let me know your suggestion.
>
> There are cases that exception is thrown in update model phase, like 
> model layer validation failure, by model outside of JSF and the 
> exception is also handled and reported outside of JSF. To avoid the 
> component's local value getting reset to null, JSF needs to be 
> notified when it happens. The proposed solution is to re-throw a 
> special exception to JSF to notify it and also let JSF know whether it 
> needs to report the exception.
>
> Here is the interface of the exception:
> package org.apache.myfaces.trinidad.context;
>
> /**
>  * Interface for exceptions that tells whether the exception needs to 
> be reported.
>  * If an exception is thrown during JSF lifycycle and aleady reported, 
> then it should let
>  * JSF know not to report it again.
>  *
>  */
> public interface Reportable
> {
>
>   /**
>    * Return false if JSF doesn't need to report this exception, 
> otherwise true.
>    */
>   public boolean isReportingMessage();
>
> }
>
> Thanks,
> Hongbing
>
>