From 9d8d7a43e1335005dbaea0f96c1f1c5d33a61531 Mon Sep 17 00:00:00 2001 From: BloodShura Date: Tue, 7 Feb 2017 22:04:22 -0200 Subject: [PATCH] All JsonElement::getAsJsonXXX methods now include the JSON string on thrown exception's message --- gson/src/main/java/com/google/gson/JsonElement.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gson/src/main/java/com/google/gson/JsonElement.java b/gson/src/main/java/com/google/gson/JsonElement.java index d9cd9184..8f393aea 100644 --- a/gson/src/main/java/com/google/gson/JsonElement.java +++ b/gson/src/main/java/com/google/gson/JsonElement.java @@ -103,7 +103,7 @@ public abstract class JsonElement { if (isJsonArray()) { return (JsonArray) this; } - throw new IllegalStateException("This is not a JSON Array."); + throw new IllegalStateException("Not a JSON Array: " + this); } /** @@ -119,7 +119,7 @@ public abstract class JsonElement { if (isJsonPrimitive()) { return (JsonPrimitive) this; } - throw new IllegalStateException("This is not a JSON Primitive."); + throw new IllegalStateException("Not a JSON Primitive: " + this); } /** @@ -136,7 +136,7 @@ public abstract class JsonElement { if (isJsonNull()) { return (JsonNull) this; } - throw new IllegalStateException("This is not a JSON Null."); + throw new IllegalStateException("Not a JSON Null: " + this); } /**