LUCENE-8570: Fix possible NPE in the attribute reflection of the Nori's PartOfSpeechAttributeImpl

This commit is contained in:
Jim Ferenczi 2018-11-23 10:31:28 +01:00
parent 2459072286
commit 2da72ad05c
1 changed files with 6 additions and 5 deletions

View File

@ -62,11 +62,12 @@ public class PartOfSpeechAttributeImpl extends AttributeImpl implements PartOfSp
@Override
public void reflectWith(AttributeReflector reflector) {
reflector.reflect(PartOfSpeechAttribute.class, "posType", getPOSType().name());
Tag leftPOS = getLeftPOS();
reflector.reflect(PartOfSpeechAttribute.class, "leftPOS", leftPOS.name() + "(" + leftPOS.description() + ")");
Tag rightPOS = getRightPOS();
reflector.reflect(PartOfSpeechAttribute.class, "rightPOS", rightPOS.name() + "(" + rightPOS.description() + ")");
String posName = getPOSType() == null ? null : getPOSType().name();
String rightPOS = getRightPOS() == null ? null : getRightPOS().name() + "(" + getRightPOS().description() + ")";
String leftPOS = getLeftPOS() == null ? null : getLeftPOS().name() + "(" + getLeftPOS().description() + ")";
reflector.reflect(PartOfSpeechAttribute.class, "posType", posName);
reflector.reflect(PartOfSpeechAttribute.class, "leftPOS", leftPOS);
reflector.reflect(PartOfSpeechAttribute.class, "rightPOS", rightPOS);
reflector.reflect(PartOfSpeechAttribute.class, "morphemes", displayMorphemes(getMorphemes()));
}