[Grid]: Handle poorly formed JSON responses
Without causing the server to crash.
import com.google.common.io.ByteStreams;
import com.google.common.net.MediaType;
import com.google.gson.GsonBuilder;
+import com.google.gson.JsonParseException;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
@@ -359,6 +360,8 @@ private Charset detectEncoding(HttpResponse proxyResponse) {
}
}
}
+ } catch (JsonParseException e) {
+ // Nothing to do --- poorly formed payload.
}
return consumed;
