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
This commit is contained in:
Noble Paul 2014-12-12 12:33:28 +00:00
parent b36c68b16e
commit 8d2fded1df
2 changed files with 8 additions and 1 deletions

View File

@ -316,6 +316,9 @@ Bug Fixes
implementation instead appends each input piece via the langdetect API. implementation instead appends each input piece via the langdetect API.
(Vitaliy Zhovtyuk, Tomás Fernández Löbbe, Rob Tulloh, Steve Rowe) (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 Optimizations
---------------------- ----------------------

View File

@ -17,6 +17,8 @@
package org.apache.solr.update.processor; package org.apache.solr.update.processor;
import java.util.Collection;
import org.apache.solr.common.SolrInputField; import org.apache.solr.common.SolrInputField;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -61,8 +63,10 @@ public abstract class FieldValueMutatingUpdateProcessor
@Override @Override
protected final SolrInputField mutate(final SolrInputField src) { protected final SolrInputField mutate(final SolrInputField src) {
Collection<Object> values = src.getValues();
if(values == null) return src;//don't mutate
SolrInputField result = new SolrInputField(src.getName()); SolrInputField result = new SolrInputField(src.getName());
for (final Object srcVal : src.getValues()) { for (final Object srcVal : values) {
final Object destVal = mutateValue(srcVal); final Object destVal = mutateValue(srcVal);
if (DELETE_VALUE_SINGLETON == destVal) { if (DELETE_VALUE_SINGLETON == destVal) {
/* NOOP */ /* NOOP */