From 1757bd8d922c05efd2d9da4cf8fcff1445611530 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 1 Sep 2017 19:25:06 -0400 Subject: [PATCH] Prettify primary response in assertion message We are getting the default Object#toString implementation here, we need more than this. This commit instead formats the primary response to JSON so we can see into its soul. --- .../java/org/elasticsearch/action/bulk/BulkItemRequest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/action/bulk/BulkItemRequest.java b/core/src/main/java/org/elasticsearch/action/bulk/BulkItemRequest.java index 1d8b917176a..3180f57d204 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/BulkItemRequest.java +++ b/core/src/main/java/org/elasticsearch/action/bulk/BulkItemRequest.java @@ -20,6 +20,7 @@ package org.elasticsearch.action.bulk; import org.elasticsearch.action.DocWriteRequest; +import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; @@ -78,7 +79,7 @@ public class BulkItemRequest implements Streamable { setPrimaryResponse(new BulkItemResponse(id, request.opType(), failure)); } else { assert primaryResponse.isFailed() && primaryResponse.getFailure().isAborted() - : "response [" + primaryResponse + "]; cause [" + cause + "]"; + : "response [" + Strings.toString(primaryResponse) + "]; cause [" + cause + "]"; if (primaryResponse.isFailed() && primaryResponse.getFailure().isAborted()) { primaryResponse.getFailure().getCause().addSuppressed(cause); } else {