forked from D-Net/dnet-hadoop
avoid NPEs in Vocabulary.getTermBySynonym
This commit is contained in:
parent
2a233a89aa
commit
e6086efc53
|
@ -63,7 +63,10 @@ public class Vocabulary implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public VocabularyTerm getTermBySynonym(final String syn) {
|
public VocabularyTerm getTermBySynonym(final String syn) {
|
||||||
return getTerm(synonyms.get(syn.toLowerCase()));
|
return Optional
|
||||||
|
.ofNullable(syn)
|
||||||
|
.map(s -> getTerm(synonyms.get(s.toLowerCase())))
|
||||||
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Qualifier getTermAsQualifier(final String termId) {
|
public Qualifier getTermAsQualifier(final String termId) {
|
||||||
|
|
Loading…
Reference in New Issue