in jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/listener/request/DefaultErrorViewExceptionHandler.java [66:133]
public void handle() throws FacesException
{
lazyInit();
Iterator<ExceptionQueuedEvent> exceptionQueuedEventIterator = getUnhandledExceptionQueuedEvents().iterator();
while (exceptionQueuedEventIterator.hasNext())
{
ExceptionQueuedEventContext exceptionQueuedEventContext =
(ExceptionQueuedEventContext) exceptionQueuedEventIterator.next().getSource();
@SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
Throwable throwable = exceptionQueuedEventContext.getException();
String viewId = null;
if (throwable instanceof ViewExpiredException)
{
viewId = ((ViewExpiredException) throwable).getViewId();
}
else if(throwable instanceof ContextNotActiveException)
{
FacesContext facesContext = exceptionQueuedEventContext.getContext();
Flash flash = facesContext.getExternalContext().getFlash();
//the error page uses a cdi scope which isn't active as well
if(flash.containsKey(ContextNotActiveException.class.getName()))
{
break;
}
if(facesContext.getViewRoot() != null)
{
viewId = facesContext.getViewRoot().getViewId();
}
}
if(viewId != null)
{
FacesContext facesContext = exceptionQueuedEventContext.getContext();
UIViewRoot uiViewRoot = facesContext.getApplication().getViewHandler().createView(facesContext, viewId);
if (uiViewRoot == null)
{
continue;
}
if(facesContext.isProjectStage(ProjectStage.Development) ||
ProjectStageProducer.getInstance().getProjectStage() ==
org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStage.Development)
{
throwable.printStackTrace();
}
facesContext.setViewRoot(uiViewRoot);
exceptionQueuedEventIterator.remove();
Flash flash = facesContext.getExternalContext().getFlash();
flash.put(throwable.getClass().getName(), throwable);
flash.keep(throwable.getClass().getName());
this.viewNavigationHandler.navigateTo(DefaultErrorView.class);
break;
}
}
this.wrapped.handle();
}