From: Katja Luther Date: Tue, 4 Oct 2016 10:11:37 +0000 (+0200) Subject: ref #5969: check for db connection before ty to read the preferred nomenclatural... X-Git-Tag: 4.4.0^2~121 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/2a7c9630160f41bf09380331a0e6af2c66b42ed9 ref #5969: check for db connection before ty to read the preferred nomenclatural code --- 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){