This is an automated email from the ASF dual-hosted git repository.
dsmiley 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 dd4013bcf01 Utils: pretty-printed JSON: add trailing newline (#3630)
dd4013bcf01 is described below
commit dd4013bcf01313a322eef29c4411f9262aff1227
Author: David Smiley <[email protected]>
AuthorDate: Sat Oct 11 18:18:19 2025 -0400
Utils: pretty-printed JSON: add trailing newline (#3630)
and reduce visibility of SolrJSONWriter
---
.../solrj/src/java/org/apache/solr/common/util/SolrJSONWriter.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git
a/solr/solrj/src/java/org/apache/solr/common/util/SolrJSONWriter.java
b/solr/solrj/src/java/org/apache/solr/common/util/SolrJSONWriter.java
index 09fac41b6b1..890be1fd0b1 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/SolrJSONWriter.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/SolrJSONWriter.java
@@ -25,7 +25,7 @@ import java.util.Arrays;
* Use this to serialize an object into Json. This only supports standard
Objects and not the
* server-side Objects
*/
-public class SolrJSONWriter implements JsonTextWriter {
+class SolrJSONWriter implements JsonTextWriter {
// indent up to 40 spaces
static final char[] indentChars = new char[81];
@@ -48,8 +48,13 @@ public class SolrJSONWriter implements JsonTextWriter {
this.namedListStyle = namedListStyle;
}
+ /**
+ * Writes out the passed object as JSON. This is this principal entrypoint
into JSON writing.
+ * {@code this} is returned.
+ */
public SolrJSONWriter writeObj(Object o) throws IOException {
writeVal(null, o);
+ if (doIndent()) writer.write('\n');
return this;
}