You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ji...@apache.org on 2018/11/23 09:31:36 UTC

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

Repository: lucene-solr
Updated Branches:
  refs/heads/master 245907228 -> 2da72ad05


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


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/2da72ad0
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2da72ad0
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2da72ad0

Branch: refs/heads/master
Commit: 2da72ad05c5cf05ca81e0fa64abf4b6fef4896a4
Parents: 2459072
Author: Jim Ferenczi <ji...@apache.org>
Authored: Fri Nov 23 10:31:28 2018 +0100
Committer: Jim Ferenczi <ji...@apache.org>
Committed: Fri Nov 23 10:31:28 2018 +0100

----------------------------------------------------------------------
 .../ko/tokenattributes/PartOfSpeechAttributeImpl.java    | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2da72ad0/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/tokenattributes/PartOfSpeechAttributeImpl.java
----------------------------------------------------------------------
diff --git a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/tokenattributes/PartOfSpeechAttributeImpl.java b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/tokenattributes/PartOfSpeechAttributeImpl.java
index 2e51689..fbd637f 100644
--- a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/tokenattributes/PartOfSpeechAttributeImpl.java
+++ b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/tokenattributes/PartOfSpeechAttributeImpl.java
@@ -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()));
   }