incorporated code review comments from r379 by removing the catching of OutOfMemoryError and StackOverflowError in Gson.fromJson. This is obviated since JsonParser.parse catches these errors, and that was the primary source of these problems.
This commit is contained in:
parent
e9600e10cb
commit
cee6c74960
@ -427,16 +427,10 @@ public final class Gson {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T fromJson(JsonElement json, Type typeOfT) throws JsonParseException {
|
public <T> T fromJson(JsonElement json, Type typeOfT) throws JsonParseException {
|
||||||
try {
|
|
||||||
JsonDeserializationContext context = new JsonDeserializationContextDefault(
|
JsonDeserializationContext context = new JsonDeserializationContextDefault(
|
||||||
createDefaultObjectNavigatorFactory(), deserializers, objectConstructor);
|
createDefaultObjectNavigatorFactory(), deserializers, objectConstructor);
|
||||||
T target = (T) context.deserialize(json, typeOfT);
|
T target = (T) context.deserialize(json, 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