Revision 73a2fd47
Added by Andreas Kohlbecker over 5 years ago
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java | ||
---|---|---|
428 | 428 |
fieldGroup.commit(); |
429 | 429 |
} catch (CommitException e) { |
430 | 430 |
fieldGroup.getFields().forEach(f -> ((AbstractField<?>)f).setValidationVisible(true)); |
431 |
if(e.getCause() != null && e.getCause() instanceof FieldGroupInvalidValueException){ |
|
432 |
FieldGroupInvalidValueException invalidValueException = (FieldGroupInvalidValueException)e.getCause(); |
|
433 |
updateFieldNotifications(invalidValueException.getInvalidFields()); |
|
434 |
Notification.show("The entered data in " + invalidValueException.getInvalidFields().size() + " fields is incomplete or invalid."); |
|
435 |
} else if(e.getCause() != null && e.getCause().getCause() != null && e.getCause().getCause() instanceof PermissionDeniedException){ |
|
436 |
PermissionDeniedException permissionDeniedException = (PermissionDeniedException)e.getCause().getCause(); |
|
437 |
Notification.show("Permission denied", permissionDeniedException.getMessage(), Type.ERROR_MESSAGE); |
|
438 |
} else { |
|
431 |
Throwable cause = e.getCause(); |
|
432 |
while(cause != null) { |
|
433 |
if(cause instanceof FieldGroupInvalidValueException){ |
|
434 |
FieldGroupInvalidValueException invalidValueException = (FieldGroupInvalidValueException)cause; |
|
435 |
updateFieldNotifications(invalidValueException.getInvalidFields()); |
|
436 |
int invalidFieldsCount = invalidValueException.getInvalidFields().size(); |
|
437 |
Notification.show("The entered data in " + invalidFieldsCount + " field" + (invalidFieldsCount > 1 ? "s": "") + " is incomplete or invalid."); |
|
438 |
break; |
|
439 |
} else if(cause instanceof PermissionDeniedException){ |
|
440 |
PermissionDeniedException permissionDeniedException = (PermissionDeniedException)cause; |
|
441 |
Notification.show("Permission denied", permissionDeniedException.getMessage(), Type.ERROR_MESSAGE); |
|
442 |
break; |
|
443 |
} |
|
444 |
cause = cause.getCause(); |
|
445 |
} |
|
446 |
if(cause == null){ |
|
447 |
// no known exception type found |
|
439 | 448 |
throw new PopupEditorException("Error saving popup editor", this, e); |
440 | 449 |
} |
450 |
|
|
441 | 451 |
} |
442 | 452 |
} |
443 | 453 |
|
Also available in: Unified diff
fix #7925 more sofisticated exception handling in AbstractPopupEditor.save()