Top Description Fields Constructors Methods
com.sun.faces.context

public Class ExceptionHandlerImpl

extends ExceptionHandler
Class Inheritance
Imports
java.util.Collections, .Iterator, .LinkedList, java.util.logging.Level, .Logger, com.sun.faces.renderkit.RenderKitUtils, com.sun.faces.util.FacesLogger, jakarta.el.ELException, jakarta.faces.FacesException, jakarta.faces.application.ProjectStage, jakarta.faces.component.UIComponent, jakarta.faces.context.ExceptionHandler, .ExternalContext, .FacesContext, jakarta.faces.event.AbortProcessingException, .ExceptionQueuedEvent, .ExceptionQueuedEventContext, .PhaseId, .SystemEvent

The default implementation of ExceptionHandler for Faces.

Field Summary

Modifier and TypeField and Description
private final boolean
private ExceptionQueuedEvent
private LinkedList<ExceptionQueuedEvent>
public static final Level
private static final String
private static final String
private static final String
private static final Logger
private LinkedList<ExceptionQueuedEvent>

Constructor Summary

AccessConstructor and Description
public
public
ExceptionHandlerImpl(boolean errorPagePresent)

Method Summary

Modifier and TypeMethod and Description
public ExceptionQueuedEvent
getHandledExceptionQueuedEvent()

Implements abstract jakarta.faces.context.ExceptionHandler.getHandledExceptionQueuedEvent.

Return the first ExceptionQueuedEvent handled by this handler.

public Iterable<ExceptionQueuedEvent>
getHandledExceptionQueuedEvents()

Implements abstract jakarta.faces.context.ExceptionHandler.getHandledExceptionQueuedEvents.

The default implementation must return an Iterable over all ExceptionQueuedEvents that have been handled by the handle method.

private String
getLoggingKey(boolean beforePhase, boolean afterPhase)

public Throwable
getRootCause(Throwable
passed-in wrapped Throwable.
t
)

Implements abstract jakarta.faces.context.ExceptionHandler.getRootCause.

Unwrap the argument t until the unwrapping encounters an Object whose getClass() is not equal to FacesException.class or jakarta.el.ELException.class.

public Iterable<ExceptionQueuedEvent>
getUnhandledExceptionQueuedEvents()

Implements abstract jakarta.faces.context.ExceptionHandler.getUnhandledExceptionQueuedEvents.

Return an Iterable over all ExceptionQueuedEvents that have not yet been handled by the handle method.

public void
handle()

Implements abstract jakarta.faces.context.ExceptionHandler.handle.

Take action to handle the Exception instances residing inside the ExceptionQueuedEvent instances that have been queued by calls to Application().publishEvent(ExceptionQueuedEvent.class, eventContext).

public boolean
isListenerForSource(Object
the source that is inquiring about the appropriateness of sending an event to this listener instance.
source
)

Implements abstract jakarta.faces.context.ExceptionHandler.isListenerForSource.

Implements jakarta.faces.event.SystemEventListener.isListenerForSource.

This method must return true if and only if this listener instance is interested in receiving events from the instance referenced by the source parameter.

private boolean
private void
log(ExceptionQueuedEventContext exceptionContext)

public void
processEvent(SystemEvent
the SystemEvent instance that is being processed.
event
)

Implements abstract jakarta.faces.context.ExceptionHandler.processEvent.

Implements jakarta.faces.event.SystemEventListener.processEvent.

When called, the listener can assume that any guarantees given in the javadoc for the specific SystemEvent subclass are true.

private boolean

Returns:

true if c is FacesException.class or ELException.class
shouldUnwrap
(Class<? extends Throwable>
Throwable implementation class
c
)

private void

Field Detail

errorPagePresentback to summary
private final boolean errorPagePresent
handledback to summary
private ExceptionQueuedEvent handled
handledExceptionsback to summary
private LinkedList<ExceptionQueuedEvent> handledExceptions
INCIDENT_ERRORback to summary
public static final Level INCIDENT_ERROR
LOG_AFTER_KEYback to summary
private static final String LOG_AFTER_KEY
LOG_BEFORE_KEYback to summary
private static final String LOG_BEFORE_KEY
LOG_KEYback to summary
private static final String LOG_KEY
LOGGERback to summary
private static final Logger LOGGER
unhandledExceptionsback to summary
private LinkedList<ExceptionQueuedEvent> unhandledExceptions

Constructor Detail

ExceptionHandlerImplback to summary
public ExceptionHandlerImpl()
ExceptionHandlerImplback to summary
public ExceptionHandlerImpl(boolean errorPagePresent)

Method Detail

getHandledExceptionQueuedEventback to summary
public ExceptionQueuedEvent getHandledExceptionQueuedEvent()

Implements abstract jakarta.faces.context.ExceptionHandler.getHandledExceptionQueuedEvent.

Doc from jakarta.faces.context.ExceptionHandler.getHandledExceptionQueuedEvent.

Return the first ExceptionQueuedEvent handled by this handler.

Returns:ExceptionQueuedEvent

