ref #5969: check for db connection before ty to read the preferred nomenclatural...
authorKatja Luther <k.luther@bgbm.org>
Tue, 4 Oct 2016 10:11:37 +0000 (12:11 +0200)
committerKatja Luther <k.luther@bgbm.org>
Tue, 4 Oct 2016 10:11:37 +0000 (12:11 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCodePreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java

index b52eee0aa9394a5a2e01e156e2cb2efab1431883..d5000b34e172d8078c8e9649ddad43b4da807416 100644 (file)
@@ -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);
                }
index 00bbfff9643a3ed14a5f8ae878f4de1f5581c96e..e7eb2a4d1479a76c7ed3f1ebf670931871aadc13 100644 (file)
@@ -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){