You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Marios Kerkemezos <ma...@yahoo.co.uk> on 2006/05/17 18:51:12 UTC

MyFaces 1.1.3 & Exceptions in PhaseListeners

  Dear all, 

   
  I recently upgraded my application from MyFaces 1.1 to MyFaces core 1.1.3 /Tomahawk 1.1.2 and amongst other differences between the two versions I discovered the following:
   
  When an exception is thrown during the execution of a PhaseListener (either during its beforePhase or afterPhase method), the exception is consumed by a new class (PhaseListenerManager.java), which simply logs it and does not let it propagate any further:
   
  …
    try {
    phaseListener.beforePhase(new PhaseEvent(facesContext, phaseId, lifecycle));
      beforePhaseSuccess[i] = true;
  } catch (Exception e) {
      beforePhaseSuccess[i] = false; // redundant - for clarity
      log.error("Exception in PhaseListener " + phaseId.toString() + " beforePhase.", e);
      return;
  }
  ...

   
  Is this the expected behavior?  In MyFaces 1.1.1 any exceptions thrown inside phase listeners were directly handled by the FacesServlet class and eventually propagated all the way up (to servlet filters etc.).
   
    Perhaps this change is not news to you (I worked strictly with the 1.1 distribution all this time, and did not closely follow the nightly build changes), but if someone could clarify whether this is a bug or a more accurate implementation of the JSF scpec I would appreciate it.

 
  Thank you in advance
  Mario
   
  


Re: MyFaces 1.1.3 & Exceptions in PhaseListeners

Posted by Mike Kienenberger <mk...@gmail.com>.
On 5/17/06, Marios Kerkemezos <ma...@yahoo.co.uk> wrote:
>   I recently upgraded my application from MyFaces 1.1 to MyFaces core 1.1.3 /Tomahawk 1.1.2 and amongst other differences between the two versions I discovered the following:
>
>   When an exception is thrown during the execution of a PhaseListener (either during its beforePhase or afterPhase method), the exception is consumed by a new class (PhaseListenerManager.java), which simply logs it and does not let it propagate any further:
>
>   …
>     try {
>     phaseListener.beforePhase(new PhaseEvent(facesContext, phaseId, lifecycle));
>       beforePhaseSuccess[i] = true;
>   } catch (Exception e) {
>       beforePhaseSuccess[i] = false; // redundant - for clarity
>       log.error("Exception in PhaseListener " + phaseId.toString() + " beforePhase.", e);
>       return;
>   }
>   ...
>
>
>   Is this the expected behavior?  In MyFaces 1.1.1 any exceptions thrown inside phase listeners were directly handled by the FacesServlet class and eventually propagated all the way up (to servlet filters etc.).

Take a look at this issue and see if it answers your questions.

http://issues.apache.org/jira/browse/MYFACES-1205