Project

General

Profile

Revision f87588d3

IDf87588d3d0c5b751415e48b33975abac6f4e81f0
Parent 64a68019
Child a39a62de

Added by Patrick Plitzner about 2 years ago

Fix potential NPE

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java
95 95
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
96 96
import eu.etaxonomy.cdm.model.description.State;
97 97
import eu.etaxonomy.cdm.persistence.dto.SpecimenNodeWrapper;
98
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
98 99
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
99 100
import eu.etaxonomy.taxeditor.model.MessagingUtils;
100 101
import eu.etaxonomy.taxeditor.store.CdmStore;
......
540 541
            @Override
541 542
            public void done(IJobChangeEvent event) {
542 543
                sync.syncExec(()->{
543
                    wrappers.forEach(wrapper->CharacterMatrix.this.descriptions.add(wrapper));
544
                    List<RowWrapperDTO> rowsWithoutTaxonNode = wrappers.stream().filter(row->row.getTaxonNode()==null).collect(Collectors.toList());
545
                    if(!rowsWithoutTaxonNode.isEmpty()){
546
                        String collect = rowsWithoutTaxonNode.stream().
547
                        map(row->row.getSpecimenDescription().toString())
548
                        .collect(Collectors.joining("\n\n - "));
549
                        MessagingUtils.errorDialog("Descriptions without node found", this.getClass(), "Description(s) without taxon node:\n\n - "+collect+"\n\n", TaxeditorEditorPlugin.PLUGIN_ID, null, false);
550
                    }
551
                    wrappers.stream().filter(row->row.getTaxonNode()!=null).forEach(wrapper->CharacterMatrix.this.descriptions.add(wrapper));
544 552
                    loadingDone();
545 553
                });
546 554
            }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)