From: Katja Luther Date: Mon, 10 Jul 2017 06:59:41 +0000 (+0200) Subject: avoid NPE in check for dirty editors X-Git-Tag: 4.8.1^2 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/1290db5cbefd1fc9dd62b7d1be6ad05717cee3dd avoid NPE in check for dirty editors --- diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractImportWizard.java index 313ce1e79..b77dbb8f4 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractImportWizard.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractImportWizard.java @@ -78,8 +78,10 @@ public abstract class AbstractImportWizard exten if(activePage != null){ for (IEditorReference reference : activePage.getEditorReferences()) { IEditorPart editor = reference.getEditor(false); - if(editor.isDirty()){ - return true; + if (editor!= null){ + if(editor.isDirty()){ + return true; + } } } } @@ -88,7 +90,7 @@ public abstract class AbstractImportWizard exten @Override public boolean canFinish() { - return !existUnsavedEditors() && super.canFinish(); + return !existUnsavedEditors() && super.canFinish(); } public abstract CONFIG getConfigurator(); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/GenericConfiguratorWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/GenericConfiguratorWizardPage.java index 6651d3ecd..f08e47815 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/GenericConfiguratorWizardPage.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/GenericConfiguratorWizardPage.java @@ -185,13 +185,13 @@ public class GenericConfiguratorWizardPage extends WizardPage { final String methodName = method.getName(); final Button checkBox = new Button(parent, SWT.CHECK); - if(configurator.getClass().equals(Abcd206ImportConfigurator.class)){ + // if(configurator.getClass().equals(Abcd206ImportConfigurator.class)){ String[] r = methodName.split("set")[1].split("(?=\\p{Upper})"); checkBox.setText(getLabel(StringUtils.join(r," "))); - } - else{ - checkBox.setText(getLabel(methodName)); - } +// } +// else{ +// checkBox.setText(getLabel(methodName)); +// } // retrieve the default values and set the checkbox accordingly boolean defaultSelection = executeBooleanGetMethod(configurator, "is" + methodName.substring(3));