From 84dfe97ec1e5f1ca6d08dd6d969abdf97d32fbe3 Mon Sep 17 00:00:00 2001 From: Pahansith Gunathilake Date: Mon, 24 Jan 2022 13:49:29 +0530 Subject: [PATCH 1/3] Bump dependency versions of analyticsmgt --- .../io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml | 2 +- .../pom.xml | 2 +- features/analytics-mgt/grafana-mgt/pom.xml | 2 +- features/analytics-mgt/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml index f51fb0820eb..9a7c6617b96 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt grafana-mgt-feature - 5.0.1-SNAPSHOT + 5.0.2-SNAPSHOTNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.server.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.server.feature/pom.xml index 8896c43ebde..8339d3133fe 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.server.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.server.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt grafana-mgt-feature - 5.0.1-SNAPSHOT + 5.0.2-SNAPSHOTNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/pom.xml b/features/analytics-mgt/grafana-mgt/pom.xml index cdfca8e5a2d..5cbcb885158 100644 --- a/features/analytics-mgt/grafana-mgt/pom.xml +++ b/features/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt analytics-mgt-feature - 5.0.1-SNAPSHOT + 5.0.2-SNAPSHOTNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/pom.xml b/features/analytics-mgt/pom.xml index 29d65d264a7..1f9676ff9d6 100644 --- a/features/analytics-mgt/pom.xml +++ b/features/analytics-mgt/pom.xml @@ -3,7 +3,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 5.0.1-SNAPSHOT + 5.0.2-SNAPSHOTNAPSHOT ../../pom.xml From af88cbecebe697420c7cd3a162a3d847d9fdaadf Mon Sep 17 00:00:00 2001 From: Pahansith Gunathilake Date: Mon, 24 Jan 2022 13:52:33 +0530 Subject: [PATCH 2/3] Bump dependency versions --- .../io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml | 2 +- .../pom.xml | 2 +- features/analytics-mgt/grafana-mgt/pom.xml | 2 +- features/analytics-mgt/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml index 9a7c6617b96..d8e5c2706ce 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt grafana-mgt-feature - 5.0.2-SNAPSHOTNAPSHOT + 5.0.2-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.server.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.server.feature/pom.xml index 8339d3133fe..6da2e549802 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.server.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.server.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt grafana-mgt-feature - 5.0.2-SNAPSHOTNAPSHOT + 5.0.2-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/pom.xml b/features/analytics-mgt/grafana-mgt/pom.xml index 5cbcb885158..142d7fa3886 100644 --- a/features/analytics-mgt/grafana-mgt/pom.xml +++ b/features/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt analytics-mgt-feature - 5.0.2-SNAPSHOTNAPSHOT + 5.0.2-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/pom.xml b/features/analytics-mgt/pom.xml index 1f9676ff9d6..3fd6f332492 100644 --- a/features/analytics-mgt/pom.xml +++ b/features/analytics-mgt/pom.xml @@ -3,7 +3,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 5.0.2-SNAPSHOTNAPSHOT + 5.0.2-SNAPSHOT ../../pom.xml From 507a21a04735ab111f7e9056dac3f888a5936744 Mon Sep 17 00:00:00 2001 From: charitha Date: Tue, 8 Feb 2022 21:52:25 +0530 Subject: [PATCH 3/3] Fix incorrect response handling logic --- .../ui/request/interceptor/util/HandlerUtil.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java index 64f8a3e221f..a4b8f236bd9 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerUtil.java @@ -49,6 +49,7 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.xml.serialize.OutputFormat; import org.apache.xml.serialize.XMLSerializer; +import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.w3c.dom.Document; @@ -263,10 +264,18 @@ public class HandlerUtil { if (!StringUtils.isEmpty(responseData)) { try { - JSONObject responseDataJsonObj = new JSONObject(responseData); - response.put("data", responseDataJsonObj); + if (responseData.startsWith("{")) { + JSONObject responseDataJsonObj = new JSONObject(responseData); + response.put("data", responseDataJsonObj); + } else if (responseData.startsWith("[")) { + JSONArray responseDataJsonArr = new JSONArray(responseData); + response.put("data", responseDataJsonArr); + } else { + log.warn("Response data is not valid json string >> " + responseData); + response.put("data", responseData); + } } catch (JSONException e) { - log.debug("Response data is not valid json string"); + log.error("Response data is not passable"); response.put("data", responseData); } }