Remove unneeded exception handling in Gson class.
This commit is contained in:
parent
cee6c74960
commit
5c6d5a0d11
@ -373,17 +373,11 @@ public final class Gson {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T fromJson(Reader json, Type typeOfT) throws JsonParseException {
|
public <T> T fromJson(Reader json, Type typeOfT) throws JsonParseException {
|
||||||
try {
|
JsonElement root = new JsonParser().parse(json);
|
||||||
JsonElement root = new JsonParser().parse(json);
|
JsonDeserializationContext context = new JsonDeserializationContextDefault(
|
||||||
JsonDeserializationContext context = new JsonDeserializationContextDefault(
|
createDefaultObjectNavigatorFactory(), deserializers, objectConstructor);
|
||||||
createDefaultObjectNavigatorFactory(), deserializers, objectConstructor);
|
T target = (T) context.deserialize(root, typeOfT);
|
||||||
T target = (T) context.deserialize(root, typeOfT);
|
return target;
|
||||||
return target;
|
|
||||||
} catch (StackOverflowError e) {
|
|
||||||
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
|
|
||||||
} catch (OutOfMemoryError e) {
|
|
||||||
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user