Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-17120: handle null value when merging partials (#2214)

Calvin Smith571c8871278b
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b2c00b14911..36b7be60896 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -195,6 +195,9 @@ Bug Fixes
* SOLR-17074: Fixed not correctly escaped quote in bin/solr script (Dominique Béjean, Vincenzo D'Amore)
+* SOLR-17120: Fix NullPointerException in UpdateLog.applyOlderUpdates that can occur if there are multiple partial
+ updates of the same document in separate requests using commitWithin. (Calvin Smith, Christine Poerschke)
+
Dependency Upgrades
---------------------
* SOLR-17012: Update Apache Hadoop to 3.3.6 and Apache Curator to 5.5.0 (Kevin Risden)
diff --git a/solr/core/src/java/org/apache/solr/update/UpdateLog.java b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
index c9301356a0c..c13530891fd 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
@@ -1020,8 +1020,13 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
// if the newerDoc has this field, then this field from olderDoc can be ignored
if (!newerDoc.containsKey(fieldName)
&& (mergeFields == null || mergeFields.contains(fieldName))) {
- for (Object val : olderDoc.getFieldValues(fieldName)) {
- newerDoc.addField(fieldName, val);
+ Collection<Object> values = olderDoc.getFieldValues(fieldName);
+ if (values == null) {
+ newerDoc.addField(fieldName, null);
+ } else {
+ for (Object val : values) {
+ newerDoc.addField(fieldName, val);
+ }
}
}
}