fix NPE in reference bulk editor
authorKatja Luther <k.luther@bgbm.org>
Mon, 29 Jun 2020 07:34:21 +0000 (09:34 +0200)
committerKatja Luther <k.luther@bgbm.org>
Mon, 29 Jun 2020 07:36:57 +0000 (09:36 +0200)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.java

index 1ea5c4d..f2b0a91 100644 (file)
@@ -79,14 +79,20 @@ public class ReferenceEditorInput extends AbstractBulkEditorInput<Reference> {
         }
         else if(property.equals(PROPERTY_PUBLICATION_YEAR)){
             if (cdmBase.getDatePublished() != null){
-                String result = cdmBase.getDatePublished().getYear();
-                if (!cdmBase.getDatePublished().getYear().equals(cdmBase.getDatePublishedString()) && cdmBase.getDatePublishedString() != null) {
+                String result = "";
+                if (cdmBase.getDatePublished().getYear() != null){
+                    result = cdmBase.getDatePublished().getYear();
+                }
+                if (cdmBase.getDatePublishedString() != null && !result.equals(cdmBase.getDatePublishedString()) ) {
                     result += " (" + cdmBase.getDatePublishedString()+")";
                 }
                 return result ;
             }else if(cdmBase.getDatePublished() == null && cdmBase.getInReference() != null ){
-                String result = cdmBase.getInReference().getDatePublished().getYear();
-                if (!cdmBase.getInReference().getDatePublished().getYear().equals(cdmBase.getInReference().getDatePublishedString()) ) {
+                String result = "";
+                if (cdmBase.getInReference().getDatePublished() != null && cdmBase.getInReference().getDatePublished().getYear() != null){
+                    result = cdmBase.getInReference().getDatePublished().getYear();
+                }
+                if (cdmBase.getInReference().getDatePublishedString() != null && !result.equals(cdmBase.getInReference().getDatePublishedString()) ) {
                     result += " (" + cdmBase.getInReference().getDatePublishedString()+")";
                 }
                 return result ;