From 8d2fded1dffdc6d8f70e0e4276955c1dbdfaaec4 Mon Sep 17 00:00:00 2001 From: Noble Paul Date: Fri, 12 Dec 2014 12:33:28 +0000 Subject: [PATCH] SOLR-6626 NPE in FieldMutatingUpdateProcessor when indexing a doc with git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1644865 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 3 +++ .../update/processor/FieldValueMutatingUpdateProcessor.java | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index c16f101523a..e1d86ee7821 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -316,6 +316,9 @@ Bug Fixes implementation instead appends each input piece via the langdetect API. (Vitaliy Zhovtyuk, Tomás Fernández Löbbe, Rob Tulloh, Steve Rowe) +* SOLR-6626: NPE in FieldMutatingUpdateProcessor when indexing a doc with + null field value (Noble Paul) + Optimizations ---------------------- diff --git a/solr/core/src/java/org/apache/solr/update/processor/FieldValueMutatingUpdateProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/FieldValueMutatingUpdateProcessor.java index 6d5b583a511..cc8b5b9c6ad 100644 --- a/solr/core/src/java/org/apache/solr/update/processor/FieldValueMutatingUpdateProcessor.java +++ b/solr/core/src/java/org/apache/solr/update/processor/FieldValueMutatingUpdateProcessor.java @@ -17,6 +17,8 @@ package org.apache.solr.update.processor; +import java.util.Collection; + import org.apache.solr.common.SolrInputField; import org.slf4j.Logger; @@ -61,8 +63,10 @@ public abstract class FieldValueMutatingUpdateProcessor @Override protected final SolrInputField mutate(final SolrInputField src) { + Collection values = src.getValues(); + if(values == null) return src;//don't mutate SolrInputField result = new SolrInputField(src.getName()); - for (final Object srcVal : src.getValues()) { + for (final Object srcVal : values) { final Object destVal = mutateValue(srcVal); if (DELETE_VALUE_SINGLETON == destVal) { /* NOOP */