From 7de234c1645e015e02cfc1174d0e7a22fa6bd9dc Mon Sep 17 00:00:00 2001 From: Hasunie Date: Thu, 16 Mar 2017 14:14:32 +0530 Subject: [PATCH 1/3] resolved #616 --- .../mdm/services/android/util/AndroidAPIUtils.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java index 39381f3cb..79a7e80d2 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java @@ -487,12 +487,16 @@ public class AndroidAPIUtils { for (JsonElement element : jsonArray) { // if (((JsonObject) element).entrySet().iterator().next().getValue().getAsString().equalsIgnoreCase(needed)); for (Map.Entry ob : ((JsonObject) element).entrySet()) { - if (exist) { - return ob.getValue().getAsString().replace("%", ""); - } JsonElement val = ob.getValue(); if (val != null && !val.isJsonNull() && ob.getValue().getAsString().equalsIgnoreCase(needed)) { - exist = true; + if (exist) { + { + return val.getAsString().replace("%", ""); + } + } + if (val.getAsString().equalsIgnoreCase(needed)) { + exist = true; + } } } } From 809a30fc7a2a74df48117c949ee90e757886c13f Mon Sep 17 00:00:00 2001 From: Hasunie Date: Thu, 16 Mar 2017 14:22:24 +0530 Subject: [PATCH 2/3] fixing code format issue --- .../wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java index 79a7e80d2..6f8c547dc 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java @@ -488,7 +488,7 @@ public class AndroidAPIUtils { // if (((JsonObject) element).entrySet().iterator().next().getValue().getAsString().equalsIgnoreCase(needed)); for (Map.Entry ob : ((JsonObject) element).entrySet()) { JsonElement val = ob.getValue(); - if (val != null && !val.isJsonNull() && ob.getValue().getAsString().equalsIgnoreCase(needed)) { + if (val != null && !val.isJsonNull()) { if (exist) { { return val.getAsString().replace("%", ""); From bd2ded8563df8090a1f07c1f41ff0ceff5573246 Mon Sep 17 00:00:00 2001 From: Harshan Liyanage Date: Thu, 16 Mar 2017 15:54:39 +0530 Subject: [PATCH 3/3] Removed unnecessary braces. --- .../carbon/mdm/services/android/util/AndroidAPIUtils.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java index 6f8c547dc..5f93aa175 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java @@ -490,9 +490,7 @@ public class AndroidAPIUtils { JsonElement val = ob.getValue(); if (val != null && !val.isJsonNull()) { if (exist) { - { - return val.getAsString().replace("%", ""); - } + return val.getAsString().replace("%", ""); } if (val.getAsString().equalsIgnoreCase(needed)) { exist = true;