Revision 592b9851
Added by Andreas Kohlbecker about 5 years ago
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java | ||
---|---|---|
13 | 13 |
import java.util.HashSet; |
14 | 14 |
import java.util.List; |
15 | 15 |
import java.util.Map; |
16 |
import java.util.Optional; |
|
16 | 17 |
import java.util.Set; |
17 | 18 |
import java.util.Stack; |
18 | 19 |
|
... | ... | |
22 | 23 |
|
23 | 24 |
import com.vaadin.data.Validator.InvalidValueException; |
24 | 25 |
import com.vaadin.data.fieldgroup.BeanFieldGroup; |
26 |
import com.vaadin.data.fieldgroup.FieldGroup; |
|
25 | 27 |
import com.vaadin.data.fieldgroup.FieldGroup.CommitEvent; |
26 | 28 |
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; |
27 | 29 |
import com.vaadin.data.fieldgroup.FieldGroup.CommitHandler; |
... | ... | |
445 | 447 |
} |
446 | 448 |
if(cause == null){ |
447 | 449 |
// no known exception type found |
450 |
logger.error("Unhandled exception", e); |
|
448 | 451 |
throw new PopupEditorException("Error saving popup editor", this, e); |
449 | 452 |
} |
450 | 453 |
|
... | ... | |
594 | 597 |
while(parentComponent != null){ |
595 | 598 |
logger.debug("parentComponent: " + parentComponent.getClass().getSimpleName()); |
596 | 599 |
if(NestedFieldGroup.class.isAssignableFrom(parentComponent.getClass()) && AbstractField.class.isAssignableFrom(parentComponent.getClass())){ |
597 |
Object propId = ((NestedFieldGroup)parentComponent).getFieldGroup().getPropertyId(parentField); |
|
598 |
if(propId != null){ |
|
599 |
logger.debug("propId: " + propId.toString()); |
|
600 |
nestedPropertyIds.addParent(propId); |
|
600 |
Optional<FieldGroup> parentFieldGroup = ((NestedFieldGroup)parentComponent).getFieldGroup(); |
|
601 |
if(parentFieldGroup.isPresent()){ |
|
602 |
Object propId = parentFieldGroup.get().getPropertyId(parentField); |
|
603 |
if(propId != null){ |
|
604 |
logger.debug("propId: " + propId.toString()); |
|
605 |
nestedPropertyIds.addParent(propId); |
|
606 |
} |
|
607 |
logger.debug("parentField: " + parentField.getClass().getSimpleName()); |
|
608 |
parentField = (Field)parentComponent; |
|
609 |
} else { |
|
610 |
logger.debug("parentFieldGroup is null, continuing ..."); |
|
601 | 611 |
} |
602 |
logger.debug("parentField: " + parentField.getClass().getSimpleName()); |
|
603 |
parentField = (Field)parentComponent; |
|
604 | 612 |
} else if(parentComponent == this) { |
605 | 613 |
// we reached the editor itself |
606 | 614 |
Object propId = fieldGroup.getPropertyId(parentField); |
Also available in: Unified diff
ref #8107 getFieldGroup() returns Optional to avoid NPEs and logging errors before rethrowing as PopupEditorException