From 911bc6f9a04ce275e7615cda774c9a8a5dc56bf0 Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Mon, 4 Mar 2019 10:25:13 +0530 Subject: [PATCH] Fix application getting issue --- .../carbon/device/application/mgt/core/dao/common/Util.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java index ed27d1a24d..14c344d6b2 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java @@ -60,8 +60,9 @@ public class Util { List applications = new ArrayList<>(); Application application = null; int applicationId = -1; + boolean hasNext = rs.next(); - while (rs.next()) { + while (hasNext) { if (applicationId != rs.getInt("APP_ID")) { if (application != null) { applications.add(application); @@ -97,7 +98,8 @@ public class Util { } } } - if (rs.last()) { + hasNext = rs.next(); + if (!hasNext) { applications.add(application); } }