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:
Inderjeet Singh 2009-04-01 17:15:01 +00:00
parent e9600e10cb
commit cee6c74960

View File

@ -427,16 +427,10 @@ public final class Gson {
*/
@SuppressWarnings("unchecked")
public <T> T fromJson(JsonElement json, Type typeOfT) throws JsonParseException {
try {
JsonDeserializationContext context = new JsonDeserializationContextDefault(
createDefaultObjectNavigatorFactory(), deserializers, objectConstructor);
T target = (T) context.deserialize(json, typeOfT);
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);
}
JsonDeserializationContext context = new JsonDeserializationContextDefault(
createDefaultObjectNavigatorFactory(), deserializers, objectConstructor);
T target = (T) context.deserialize(json, typeOfT);
return target;
}
/**