You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by cp...@apache.org on 2024/01/24 18:29:15 UTC
(solr) branch main updated: SOLR-17120: handle null value when merging partials (#2214)
This is an automated email from the ASF dual-hosted git repository.
cpoerschke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 571c8871278 SOLR-17120: handle null value when merging partials (#2214)
571c8871278 is described below
commit 571c8871278bc14aea683420aea58ef64e38bbae
Author: Calvin Smith <eu...@users.noreply.github.com>
AuthorDate: Wed Jan 24 10:29:09 2024 -0800
SOLR-17120: handle null value when merging partials (#2214)
* SOLR-17120 handle null value when merging partials
- this change avoids a `NullPointerException` that can occur
under some circumstances when performing multiple partial
updates of the same document
---
solr/CHANGES.txt | 3 +++
solr/core/src/java/org/apache/solr/update/UpdateLog.java | 9 +++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
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);
+ }
}
}
}