Project

General

Profile

« Previous | Next » 

Revision 595150ac

Added by Andreas Kohlbecker about 5 years ago

ref #8099 better logging of error conditions and more robust error handling in save()

View differences:

src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java
448 448
            }
449 449
            if(cause == null){
450 450
                // no known exception type found
451
                logger.error("Unhandled exception", e);
452
                throw new PopupEditorException("Error saving popup editor", this, e);
451
                logger.error(e);
452
                PopupEditorException pee = null;
453
                try {
454
                    pee  = new PopupEditorException("Error saving popup editor", this, e);
455
                } catch (Throwable t) {
456
                    /* IGORE errors which happen during the construction of the PopupEditorException */
457
                }
458
                if(pee != null){
459
                    throw pee;
460
                }
461
                throw new RuntimeException(e);
453 462
            }
454 463

  
455 464
        }
......
598 607
            while(parentComponent != null){
599 608
                logger.debug("parentComponent: " + parentComponent.getClass().getSimpleName());
600 609
                if(NestedFieldGroup.class.isAssignableFrom(parentComponent.getClass()) && AbstractField.class.isAssignableFrom(parentComponent.getClass())){
601
                    Optional<FieldGroup> parentFieldGroup = ((NestedFieldGroup)parentComponent).getFieldGroup();
610
                    try {
602 611
                    if(parentFieldGroup.isPresent()){
603 612
                        Object propId = parentFieldGroup.get().getPropertyId(parentField);
604 613
                        if(propId != null){
......
607 616
                        }
608 617
                        logger.debug("parentField: " + parentField.getClass().getSimpleName());
609 618
                        parentField = (Field)parentComponent;
610
                    } else {
611
                        logger.debug("parentFieldGroup is null, continuing ...");
619
                    } catch (NullPointerException e){
620
                        String causeDetail = "NullPointerException";
621
                        if(((NestedFieldGroup)parentComponent).getFieldGroup() == null){
622
                            causeDetail = "parentComponent.getFieldGroup() is NULL, this should not happen.";
623
                        }
624
                        logger.error(causeDetail, e);
612 625
                    }
613 626
                } else if(parentComponent == this) {
614 627
                    // we reached the editor itself

Also available in: Unified diff