Skip to content

Commit

Permalink
Revert "Re-adding 0 indentation of doc colleciton JSON and fixing test (
Browse files Browse the repository at this point in the history
#131)"

This reverts commit 3f81865.

Fix was not applicable to branch_9_2
  • Loading branch information
magibney committed Sep 7, 2023
1 parent 0a751b8 commit c64d985
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion solr/solrj/src/java/org/apache/solr/common/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit c64d985

Please sign in to comment.