You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2020/06/15 09:17:52 UTC

[lucene-solr] branch master updated: SOLR-14516: NPE in JsonTextWriter

This is an automated email from the ASF dual-hosted git repository.

noble pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new fabc704  SOLR-14516: NPE in JsonTextWriter
fabc704 is described below

commit fabc70474891f6f3e485e5a3475ebf4d05138fc5
Author: noble <no...@apache.org>
AuthorDate: Mon Jun 15 19:17:23 2020 +1000

    SOLR-14516: NPE in JsonTextWriter
---
 solr/CHANGES.txt                                                    | 2 ++
 solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 9bd45de..088a531 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -239,6 +239,8 @@ Bug Fixes
 
 * SOLR-14345: Return proper error message when non-BinaryResponseParser is used in solrJ (Munendra S N)
 
+* SOLR-14516: NPE in JsonTextWriter (noble)
+
 Other Changes
 ---------------------
 * SOLR-14197: SolrResourceLoader: marked many methods as deprecated, and in some cases rerouted exiting logic to avoid
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java b/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java
index ec472ad..8a5c256 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java
@@ -67,6 +67,11 @@ public interface JsonTextWriter extends TextWriter {
   }
 
   default void writeStr(String name, String val, boolean needsEscaping) throws IOException {
+    if (val == null) {
+      writeNull(name);
+      return;
+    }
+
     // it might be more efficient to use a stringbuilder or write substrings
     // if writing chars to the stream is slow.
     if (needsEscaping) {