/** * {@inheritDoc} */ public List<SystemEventListener> getListenersForEventClass(Class<? extends SystemEvent> facesEventClass) { return Collections.singletonList((SystemEventListener)getContext().getExceptionHandler()); }
private void log(ExceptionQueuedEventContext exceptionContext) { UIComponent c = exceptionContext.getComponent(); boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); Throwable t = exceptionContext.getException(); String key = getLoggingKey(beforePhase, afterPhase); // If both SEVERE and INCIDENT_ERROR are loggable, just use // INCIDENT ERROR, otherwise just use SEVERE. Level level = LOGGER.isLoggable(INCIDENT_ERROR) && LOGGER.isLoggable(Level.SEVERE) ? INCIDENT_ERROR : Level.SEVERE; if (LOGGER.isLoggable(level)) { LOGGER.log(level, key, new Object[] { t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); if (t.getMessage() != null) { LOGGER.log(level, t.getMessage(), t); } else { LOGGER.log(level, "No associated message", t); } } }
private void log(ExceptionQueuedEventContext exceptionContext) { UIComponent c = exceptionContext.getComponent(); boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); Throwable t = exceptionContext.getException(); String key = getLoggingKey(beforePhase, afterPhase); if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.log(Level.SEVERE, key, new Object[] { t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); LOGGER.log(Level.SEVERE, t.getMessage(), t); } }
private void log(ExceptionQueuedEventContext exceptionContext) { UIComponent c = exceptionContext.getComponent(); boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); Throwable t = exceptionContext.getException(); String key = getLoggingKey(beforePhase, afterPhase); // If both SEVERE and INCIDENT_ERROR are loggable, just use // INCIDENT ERROR, otherwise just use SEVERE. Level level = LOGGER.isLoggable(INCIDENT_ERROR) && LOGGER.isLoggable(Level.SEVERE) ? INCIDENT_ERROR : Level.SEVERE; if (LOGGER.isLoggable(level)) { LOGGER.log(level, key, new Object[] { t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); if (t.getMessage() != null) { LOGGER.log(level, t.getMessage(), t); } else { LOGGER.log(level, "No associated message", t); } } }
private void log(ExceptionQueuedEventContext exceptionContext) { UIComponent c = exceptionContext.getComponent(); boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); Throwable t = exceptionContext.getException(); String key = getLoggingKey(beforePhase, afterPhase); if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.log(Level.SEVERE, key, new Object[] { t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); LOGGER.log(Level.SEVERE, t.getMessage(), t); } }
private void log(ExceptionQueuedEventContext exceptionContext) { UIComponent c = exceptionContext.getComponent(); boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); Throwable t = exceptionContext.getException(); String key = getLoggingKey(beforePhase, afterPhase); // If both SEVERE and INCIDENT_ERROR are loggable, just use // INCIDENT ERROR, otherwise just use SEVERE. Level level = LOGGER.isLoggable(INCIDENT_ERROR) && LOGGER.isLoggable(Level.SEVERE) ? INCIDENT_ERROR : Level.SEVERE; if (LOGGER.isLoggable(level)) { LOGGER.log(level, key, new Object[] { t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); if (t.getMessage() != null) { LOGGER.log(level, t.getMessage(), t); } else { LOGGER.log(level, "No associated message", t); } } }
private void log(ExceptionQueuedEventContext exceptionContext) { UIComponent c = exceptionContext.getComponent(); boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); Throwable t = exceptionContext.getException(); String key = getLoggingKey(beforePhase, afterPhase); // If both SEVERE and INCIDENT_ERROR are loggable, just use // INCIDENT ERROR, otherwise just use SEVERE. Level level = LOGGER.isLoggable(INCIDENT_ERROR) && LOGGER.isLoggable(Level.SEVERE) ? INCIDENT_ERROR : Level.SEVERE; if (LOGGER.isLoggable(level)) { LOGGER.log(level, key, new Object[] { t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); if (t.getMessage() != null) { LOGGER.log(level, t.getMessage(), t); } else { LOGGER.log(level, "No associated message", t); } } }
private void log(ExceptionQueuedEventContext exceptionContext) { UIComponent c = exceptionContext.getComponent(); boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); Throwable t = exceptionContext.getException(); String key = getLoggingKey(beforePhase, afterPhase); if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.log(Level.SEVERE, key, new Object[] { t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); LOGGER.log(Level.SEVERE, t.getMessage(), t); } }
private void log(ExceptionQueuedEventContext exceptionContext) { UIComponent c = exceptionContext.getComponent(); boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); Throwable t = exceptionContext.getException(); String key = getLoggingKey(beforePhase, afterPhase); if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.log(Level.SEVERE, key, new Object[] { t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); LOGGER.log(Level.SEVERE, t.getMessage(), t); } }
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 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; } }
private void log(ExceptionQueuedEventContext exceptionContext) { Throwable t = exceptionContext.getException(); UIComponent c = exceptionContext.getComponent(); if (t instanceof UpdateModelException) { FacesContext context = FacesContext.getCurrentInstance(); FacesMessage message = ((UpdateModelException)t).getFacesMessage(); LOGGER.log(Level.SEVERE, message.getSummary(), t.getCause()); context.addMessage(c.getClientId(context), message); } else { boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); String key = getLoggingKey(beforePhase, afterPhase); if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.log(Level.SEVERE, key, new Object[]{t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); LOGGER.log(Level.SEVERE, t.getMessage(), t); } } }
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; }
private void log(ExceptionQueuedEventContext exceptionContext) { Throwable t = exceptionContext.getException(); UIComponent c = exceptionContext.getComponent(); if (t instanceof UpdateModelException) { FacesContext context = FacesContext.getCurrentInstance(); FacesMessage message = ((UpdateModelException)t).getFacesMessage(); LOGGER.log(Level.SEVERE, message.getSummary(), t.getCause()); context.addMessage(c.getClientId(context), message); } else { boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); String key = getLoggingKey(beforePhase, afterPhase); if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.log(Level.SEVERE, key, new Object[]{t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); LOGGER.log(Level.SEVERE, t.getMessage(), t); } } }
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; }
private void log(ExceptionQueuedEventContext exceptionContext) { Throwable t = exceptionContext.getException(); UIComponent c = exceptionContext.getComponent(); if (t instanceof UpdateModelException) { FacesContext context = FacesContext.getCurrentInstance(); FacesMessage message = ((UpdateModelException)t).getFacesMessage(); LOGGER.log(Level.SEVERE, message.getSummary(), t.getCause()); context.addMessage(c.getClientId(context), message); } else { boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); String key = getLoggingKey(beforePhase, afterPhase); if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.log(Level.SEVERE, key, new Object[]{t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); LOGGER.log(Level.SEVERE, t.getMessage(), t); } } }
private void log(ExceptionQueuedEventContext exceptionContext) { Throwable t = exceptionContext.getException(); UIComponent c = exceptionContext.getComponent(); if (t instanceof UpdateModelException) { FacesContext context = FacesContext.getCurrentInstance(); FacesMessage message = ((UpdateModelException)t).getFacesMessage(); LOGGER.log(Level.SEVERE, message.getSummary(), t.getCause()); context.addMessage(c.getClientId(context), message); } else { boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); String key = getLoggingKey(beforePhase, afterPhase); if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.log(Level.SEVERE, key, new Object[]{t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); LOGGER.log(Level.SEVERE, t.getMessage(), t); } } }
private void log(ExceptionQueuedEventContext exceptionContext) { Throwable t = exceptionContext.getException(); UIComponent c = exceptionContext.getComponent(); if (t instanceof UpdateModelException) { FacesContext context = FacesContext.getCurrentInstance(); FacesMessage message = ((UpdateModelException)t).getFacesMessage(); LOGGER.log(Level.SEVERE, message.getSummary(), t.getCause()); context.addMessage(c.getClientId(context), message); } else { boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); String key = getLoggingKey(beforePhase, afterPhase); if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.log(Level.SEVERE, key, new Object[]{t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); LOGGER.log(Level.SEVERE, t.getMessage(), t); } } }
private void log(ExceptionQueuedEventContext exceptionContext) { Throwable t = exceptionContext.getException(); UIComponent c = exceptionContext.getComponent(); if (t instanceof UpdateModelException) { FacesContext context = FacesContext.getCurrentInstance(); FacesMessage message = ((UpdateModelException)t).getFacesMessage(); LOGGER.log(Level.SEVERE, message.getSummary(), t.getCause()); context.addMessage(c.getClientId(context), message); } else { boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); String key = getLoggingKey(beforePhase, afterPhase); if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.log(Level.SEVERE, key, new Object[]{t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); LOGGER.log(Level.SEVERE, t.getMessage(), t); } } }
private void log(ExceptionQueuedEventContext exceptionContext) { Throwable t = exceptionContext.getException(); UIComponent c = exceptionContext.getComponent(); if (t instanceof UpdateModelException) { FacesContext context = FacesContext.getCurrentInstance(); FacesMessage message = ((UpdateModelException)t).getFacesMessage(); LOGGER.log(Level.SEVERE, message.getSummary(), t.getCause()); context.addMessage(c.getClientId(context), message); } else { boolean beforePhase = exceptionContext.inBeforePhase(); boolean afterPhase = exceptionContext.inAfterPhase(); PhaseId phaseId = exceptionContext.getPhaseId(); String key = getLoggingKey(beforePhase, afterPhase); if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.log(Level.SEVERE, key, new Object[]{t.getClass().getName(), phaseId.toString(), ((c != null) ? c.getClientId(exceptionContext.getContext()) : ""), t.getMessage()}); LOGGER.log(Level.SEVERE, t.getMessage(), t); } } }