Project

General

Profile

bug #7388

inconsistent handling of null values passed to addNameRelation methods in TaxonName

Added by Andreas Kohlbecker over 1 year ago. Updated over 1 year ago.

Status:
New
Priority:
New
Category:
cdmlib
Target version:
Start date:
04/28/2018
Due date:
% Done:

0%

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.

Associated revisions

Revision 7a72a0fe (diff)
Added by Andreas Kohlbecker over 1 year ago

ref #7386 reducing redundancy in name relationship handling methods, adding methods for general use

Revision 287abc0f (diff)
Added by Andreas Müller over 1 year ago

ref #7386 fix error in new getRelatedNames method

Revision 676ed1a9 (diff)
Added by Andreas Müller over 1 year ago

ref #7388 fix error in new removeRelationWithTaxonName

History

#1 Updated by Andreas Kohlbecker over 1 year ago

  • Subject changed from inconsistent handling of null valued passed to addNameRelatinon methods in TaxonName to inconsistent handling of null values passed to addNameRelation methods in TaxonName

#2 Updated by Andreas Kohlbecker over 1 year ago

The addReplacedSynonym() again follows a completely different philosophy:


    //TODO: Check if true: The replaced synonym cannot have itself a replaced synonym (?).
    @Override
    public void addReplacedSynonym(TaxonName replacedSynonym, Reference citation, String microcitation, String ruleConsidered){
        if (replacedSynonym != null){
            replacedSynonym.addRelationshipToName(this, NameRelationshipType.REPLACED_SYNONYM(), citation, microcitation, ruleConsidered);
        }
    }

#3 Updated by Andreas Kohlbecker over 1 year ago

refactoring of other name relationship related methods in 7a72a0fe

#4 Updated by Andreas Müller over 1 year ago

fixed errors in new methods 287abc0f and 676ed1a9

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)