diff --git a/solr/solrj/src/java/org/apache/solr/common/util/Utils.java b/solr/solrj/src/java/org/apache/solr/common/util/Utils.java index 61c9723bb72..8538d0ac5b4 100644 --- a/solr/solrj/src/java/org/apache/solr/common/util/Utils.java +++ b/solr/solrj/src/java/org/apache/solr/common/util/Utils.java @@ -288,7 +288,14 @@ public IteratorWriter.ItemWriter add(Object o) throws IOException { public static byte[] toJSON(Object o) { if (o == null) return new byte[0]; CharArr out = new CharArr(); - new JSONWriter(out, 0).write(o); // indentation by default + // if (!(o instanceof List) && !(o instanceof Map)) { + // if (o instanceof MapWriter) { + // o = ((MapWriter) o).toMap(new LinkedHashMap<>()); + // } else if (o instanceof IteratorWriter) { + // o = ((IteratorWriter) o).toList(new ArrayList<>()); + // } + // } + new MapWriterJSONWriter(out, 0).write(o); // indentation by default return toUTF8(out); } diff --git a/solr/solrj/src/test/org/apache/solr/common/cloud/DocCollectionTest.java b/solr/solrj/src/test/org/apache/solr/common/cloud/DocCollectionTest.java index 7857dbc9bce..8ea519f88f7 100644 --- a/solr/solrj/src/test/org/apache/solr/common/cloud/DocCollectionTest.java +++ b/solr/solrj/src/test/org/apache/solr/common/cloud/DocCollectionTest.java @@ -111,6 +111,6 @@ public void testDocCollectionSeriallizationNoIndent() throws Exception { // sometime it takes url schems http or https - test setup issue assertTrue( - "byte size is wrong at " + ser.length, 540513 == ser.length || 540513 + 2048 == ser.length); + "byte size is wrong at " + ser.length, 540512 == ser.length || 540512 + 2048 == ser.length); } }