diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 4aad5c07f58..36ed6abb019 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -42,6 +42,9 @@ Bug Fixes * SOLR-17098: ZK Credentials and ACLs are no longer sent to all ZK Servers when using Streaming Expressions. They will only be used when sent to the default ZK Host. (Houston Putman, Jan Høydahl, David Smiley, Gus Heck, Qing Xu) +* 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) + Optimizations --------------------- * SOLR-16555: SolrIndexSearcher - FilterCache intersections/andNot should not clone bitsets repeatedly (Kevin Risden, David Smiley) 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 590ce372e8e..e7ae6c4610c 100644 --- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java +++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java @@ -959,8 +959,13 @@ private void applyOlderUpdates(@SuppressWarnings({"rawtypes"})SolrDocumentBase n for (String fieldName : olderDoc.getFieldNames()) { // 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 values = olderDoc.getFieldValues(fieldName); + if (values == null) { + newerDoc.addField(fieldName, null); + } else { + for (Object val : values) { + newerDoc.addField(fieldName, val); + } } } }