List of usage examples for com.vaadin.server SystemError SystemError
public SystemError(Throwable cause)
From source file:de.symeda.sormas.ui.SormasErrorHandler.java
License:Open Source License
/** * Taken and cleaned from AbstractErrorMessage *///from w ww . ja v a 2 s. co m public static ErrorMessage getErrorMessageForException(Throwable t) { //return AbstractErrorMessage.getErrorMessageForException(t) if (null == t) { return null; } else if (t instanceof ErrorMessage) { // legacy case for custom error messages return (ErrorMessage) t; } else if (t instanceof Validator.InvalidValueException) { LocalUserError error = new LocalUserError(((Validator.InvalidValueException) t).getHtmlMessage(), ContentMode.HTML, ErrorLevel.ERROR); for (Validator.InvalidValueException nestedException : ((Validator.InvalidValueException) t) .getCauses()) { error.addCause(getErrorMessageForException(nestedException)); } return error; } else if (t instanceof Buffered.SourceException) { // no message, only the causes to be painted LocalUserError error = new LocalUserError(null); // in practice, this was always ERROR in Vaadin 6 unless tweaked in // custom exceptions implementing ErrorMessage error.setErrorLevel(ErrorLevel.ERROR); // causes for (Throwable nestedException : ((Buffered.SourceException) t).getCauses()) { error.addCause(getErrorMessageForException(nestedException)); } return error; } else { Throwable rootCause = ExceptionUtils.getRootCause(t); if (rootCause instanceof ValidationRuntimeException) { LocalUserError error; if (rootCause instanceof OutdatedEntityException) { error = new LocalUserError(I18nProperties.getString(Strings.errorEntityOutdated), ContentMode.HTML, ErrorLevel.WARNING); } else { error = new LocalUserError(rootCause.getMessage(), ContentMode.HTML, ErrorLevel.WARNING); } return error; } else { String message = t.getMessage(); if (message == null) { message = I18nProperties.getString(Strings.errorOccurred); } return new SystemError(message); } } }
From source file:edu.kit.dama.ui.admin.administration.user.UserDataForm.java
License:Apache License
private void updateComponentValues(UserData userData) { clearUserDataComponents();/*from ww w . j a v a 2 s. co m*/ if (userData == null) { //do nothing return; } getUserIdField().setValue(Long.toString(userData.getUserId())); getDistinguishedNameField().setValue(userData.getDistinguishedName()); getFirstNameField().setValue(userData.getFirstName()); getLastNameField().setValue(userData.getLastName()); getEmailField().setValue(userData.getEmail()); getValidFromField().setValue(userData.getValidFrom()); getValidFromField().setValue(userData.getValidFrom()); getValidUntilField().setValue(userData.getValidUntil()); try { Role maxRole = (Role) UserServiceLocal.getSingleton() .getRoleRestriction(new UserId(userData.getDistinguishedName()), UIHelper.getSessionContext()); getMaximumRoleBox().setValue(maxRole); } catch (AuthorizationException ex) { getMaximumRoleBox() .setComponentError(new SystemError("Failed to determine maximum role for selected user.")); LOGGER.error("Failed to obtain max. role for user '" + userData.getDistinguishedName(), ex); } }