You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2023/09/22 15:24:13 UTC

[solr] branch branch_9x updated: SOLR-16925: Fix indentation for JacksonJsonWriter (#1942)

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

houston pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 1f0c1ffc627 SOLR-16925: Fix indentation for JacksonJsonWriter (#1942)
1f0c1ffc627 is described below

commit 1f0c1ffc627cc41b49e9d6bf36c828380bae75fe
Author: Houston Putman <ho...@apache.org>
AuthorDate: Fri Sep 22 11:21:23 2023 -0400

    SOLR-16925: Fix indentation for JacksonJsonWriter (#1942)
    
    (cherry picked from commit 1a8457d9ca394d93af9098c4a49c1593f97774db)
---
 solr/CHANGES.txt                                                   | 2 ++
 solr/core/src/java/org/apache/solr/response/JacksonJsonWriter.java | 5 ++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c4eb19c71e1..934a130521d 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -145,6 +145,8 @@ Bug Fixes
 * SOLR-16983: Fixed a bug that could cause some usages of SolrStream to fail to close InputStreams from the server.
   Also fixed the usage of ObjectReleaseTracker in SolrTestCaseJ4 to catch these kinds of bugs (hossman)
 
+* SOLR-16925: Fix indentation for JacksonJsonWriter (Houston Putman)
+
 Dependency Upgrades
 ---------------------
 
diff --git a/solr/core/src/java/org/apache/solr/response/JacksonJsonWriter.java b/solr/core/src/java/org/apache/solr/response/JacksonJsonWriter.java
index 7a1ff5276a8..4de5039ba1e 100644
--- a/solr/core/src/java/org/apache/solr/response/JacksonJsonWriter.java
+++ b/solr/core/src/java/org/apache/solr/response/JacksonJsonWriter.java
@@ -19,7 +19,6 @@ package org.apache.solr.response;
 import com.fasterxml.jackson.core.JsonEncoding;
 import com.fasterxml.jackson.core.JsonFactory;
 import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.PrettyPrinter;
 import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -32,7 +31,7 @@ import org.apache.solr.request.SolrQueryRequest;
 public class JacksonJsonWriter extends BinaryResponseWriter {
 
   protected final JsonFactory jsonfactory;
-  protected static final PrettyPrinter pretty =
+  protected static final DefaultPrettyPrinter pretty =
       new DefaultPrettyPrinter()
           .withoutSpacesInObjectEntries()
           .withArrayIndenter(DefaultPrettyPrinter.NopIndenter.instance);
@@ -71,7 +70,7 @@ public class JacksonJsonWriter extends BinaryResponseWriter {
       try {
         gen = j.createGenerator(out, JsonEncoding.UTF8);
         if (doIndent) {
-          gen.setPrettyPrinter(pretty);
+          gen.setPrettyPrinter(pretty.createInstance());
         }
       } catch (IOException e) {
         throw new RuntimeException(e);