@Override public ErrorMessage getErrorMessage() { Validator.InvalidValueException validationError = getValidationError(); final ErrorMessage superError = getComponentError(); if (superError == null && validationError == null && getCurrentBufferedSourceException() == null) { return null; } // Throw combination of the error types return new CompositeErrorMessage( new ErrorMessage[]{ superError, AbstractErrorMessage .getErrorMessageForException(validationError), AbstractErrorMessage .getErrorMessageForException( getCurrentBufferedSourceException())}); }
private ErrorMessage createErrorMessage(final Throwable t) { final ErrorMessage errorMessage = AbstractErrorMessage.getErrorMessageForException(t); // In case we deal with an System Error, don't show it to user because it's confusing. // Instead show a generic friendly error message. if (errorMessage instanceof SystemError) { return new UserError(i18n.get("error.default")); } return errorMessage; }
@Override public ErrorMessage getErrorMessage() { ErrorMessage superError = super.getErrorMessage(); if (!isReadOnly() && isRequired() && isEmpty()) { ErrorMessage error = AbstractErrorMessage.getErrorMessageForException( new com.vaadin.data.Validator.EmptyValueException(getRequiredError())); if (error != null) { return new CompositeErrorMessage(superError, error); } } return superError; }
@Override public ErrorMessage getErrorMessage() { ErrorMessage superError = super.getErrorMessage(); if (!textArea.isReadOnly() && isRequired() && textArea.isEmpty()) { ErrorMessage error = AbstractErrorMessage.getErrorMessageForException( new com.vaadin.data.Validator.EmptyValueException(getRequiredError())); if (error != null) { return new CompositeErrorMessage(superError, error); } } return superError; }
public static void doDefault(ErrorEvent event) { Throwable t = event.getThrowable(); if (t instanceof SocketException) { // Most likely client browser closed socket getLogger().info( "SocketException in CommunicationManager." + " Most likely client (browser) closed socket."); return; } t = findRelevantThrowable(t); /* * Handle SpringSecurity */ if (t instanceof AccessDeniedException) { EventBus eventBus = SpringApplicationContext.getEventBus(); eventBus.publish(EventScope.UI, eventBus, new AccessDeniedEvent(t)); getLogger().log(Level.FINE, "Access is denied", t); return; } // Finds the original source of the error/exception AbstractComponent component = findAbstractComponent(event); if (component != null) { // Shows the error in AbstractComponent ErrorMessage errorMessage = AbstractErrorMessage .getErrorMessageForException(t); component.setComponentError(errorMessage); } // also print the error on console getLogger().log(Level.SEVERE, "", t); }
@Override public ErrorMessage getErrorMessage() { /* * Check validation errors only if automatic validation is enabled. * Empty, required fields will generate a validation error containing * the requiredError string. For these fields the exclamation mark will * be hidden but the error must still be sent to the client. */ InvalidValueException validationError = null; if (isValidationVisible()) { try { validate(); } catch (InvalidValueException e) { if (!e.isInvisible()) { validationError = e; } } } // Check if there are any systems errors final ErrorMessage superError = super.getErrorMessage(); // Return if there are no errors at all if (superError == null && validationError == null) { return null; } // Throw combination of the error types return new CompositeErrorMessage( new ErrorMessage[] { superError, AbstractErrorMessage.getErrorMessageForException(validationError) }); }
@Override public void setComponentError(ErrorMessage componentError) { super.setComponentError(componentError); setError(componentError == null ? null : ((AbstractErrorMessage) componentError).getMessage()); }