mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not hang in case stepic.org is unavailable
This commit is contained in:
@@ -161,7 +161,11 @@ public class EduStepicConnector {
|
||||
setHeaders(request, "application/json");
|
||||
|
||||
final CloseableHttpResponse response = ourClient.execute(request);
|
||||
final StatusLine statusLine = response.getStatusLine();
|
||||
final String responseString = EntityUtils.toString(response.getEntity());
|
||||
if (statusLine.getStatusCode() != 200) {
|
||||
throw new IOException("Stepic returned non 200 status code " + responseString);
|
||||
}
|
||||
Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
|
||||
return gson.fromJson(responseString, container);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user