OpenTreeOfLife / reference-taxonomy

Open Tree Reference Taxonomy (OTT) tools
BSD 2-Clause "Simplified" License
11 stars 12 forks source link

Empty name field leads to error #325

Open jar398 opened 7 years ago

jar398 commented 7 years ago

In InterimFormat.java: in between these two lines

 String name = parts[namecolumn];
Taxon node = new Taxon(tax, name);

insert the statement

   if (name.length() == 0) name = null;

For good measure, in Taxon.normalizeName, the following

   if (str.length() == 0) return null;

should be changed to

   if (str.length() == 0) return str;

or deleted.

| 1 unrecognized parent ids, 1 nodes that have them
Traceback (most recent call last):
  File "build_dwh.py", line 14, in <module>
    tpl = Taxonomy.getTaxonomy('t/tax/plant_dwca/', 'TPL')
    at org.opentreeoflife.taxa.Taxonomy.normalizeNames(Taxonomy.java:416)
    at org.opentreeoflife.taxa.Taxonomy.postLoadActions(Taxonomy.java:379)
    at org.opentreeoflife.taxa.Taxonomy.getTaxonomy(Taxonomy.java:331)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)

java.lang.NullPointerException: java.lang.NullPointerException