Project

General

Profile

« Previous | Next » 

Revision 7450d44b

Added by Andreas Kohlbecker over 5 years ago

fix #7702 always clearing session in finally clause

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkingsetPresenter.java
474 474
    @EventBusListenerMethod
475 475
    public void onDoneWithTaxonnameEditor(DoneWithPopupEvent event) throws RegistrationValidationException{
476 476
        if(event.getPopup() instanceof TaxonNamePopupEditor){
477
            TransactionStatus txStatus = getRepo().startTransaction();
478
            if(event.getReason().equals(Reason.SAVE)){
479
                if(newTaxonNameForRegistration != null){
480
                    UUID taxonNameUuid = newTaxonNameForRegistration.getUuid();
481
                    getRepo().getSession().refresh(newTaxonNameForRegistration);
482
                    Registration reg = getRepo().getRegistrationService().createRegistrationForName(taxonNameUuid);
483
                    // reload workingset into current session
484
                    loadWorkingSet(workingset.getCitationUuid());
485
                    workingset.add(reg);
486
                }
487
                refreshView(true);
488
            } else if(event.getReason().equals(Reason.CANCEL)){
489
                if(newTaxonNameForRegistration != null){
490
                    // clean up
491
                    getTaxonNameStore().deleteBean(newTaxonNameForRegistration, (AbstractView) getView());
477
            try {
478
                TransactionStatus txStatus = getRepo().startTransaction();
479
                if(event.getReason().equals(Reason.SAVE)){
480
                    if(newTaxonNameForRegistration != null){
481
                        UUID taxonNameUuid = newTaxonNameForRegistration.getUuid();
482
                        getRepo().getSession().refresh(newTaxonNameForRegistration);
483
                        Registration reg = getRepo().getRegistrationService().createRegistrationForName(taxonNameUuid);
484
                        // reload workingset into current session
485
                        loadWorkingSet(workingset.getCitationUuid());
486
                        workingset.add(reg);
487
                    }
488
                    refreshView(true);
489
                } else if(event.getReason().equals(Reason.CANCEL)){
490
                    if(newTaxonNameForRegistration != null){
491
                        // clean up
492
                        getTaxonNameStore().deleteBean(newTaxonNameForRegistration, (AbstractView) getView());
493
                    }
492 494
                }
495
                getRepo().commitTransaction(txStatus);
496
            } finally {
497
                getRepo().getSession().clear(); // #7702
493 498
            }
494
            getRepo().commitTransaction(txStatus);
495 499
            newTaxonNameForRegistration = null;
496 500
        }
497 501
    }

Also available in: Unified diff