[JAVASERVERFACES_SPEC_PUBLIC-1216] Inconsistent exception handling for phaselisteners Created: 14/Aug/13  Updated: 08/Sep/15  Resolved: 08/Sep/15

Status: Resolved
Project: javaserverfaces-spec-public
Component/s: Lifecycle
Affects Version/s: 2.1, 2.2
Fix Version/s: 2.3

Type: Improvement Priority: Minor
Reporter: frederickkaempfer Assignee: Ed Burns
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
is related to JAVASERVERFACES-4054 Implement changes to bring parity bet... Closed


Exception handling for phase listeners behaves differently depending on if they are registered globally in faces-config.xml or with f:phaseListener for a particular view root.

In the first (global) case any exception thrown by them gets forwarded to an exception handler as described in the spec.

In the second (per view root) case all exceptions get logged and swallowed as described in the UIViewRoot documentation.

This inconsistent behavior adds increased complexity when implementing PhaseListeners. Ideally both cases should forward any exception to the exception handler so they can be handled there.

See also the discussion of the problem in: https://java.net/jira/browse/JAVASERVERFACES-2985

Comment by Ed Burns [ 01/Aug/14 ]

Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

Comment by pnicoluc [ 03/Sep/15 ]

Proposed solution:


Update UIViewRoot.encodeBegin(FacesContext context) javadoc by removing the
following text:

"Any errors that occur during invocation of any of the the beforePhase
listeners must be logged and swallowed."

Update UIViewRoot.encodeEnd(FacesContext context) javadoc by removing the
following text:

"Any errors that occur during invocation of the afterPhase
listener must be logged and swallowed. "

Then an update to the implementation would need to be made to publish the
exceptions being thrown by the beforePhase and afterPhase of the
PhaseListeners rather than having them logged and swallowed.

Generated at Wed Nov 25 13:39:10 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.