Changed JsonParser API to throw specific JsonIOException,JsonSyntaxException instead of the general JsonParseException

This commit is contained in:
Inderjeet Singh 2010-11-05 20:31:52 +00:00
parent 399d49c0e8
commit 0b4bf7706a

View File

@ -37,7 +37,7 @@ public final class JsonParser {
* @throws JsonParseException if the specified text is not valid JSON * @throws JsonParseException if the specified text is not valid JSON
* @since 1.3 * @since 1.3
*/ */
public JsonElement parse(String json) throws JsonParseException { public JsonElement parse(String json) throws JsonSyntaxException {
return parse(new StringReader(json)); return parse(new StringReader(json));
} }
@ -49,7 +49,7 @@ public final class JsonParser {
* @throws JsonParseException if the specified text is not valid JSON * @throws JsonParseException if the specified text is not valid JSON
* @since 1.3 * @since 1.3
*/ */
public JsonElement parse(Reader json) throws JsonParseException { public JsonElement parse(Reader json) throws JsonIOException, JsonSyntaxException {
return parse(new JsonReader(json)); return parse(new JsonReader(json));
} }
@ -59,7 +59,7 @@ public final class JsonParser {
* @throws JsonParseException if there is an IOException or if the specified * @throws JsonParseException if there is an IOException or if the specified
* text is not valid JSON * text is not valid JSON
*/ */
public JsonElement parse(JsonReader json) throws JsonParseException { public JsonElement parse(JsonReader json) throws JsonIOException, JsonSyntaxException {
boolean lenient = json.isLenient(); boolean lenient = json.isLenient();
json.setLenient(true); json.setLenient(true);
try { try {