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:21:28 UTC

[solr] branch main 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 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 1a8457d9ca3 SOLR-16925: Fix indentation for JacksonJsonWriter (#1942)
1a8457d9ca3 is described below

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

    SOLR-16925: Fix indentation for JacksonJsonWriter (#1942)
---
 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 18114626a2b..6393ea2cd29 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -205,6 +205,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);