List of usage examples for javax.el ELException getCause
public synchronized Throwable getCause()
From source file:org.nuxeo.ecm.platform.ui.web.component.file.UIInputFile.java
@Override public void updateModel(FacesContext context) { if (context == null) { throw new IllegalArgumentException(); }/*from w ww.jav a 2 s. co m*/ if (!isValid() || !isLocalValueSet()) { return; } ValueExpression ve = getValueExpression("value"); if (ve == null) { return; } try { InputFileInfo local = getFileInfoLocalValue(); String choice = local.getConvertedChoice(); // set blob and filename if (InputFileChoice.DELETE.equals(choice)) { // set filename first to avoid error in case it maps the blob filename ValueExpression vef = getValueExpression("filename"); if (vef != null) { vef.setValue(context.getELContext(), local.getConvertedFilename()); } ve.setValue(context.getELContext(), local.getConvertedBlob()); setValue(null); setLocalValueSet(false); } else if (InputFileChoice.isUploadOrKeepTemp(choice)) { // set blob first to avoid error in case the filename maps the blob filename ve.setValue(context.getELContext(), local.getConvertedBlob()); setValue(null); setLocalValueSet(false); ValueExpression vef = getValueExpression("filename"); if (vef != null) { vef.setValue(context.getELContext(), local.getConvertedFilename()); } } else if (InputFileChoice.KEEP.equals(choice)) { // reset local value setValue(null); setLocalValueSet(false); if (getEditFilename()) { // set filename ValueExpression vef = getValueExpression("filename"); if (vef != null) { vef.setValue(context.getELContext(), local.getConvertedFilename()); } } } return; } catch (ELException e) { String messageStr = e.getMessage(); Throwable result = e.getCause(); while (result != null && result instanceof ELException) { messageStr = result.getMessage(); result = result.getCause(); } FacesMessage message; if (messageStr == null) { message = MessageFactory.getMessage(context, UPDATE_MESSAGE_ID, MessageFactory.getLabel(context, this)); } else { message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageStr, messageStr); } context.addMessage(getClientId(context), message); setValid(false); } catch (IllegalArgumentException | ConverterException e) { FacesMessage message = MessageFactory.getMessage(context, UPDATE_MESSAGE_ID, MessageFactory.getLabel(context, this)); context.addMessage(getClientId(context), message); setValid(false); } }
From source file:org.nuxeo.ecm.platform.ui.web.component.list.UIEditableList.java
/** * Overridden to handle diff boolean value, see NXP-16515. *///w ww . ja va 2 s . com public void updateModel(FacesContext context) { if (context == null) { throw new NullPointerException(); } if (!isValid() || !isLocalValueSet()) { return; } ValueExpression ve = getValueExpression("value"); if (ve != null) { Throwable caught = null; FacesMessage message = null; try { Boolean setDiff = getDiff(); if (setDiff) { // set list diff instead of the whole list // FIXME NXP-16515 // EditableModel model = getEditableModel(); // ve.setValue(context.getELContext(), model.getListDiff()); ve.setValue(context.getELContext(), getLocalValue()); } else { ve.setValue(context.getELContext(), getLocalValue()); } setValue(null); setLocalValueSet(false); } catch (ELException e) { caught = e; String messageStr = e.getMessage(); Throwable result = e.getCause(); while (null != result && result.getClass().isAssignableFrom(ELException.class)) { messageStr = result.getMessage(); result = result.getCause(); } if (null == messageStr) { message = MessageFactory.getMessage(context, UPDATE_MESSAGE_ID, MessageFactory.getLabel(context, this)); } else { message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageStr, messageStr); } setValid(false); } catch (Exception e) { caught = e; message = MessageFactory.getMessage(context, UPDATE_MESSAGE_ID, MessageFactory.getLabel(context, this)); setValid(false); } if (caught != null) { assert message != null; // PENDING(edburns): verify this is in the spec. UpdateModelException toQueue = new UpdateModelException(message, caught); ExceptionQueuedEventContext eventContext = new ExceptionQueuedEventContext(context, toQueue, this, PhaseId.UPDATE_MODEL_VALUES); context.getApplication().publishEvent(context, ExceptionQueuedEvent.class, eventContext); } } }
From source file:org.richfaces.component.UIDatascroller.java
private void updateModel(int newPage) { UIData dataTable = getDataTable();/*from ww w .j a v a2 s . c om*/ if (isRendered(dataTable)) { dataTable.setFirst((newPage - 1) * getRows(dataTable)); } Map<String, Object> attributes = dataTable.getAttributes(); attributes.put(SCROLLER_STATE_ATTRIBUTE, newPage); FacesContext context = getFacesContext(); ValueExpression ve = getValueExpression("page"); if (ve != null) { try { ve.setValue(context.getELContext(), newPage); attributes.remove(SCROLLER_STATE_ATTRIBUTE); } catch (ELException e) { String messageStr = e.getMessage(); Throwable result = e.getCause(); while (null != result && result.getClass().isAssignableFrom(ELException.class)) { messageStr = result.getMessage(); result = result.getCause(); } FacesMessage message; if (null == messageStr) { message = MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID, new Object[] { MessageUtil.getLabel(context, this) }); } else { message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageStr, messageStr); } context.getExternalContext().log(message.getSummary(), result); context.addMessage(getClientId(context), message); context.renderResponse(); } catch (IllegalArgumentException e) { FacesMessage message = MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID, new Object[] { MessageUtil.getLabel(context, this) }); context.getExternalContext().log(message.getSummary(), e); context.addMessage(getClientId(context), message); context.renderResponse(); } catch (Exception e) { FacesMessage message = MessageUtil.getMessage(context, UIInput.UPDATE_MESSAGE_ID, new Object[] { MessageUtil.getLabel(context, this) }); context.getExternalContext().log(message.getSummary(), e); context.addMessage(getClientId(context), message); context.renderResponse(); } } }