diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidPolicyMonitoringService.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidPolicyMonitoringService.java index 3c58c0c6e..49ff0ab17 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidPolicyMonitoringService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidPolicyMonitoringService.java @@ -59,13 +59,18 @@ public class AndroidPolicyMonitoringService implements PolicyMonitoringService { List complianceFeatures = new ArrayList(); // Parsing json string to get compliance features. - JsonElement jsonElement = new JsonParser().parse((String) compliancePayload); + JsonElement jsonElement; + if (compliancePayload instanceof String) { + jsonElement = new JsonParser().parse((String) compliancePayload); + } else { + throw new PolicyComplianceException("Invalid policy compliance payload"); + } JsonArray jsonArray = jsonElement.getAsJsonArray(); Gson gson = new Gson(); ComplianceFeature complianceFeature; - for (int i = 0; i < jsonArray.size(); i++) { - complianceFeature = gson.fromJson(jsonArray.get(i), ComplianceFeature.class); + for (JsonElement element : jsonArray) { + complianceFeature = gson.fromJson(element, ComplianceFeature.class); complianceFeatures.add(complianceFeature); } diff --git a/pom.xml b/pom.xml index 34409e1cd..03f61fdd7 100644 --- a/pom.xml +++ b/pom.xml @@ -522,7 +522,7 @@ - 4.4.0 + 4.4.1 [4.4.0, 4.5.0) 1.5.4 @@ -548,27 +548,27 @@ 7.0.34.wso2v2 - 2.6.1 + 2.7.16 1.9.0 1.1.1 - 4.4.1 + 4.4.7 4.4.0 - 4.4.0 + 4.6.0-m2 - 4.4.0 + 4.5.0-m1 - 4.4.1 + 4.4.8 - 4.4.1 + 4.5.8 0.9.2-SNAPSHOT