Throwable throwable = unhandledExceptionQueuedEvents.next().getContext().getException();
public void processEvent(SystemEvent exceptionQueuedEvent) { Throwable throwable = ((ExceptionQueuedEvent) exceptionQueuedEvent) .getContext().getException(); if (log.isLoggable(Level.FINE)) { log.log(Level.FINE, "Exception during window disposal " + throwable); } }
protected Throwable getJSF2HandledException(FacesContext facesContext) { Throwable handledException = null; ExceptionHandler exceptionHandler = facesContext.getExceptionHandler(); Iterable<ExceptionQueuedEvent> handledExceptionQueuedEvents = exceptionHandler.getHandledExceptionQueuedEvents(); if (handledExceptionQueuedEvents != null) { Iterator<ExceptionQueuedEvent> itr = handledExceptionQueuedEvents.iterator(); while (itr.hasNext()) { ExceptionQueuedEvent exceptionQueuedEvent = itr.next(); ExceptionQueuedEventContext exceptionQueuedEventContext = exceptionQueuedEvent.getContext(); handledException = exceptionQueuedEventContext.getException(); break; } } return handledException; }
protected Throwable getJSF2UnhandledException(FacesContext facesContext) { Throwable unhandledException = null; ExceptionHandler exceptionHandler = facesContext.getExceptionHandler(); Iterable<ExceptionQueuedEvent> unhandledExceptionQueuedEvents = exceptionHandler.getUnhandledExceptionQueuedEvents(); if (unhandledExceptionQueuedEvents != null) { Iterator<ExceptionQueuedEvent> itr = unhandledExceptionQueuedEvents.iterator(); while (itr.hasNext()) { ExceptionQueuedEvent exceptionQueuedEvent = itr.next(); ExceptionQueuedEventContext exceptionQueuedEventContext = exceptionQueuedEvent.getContext(); unhandledException = exceptionQueuedEventContext.getException(); break; } } return unhandledException; }
protected Throwable getJSF2HandledException(FacesContext facesContext) { Throwable handledException = null; ExceptionHandler exceptionHandler = facesContext.getExceptionHandler(); Iterable<ExceptionQueuedEvent> handledExceptionQueuedEvents = exceptionHandler.getHandledExceptionQueuedEvents(); if (handledExceptionQueuedEvents != null) { Iterator<ExceptionQueuedEvent> itr = handledExceptionQueuedEvents.iterator(); while (itr.hasNext()) { ExceptionQueuedEvent exceptionQueuedEvent = itr.next(); ExceptionQueuedEventContext exceptionQueuedEventContext = exceptionQueuedEvent.getContext(); handledException = exceptionQueuedEventContext.getException(); break; } } return handledException; }
protected Throwable getJSF2UnhandledException(FacesContext facesContext) { Throwable unhandledException = null; ExceptionHandler exceptionHandler = facesContext.getExceptionHandler(); Iterable<ExceptionQueuedEvent> unhandledExceptionQueuedEvents = exceptionHandler.getUnhandledExceptionQueuedEvents(); if (unhandledExceptionQueuedEvents != null) { Iterator<ExceptionQueuedEvent> itr = unhandledExceptionQueuedEvents.iterator(); while (itr.hasNext()) { ExceptionQueuedEvent exceptionQueuedEvent = itr.next(); ExceptionQueuedEventContext exceptionQueuedEventContext = exceptionQueuedEvent.getContext(); unhandledException = exceptionQueuedEventContext.getException(); break; } } return unhandledException; }
log.trace("Handling Exceptions"); for (Iterator<ExceptionQueuedEvent> it = getUnhandledExceptionQueuedEvents().iterator(); it.hasNext();) { Throwable t = it.next().getContext().getException(); log.trace(MessageFormat.format("Handling Exception {0}", t.getClass().getName())); if (!(t instanceof AbortProcessingException)) // Why is this needed
/** * Set every exception as a global FATAL faces message. */ @Override public void handle() { for (Iterator<ExceptionQueuedEvent> iter = getUnhandledExceptionQueuedEvents().iterator(); iter.hasNext();) { addGlobal(new FacesMessage(SEVERITY_FATAL, createFatalMessage(iter.next().getContext().getException()), null)); iter.remove(); } getWrapped().handle(); }
/** * Set every exception as a global FATAL faces message. */ @Override public void handle() { for (Iterator<ExceptionQueuedEvent> iter = getUnhandledExceptionQueuedEvents().iterator(); iter.hasNext();) { addGlobal(new FacesMessage(SEVERITY_FATAL, createFatalMessage(iter.next().getContext().getException()), null)); iter.remove(); } getWrapped().handle(); }
/** * @param context * @throws Throwable */ private void handleException(FacesContext context) { Iterator<ExceptionQueuedEvent> unhandledExceptionQueuedEvents = getUnhandledExceptionQueuedEvents().iterator(); if (unhandledExceptionQueuedEvents.hasNext()) { Throwable exception = unhandledExceptionQueuedEvents.next().getContext().getException(); unhandledExceptionQueuedEvents.remove(); Throwable rootCause = Exceptions.unwrap(exception); if (rootCause instanceof BusinessException) { handleBusinessException(context, (BusinessException) rootCause); return; } //send user to error page when unexpected exceptions are raised goToErrorPage(context, rootCause); } }
/** * @param context * @throws Throwable */ private void handleException(FacesContext context) { Iterator<ExceptionQueuedEvent> unhandledExceptionQueuedEvents = getUnhandledExceptionQueuedEvents().iterator(); if (unhandledExceptionQueuedEvents.hasNext()) { Throwable exception = unhandledExceptionQueuedEvents.next().getContext().getException(); unhandledExceptionQueuedEvents.remove(); Throwable rootCause = Exceptions.unwrap(exception); if (rootCause instanceof BusinessException) { handleBusinessException(context, (BusinessException) rootCause); return; } //send user to error page when unexpected exceptions are raised goToErrorPage(context, rootCause); } }
protected void init(SystemEvent exceptionQueuedEvent) { if (!_inited) { if (exceptionQueuedEvent instanceof ExceptionQueuedEvent) { ExceptionQueuedEvent eqe = (ExceptionQueuedEvent)exceptionQueuedEvent; ExceptionQueuedEventContext eqec = eqe.getContext(); if (eqec != null) { FacesContext facesContext = eqec.getContext(); if (facesContext != null) { init(facesContext); return; } } } init(FacesContext.getCurrentInstance()); } }
public void afterPhase(PhaseEvent event) { FacesContext facesContext = event.getFacesContext(); // stop recording current phase time EtmPoint point = (EtmPoint) facesContext.getAttributes().get(CURRENT_PHASE_POINT); if (point != null) { // alter name if we encounter an exception Iterator<ExceptionQueuedEvent> it = facesContext.getExceptionHandler().getUnhandledExceptionQueuedEvents().iterator(); if (it.hasNext()) { ExceptionQueuedEvent exceptionQueuedEvent = it.next(); point.alterName(point.getName() + " [" + exceptionQueuedEvent.getContext().getException().getClass().getSimpleName() + "]"); } point.collect(); facesContext.getAttributes().remove(CURRENT_PHASE_POINT); } }
public boolean handle(Throwable exception, ExceptionQueuedEvent event) throws Exception { Assert.state(this.messageSource != null, "MessageSource must not be null"); ExceptionQueuedEventContext eventContext = event.getContext(); FacesContext facesContext = eventContext.getContext(); try { String message = getMessage(exception, FacesUtils.getLocale(facesContext)); facesContext.addMessage(null, new FacesMessage(message)); return true; } catch (NoSuchObjectMessageException e) { return false; } }
@SuppressWarnings("unchecked") private boolean handle(ExceptionQueuedEvent event) { Throwable exception = getRootCause(event.getContext().getException()); Class<? extends Throwable> exceptionType = exception.getClass(); for (ExceptionHandler handler : SpringFacesExceptionHandlerSupport.this.exceptionHandlers) { Class<?> handlerGeneric = GenericTypeResolver.resolveTypeArgument(handler.getClass(), ExceptionHandler.class); if (handlerGeneric == null || handlerGeneric.isAssignableFrom(exceptionType)) { try { if (handler.handle(exception, event)) { return true; } } catch (Exception e) { ReflectionUtils.rethrowRuntimeException(e); } } } return false; }
protected boolean isAjaxRequest(SystemEvent exceptionQueuedEvent) { if (_isAjaxRequest == null) { if (exceptionQueuedEvent instanceof ExceptionQueuedEvent) { ExceptionQueuedEvent eqe = (ExceptionQueuedEvent)exceptionQueuedEvent; ExceptionQueuedEventContext eqec = eqe.getContext(); if (eqec != null) { FacesContext facesContext = eqec.getContext(); if (facesContext != null) { return isAjaxRequest(facesContext); } } } return isAjaxRequest(); } return _isAjaxRequest; }
protected boolean isAjaxRequest(SystemEvent exceptionQueuedEvent) { if (_isAjaxRequest == null) { if (exceptionQueuedEvent instanceof ExceptionQueuedEvent) { ExceptionQueuedEvent eqe = (ExceptionQueuedEvent)exceptionQueuedEvent; ExceptionQueuedEventContext eqec = eqe.getContext(); if (eqec != null) { FacesContext facesContext = eqec.getContext(); if (facesContext != null) { return isAjaxRequest(facesContext); } } } return isAjaxRequest(); } return _isAjaxRequest; }
ExceptionQueuedEventContext exceptionQueuedEventContext = exceptionQueuedEvent.getContext();
FacesContext facesContext = exceptionQueuedEvent.getContext().getContext(); exceptionQueuedEvent.getContext().inBeforePhase()) Throwable exception = getRootCause(exceptionQueuedEvent.getContext().getException());
FacesContext facesContext = exceptionQueuedEvent.getContext().getContext(); exceptionQueuedEvent.getContext().inBeforePhase()) Throwable exception = getRootCause(exceptionQueuedEvent.getContext().getException());