forked from j62/ctbrec
Fix JSON exception in isOnline
This commit is contained in:
parent
204eb99b29
commit
2d048369a1
|
@ -67,8 +67,12 @@ public class Flirt4FreeModel extends AbstractModel {
|
||||||
.build();
|
.build();
|
||||||
try(Response response = getSite().getHttpClient().execute(request)) {
|
try(Response response = getSite().getHttpClient().execute(request)) {
|
||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
String body = response.body().string();
|
||||||
//LOG.debug("check model status: {}", json.toString(2));
|
if(body.trim().isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
JSONObject json = new JSONObject(body);
|
||||||
|
//LOG.debug("check model status: ", json.toString(2));
|
||||||
online = Objects.equals(json.optString("status"), "online");
|
online = Objects.equals(json.optString("status"), "online");
|
||||||
id = json.getString("model_id");
|
id = json.getString("model_id");
|
||||||
if(online) {
|
if(online) {
|
||||||
|
|
Loading…
Reference in New Issue