diff --git a/app/src/main/java/com/nutomic/syncthingandroid/model/SystemStatus.java b/app/src/main/java/com/nutomic/syncthingandroid/model/SystemStatus.java index f0c83bbe..468a1236 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/model/SystemStatus.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/model/SystemStatus.java @@ -9,7 +9,7 @@ import java.util.Map; public class SystemStatus { public long alloc; public double cpuPercent; - public Map>> connectionServiceStatus; + public Map connectionServiceStatus; public boolean discoveryEnabled; public Map discoveryErrors; public int discoveryMethods; diff --git a/app/src/main/java/com/nutomic/syncthingandroid/model/SystemStatusConnectionServiceStatusElement.java b/app/src/main/java/com/nutomic/syncthingandroid/model/SystemStatusConnectionServiceStatusElement.java new file mode 100644 index 00000000..7bb0042c --- /dev/null +++ b/app/src/main/java/com/nutomic/syncthingandroid/model/SystemStatusConnectionServiceStatusElement.java @@ -0,0 +1,13 @@ +package com.nutomic.syncthingandroid.model; + +import java.util.List; + +/** + * REST API endpoint "/rest/system/status" + * Part of JSON answer in field {@link SystemStatus#connectionServiceStatus} + */ +public class SystemStatusConnectionServiceStatusElement { + public String error; + public List lanAddresses; + public List wanAddresses; +} diff --git a/app/src/main/java/com/nutomic/syncthingandroid/service/RestApi.java b/app/src/main/java/com/nutomic/syncthingandroid/service/RestApi.java index bada0f22..8e6c68b2 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/service/RestApi.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/service/RestApi.java @@ -505,8 +505,15 @@ public class RestApi { * Requests and parses information about current system status and resource usage. */ public void getSystemStatus(OnResultListener1 listener) { - new GetRequest(mContext, mUrl, GetRequest.URI_SYSTEM_STATUS, mApiKey, null, result -> - listener.onResult(new Gson().fromJson(result, SystemStatus.class))); + new GetRequest(mContext, mUrl, GetRequest.URI_SYSTEM_STATUS, mApiKey, null, result -> { + SystemStatus systemStatus; + try { + systemStatus = new Gson().fromJson(result, SystemStatus.class); + listener.onResult(systemStatus); + } catch (Exception e) { + Log.e(TAG, "getSystemStatus: Parsing REST API result failed. result=" + result); + } + }); } public boolean isConfigLoaded() {