Project

General

Profile

Actions

bug #7388

open

inconsistent handling of null values passed to addNameRelation methods in TaxonName

Added by Andreas Kohlbecker almost 6 years ago. Updated almost 6 years ago.

Status:
New
Priority:
New
Category:
cdmlib
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Severity:
normal
Found in Version:

Description

addBasionym() ignores retuns null and addRelationshipToName() throws an exception

@Override
    public NameRelationship addBasionym(TaxonName basionym, Reference citation, String microcitation, String ruleConsidered){
        if (basionym != null){
            return basionym.addRelationshipToName(this, NameRelationshipType.BASIONYM(), citation, microcitation, ruleConsidered);
        }else{
            return null;
        }
    }
public NameRelationship addRelationshipToName(TaxonName toName, NameRelationshipType type, Reference citation, String microCitation, String ruleConsidered){
        if (toName == null){
            throw new NullPointerException("Null is not allowed as name for a name relationship");
        }
        NameRelationship rel = new NameRelationship(toName, this, type, citation, microCitation, ruleConsidered);
        return rel;
    }

I think addBasionym() should behave the same as addRelationshipToName() and should throw an exception.

Actions

Also available in: Atom PDF