1
0
Эх сурвалжийг харах

Core: reduce the size of the XContent parsing exception

The content that caused the exception can be potentially very big and in most cases it's not very useful for debugging.
Igor Motov 10 жил өмнө
parent
commit
e34cb18f8a

+ 3 - 3
core/src/main/java/org/elasticsearch/common/xcontent/XContentFactory.java

@@ -177,7 +177,7 @@ public class XContentFactory {
     public static XContent xContent(CharSequence content) {
         XContentType type = xContentType(content);
         if (type == null) {
-            throw new ElasticsearchParseException("Failed to derive xcontent from " + content);
+            throw new ElasticsearchParseException("Failed to derive xcontent");
         }
         return xContent(type);
     }
@@ -195,7 +195,7 @@ public class XContentFactory {
     public static XContent xContent(byte[] data, int offset, int length) {
         XContentType type = xContentType(data, offset, length);
         if (type == null) {
-            throw new ElasticsearchParseException("Failed to derive xcontent from (offset=" + offset + ", length=" + length + "): " + Arrays.toString(data));
+            throw new ElasticsearchParseException("Failed to derive xcontent");
         }
         return xContent(type);
     }
@@ -290,7 +290,7 @@ public class XContentFactory {
     public static XContent xContent(BytesReference bytes) {
         XContentType type = xContentType(bytes);
         if (type == null) {
-            throw new ElasticsearchParseException("Failed to derive xcontent from " + bytes);
+            throw new ElasticsearchParseException("Failed to derive xcontent");
         }
         return xContent(type);
     }

+ 1 - 1
core/src/test/java/org/elasticsearch/percolator/MultiPercolatorTests.java

@@ -311,7 +311,7 @@ public class MultiPercolatorTests extends ElasticsearchIntegrationTest {
             assertThat(item.getResponse().getSuccessfulShards(), equalTo(0));
             assertThat(item.getResponse().getShardFailures().length, equalTo(test.numPrimaries));
             for (ShardOperationFailedException shardFailure : item.getResponse().getShardFailures()) {
-                assertThat(shardFailure.reason(), containsString("Failed to derive xcontent from"));
+                assertThat(shardFailure.reason(), containsString("Failed to derive xcontent"));
                 assertThat(shardFailure.status().getStatus(), equalTo(500));
             }
         }