From 5531bc014098b961d460717058525fd9323db637 Mon Sep 17 00:00:00 2001 From: Ace Date: Mon, 7 Dec 2020 13:19:46 +0530 Subject: [PATCH] Addressing review comments --- .../mgt/dao/impl/OperationMappingDAOImpl.java | 6 +++-- .../dao/util/HeartBeatBeaconDAOUtil.java | 23 ------------------- .../HeartBeatManagementServiceImpl.java | 5 ++++ 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationMappingDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationMappingDAOImpl.java index df1ebd7b64..5cc7b773dc 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationMappingDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationMappingDAOImpl.java @@ -264,8 +264,10 @@ public class OperationMappingDAOImpl implements OperationMappingDAO { } } } catch (SQLException e) { - throw new OperationManagementDAOException("Error occurred while fetching pending operation mappings for " + - "active devices of type '" + deviceTypeId + "'", e); + String msg = "Error occurred while fetching pending operation mappings for " + + "active devices of type '" + deviceTypeId + "'"; + log.error(msg, e); + throw new OperationManagementDAOException(msg, e); } return enrolmentOperationMappingList; } diff --git a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/dao/util/HeartBeatBeaconDAOUtil.java b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/dao/util/HeartBeatBeaconDAOUtil.java index c131c3d43b..67b91df517 100644 --- a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/dao/util/HeartBeatBeaconDAOUtil.java +++ b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/dao/util/HeartBeatBeaconDAOUtil.java @@ -62,29 +62,6 @@ public final class HeartBeatBeaconDAOUtil { } } - /** - * Cleanup resources used to transaction - * - * @param stmt Statement used - * @param rs Obtained results set - */ - public static void cleanupResources(Statement stmt, ResultSet rs) { - if (rs != null) { - try { - rs.close(); - } catch (SQLException e) { - log.warn("Error occurred while closing result set", e); - } - } - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - log.warn("Error occurred while closing prepared statement", e); - } - } - } - /** * Lookup datasource using name and jndi properties * diff --git a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java index 5c742a984e..4281a6bc58 100644 --- a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java +++ b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java @@ -85,6 +85,7 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic } } else { String msg = "Heart Beat Configuration Disabled. Server Context Information Not available."; + log.error(msg); throw new HeartBeatManagementException(msg); } return serverCtxInfo; @@ -129,6 +130,7 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic } } else { String msg = "Heart Beat Configuration Disabled. Updating Server Context Failed."; + log.error(msg); throw new HeartBeatManagementException(msg); } return uuid; @@ -161,6 +163,7 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic } } else { String msg = "Heart Beat Configuration Disabled. Error occurred while checking if server is qualified to execute randomly designated task."; + log.error(msg); throw new HeartBeatManagementException(msg); } return isQualified; @@ -204,6 +207,7 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic } } else { String msg = "Heart Beat Configuration Disabled. Updating acknowledged task list failed."; + log.error(msg); throw new HeartBeatManagementException(msg); } return result; @@ -245,6 +249,7 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic } } else { String msg = "Heart Beat Configuration Disabled. Error electing candidate for dynamic task execution."; + log.error(msg); throw new HeartBeatManagementException(msg); } }