instance of ExceptionQueuedEvent.

Annotations
@Override
getHandledExceptionQueuedEventsback to summary
public Iterable<ExceptionQueuedEvent> getHandledExceptionQueuedEvents()

Implements abstract jakarta.faces.context.ExceptionHandler.getHandledExceptionQueuedEvents.

Doc from jakarta.faces.context.ExceptionHandler.getHandledExceptionQueuedEvents.

The default implementation must return an Iterable over all ExceptionQueuedEvents that have been handled by the handle method.

Returns:Iterable<ExceptionQueuedEvent>

an Iterable over all ExceptionQueuedEvents.

Annotations
@Override
See Also
jakarta.faces.context.ExceptionHandler#getHandledExceptionQueuedEvents()
getLoggingKeyback to summary
private String getLoggingKey(boolean beforePhase, boolean afterPhase)
getRootCauseback to summary
public Throwable getRootCause(Throwable t)

Implements abstract jakarta.faces.context.ExceptionHandler.getRootCause.

Doc from jakarta.faces.context.ExceptionHandler.getRootCause.

Unwrap the argument t until the unwrapping encounters an Object whose getClass() is not equal to FacesException.class or jakarta.el.ELException.class. If there is no root cause, null is returned.

Parameters
t:Throwable

passed-in wrapped Throwable.

Returns:Throwable

unwrapped object.

Annotations
@Override
See Also
ExceptionHandler#getRootCause(Throwable)
getUnhandledExceptionQueuedEventsback to summary
public Iterable<ExceptionQueuedEvent> getUnhandledExceptionQueuedEvents()

Implements abstract jakarta.faces.context.ExceptionHandler.getUnhandledExceptionQueuedEvents.

Doc from jakarta.faces.context.ExceptionHandler.getUnhandledExceptionQueuedEvents.

Return an Iterable over all ExceptionQueuedEvents that have not yet been handled by the handle method.

Returns:Iterable<ExceptionQueuedEvent>

the unhandled set of ExceptionQueuedEvents.

Annotations
@Override
See Also
jakarta.faces.context.ExceptionHandler#getUnhandledExceptionQueuedEvents()
handleback to summary
public void handle() throws FacesException

Implements abstract jakarta.faces.context.ExceptionHandler.handle.

Doc from jakarta.faces.context.ExceptionHandler.handle.

Take action to handle the Exception instances residing inside the ExceptionQueuedEvent instances that have been queued by calls to Application().publishEvent(ExceptionQueuedEvent.class, eventContext). The requirements of the default implementation are detailed in section 6.2.1 "Default ExceptionHandler implementation" of the Jakarta Faces Specification Document.

Annotations
@SuppressWarnings:ThrowableInstanceNeverThrown
@Override
Exceptions
FacesException:
if and only if a problem occurs while performing the algorithm to handle the Exception, not as a means of conveying a handled Exception itself.
See Also
jakarta.faces.context.ExceptionHandler#handle()
isListenerForSourceback to summary
public boolean isListenerForSource(Object source)

Implements abstract jakarta.faces.context.ExceptionHandler.isListenerForSource.

Implements jakarta.faces.event.SystemEventListener.isListenerForSource.

Doc from jakarta.faces.context.ExceptionHandler.isListenerForSource.

This method must return true if and only if this listener instance is interested in receiving events from the instance referenced by the source parameter.

Parameters
source:Object

Doc from jakarta.faces.event.SystemEventListener.isListenerForSource.

the source that is inquiring about the appropriateness of sending an event to this listener instance.

Returns:boolean

Doc from jakarta.faces.event.SystemEventListener.isListenerForSource.

the value as specified above

Annotations
@Override
See Also
jakarta.faces.context.ExceptionHandler#isListenerForSource(Object)
isRethrownback to summary
private boolean isRethrown(Throwable t)
logback to summary
private void log(ExceptionQueuedEventContext exceptionContext)
processEventback to summary
public void processEvent(SystemEvent event) throws AbortProcessingException

Implements abstract jakarta.faces.context.ExceptionHandler.processEvent.

Implements jakarta.faces.event.SystemEventListener.processEvent.

Doc from jakarta.faces.context.ExceptionHandler.processEvent.

When called, the listener can assume that any guarantees given in the javadoc for the specific SystemEvent subclass are true.

Parameters
event:SystemEvent

Doc from jakarta.faces.event.SystemEventListener.processEvent.

the SystemEvent instance that is being processed.

Annotations
@Override
Exceptions
AbortProcessingException:

Doc from jakarta.faces.event.SystemEventListener.processEvent.

if lifecycle processing should cease for this request.

See Also
jakarta.faces.context.ExceptionHandler#processEvent(jakarta.faces.event.SystemEvent)
shouldUnwrapback to summary
private boolean shouldUnwrap(Class<? extends Throwable> c)
Parameters
c:Class<? extends Throwable>

Throwable implementation class

Returns:boolean

true if c is FacesException.class or ELException.class

throwItback to summary
private void throwIt(FacesContext ctx, FacesException fe)