handle no parent last nodes
authorAndreas Müller <a.mueller@bgbm.org>
Wed, 9 Oct 2013 16:39:35 +0000 (16:39 +0000)
committerAndreas Müller <a.mueller@bgbm.org>
Wed, 9 Oct 2013 16:39:35 +0000 (16:39 +0000)
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/markup/MarkupDocumentImportNoComponent.java

index 537256c602d0a1d8d27cf35a0d91a83cb4a834c2..6831645b427cf311c58d88c5e2f28d33e14f7d9d 100644 (file)
@@ -268,7 +268,14 @@ public class MarkupDocumentImportNoComponent extends MarkupImportBase {
                                        tree.addChildTaxon(taxon, null, null);\r
                                }\r
                        } else if (thisRank.isHigher(lastRank)) {\r
-                               doTaxonRelation(state, taxon, lastNode.getParent().getTaxon(),  dataLocation);\r
+                               TaxonNode parent = lastNode.getParent();\r
+                               if (parent != null){\r
+                                       doTaxonRelation(state, taxon, parent.getTaxon(),        dataLocation);\r
+                               }else{\r
+                                       String warning = "No parent available for lastNode. Classification can not be build correctly. Maybe the rank was missing for the lastNode";\r
+                                       fireWarningEvent(warning, makeLocationStr(dataLocation), 16);\r
+                                       //TODO what to do in this case (haven't spend time to think about yet\r
+                               }\r
                                // TaxonNode parentNode = handleTaxonRelation(state, taxon,\r
                                // lastNode.getParent().getTaxon());\r
                                // parentNode.addChildTaxon(taxon, null, null, null);\r