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();
|
||||
try(Response response = getSite().getHttpClient().execute(request)) {
|
||||
if(response.isSuccessful()) {
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
//LOG.debug("check model status: {}", json.toString(2));
|
||||
String body = response.body().string();
|
||||
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");
|
||||
id = json.getString("model_id");
|
||||
if(online) {
|
||||
|
|
Loading…
Reference in New Issue