From 2a7c9630160f41bf09380331a0e6af2c66b42ed9 Mon Sep 17 00:00:00 2001 From: Katja Luther Date: Tue, 4 Oct 2016 12:11:37 +0200 Subject: [PATCH] ref #5969: check for db connection before ty to read the preferred nomenclatural code --- .../taxeditor/preference/NomenclaturalCodePreferences.java | 3 +++ .../eu/etaxonomy/taxeditor/preference/PreferencesUtil.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCodePreferences.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCodePreferences.java index b52eee0aa..d5000b34e 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCodePreferences.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCodePreferences.java @@ -94,6 +94,9 @@ public class NomenclaturalCodePreferences extends FieldEditorPreferencePage String value = getPreferenceStore().getString(IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY); CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value); ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration(); + if (controller == null){ + return false; + } IPreferenceService service = controller.getPreferenceService(); service.set(pref); } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java index 00bbfff96..e7eb2a4d1 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java @@ -114,6 +114,9 @@ public class PreferencesUtil implements IPreferenceKeys { controller = CdmStore.getCurrentApplicationConfiguration(); PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode); CdmPreference preference = null; + if (controller == null){ + return; + } if (preferredCode == null){ preference = controller.getPreferenceService().find(key); if (preference == null){ -- 2.34.1