From: Patrick Plitzner
Date: Tue, 1 Sep 2015 09:15:17 +0000 (+0200)
Subject: Avoid exception loop when taxon name is null (#4996)
X-Git-Tag: 3.8.0^2~36^2~2
X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/4858419735870f9ea75ff5a27615bcdea600ed92?ds=sidebyside
Avoid exception loop when taxon name is null (#4996)
---
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
index cdea34cae..1213418a5 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
@@ -46,39 +46,32 @@ public class NonViralNameDetailElement extends
/** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement, final NonViralName entity, int style) {
- //name can be null in rare cases. Temporary solution for #4221. May be obsolete when
- //#4393 (Make changing name of a taxon possible in details view) is implemented.
- if(entity==null){
- formFactory.createEmptyElement(formElement, "No name associated with this taxon.");
+ toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
+
+ combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
+ combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
+
+ //TODO RL
+ if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+ toggleable_cache.setVisible(false);
+ combo_nomenclaturalCode.setVisible(false);
}
- else {
- toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
-
- combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
- combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
-
- //TODO RL
- if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
- toggleable_cache.setVisible(false);
- combo_nomenclaturalCode.setVisible(false);
- }
-
- section_name = formFactory.createNameDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- addControl(section_name);
- addElement(section_name);
- section_author = formFactory.createAuthorshipDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- section_author.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- addControl(section_author);
- addElement(section_author);
-
- //TODO RL
- if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
- section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
- section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- addControl(section_hybrid);
- addElement(section_hybrid);
- }
+
+ section_name = formFactory.createNameDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ addControl(section_name);
+ addElement(section_name);
+ section_author = formFactory.createAuthorshipDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ section_author.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ addControl(section_author);
+ addElement(section_author);
+
+ //TODO RL
+ if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+ section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
+ section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ addControl(section_hybrid);
+ addElement(section_hybrid);
}
}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
index 04bb9207f..4856e3ff7 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
@@ -204,7 +204,12 @@ public class DetailsViewer extends AbstractCdmDataViewer {
destroySections();
if (input instanceof TaxonBase) {
- createTaxonSections(rootElement);
+ if(((TaxonBase) input).getName()==null){
+ createEmptySection(rootElement);
+ }
+ else{
+ createTaxonSections(rootElement);
+ }
} else if (input instanceof NonViralName) {
createNameSections(rootElement);