Removed unnecessary logs and added null checks in MonitoringManager

revert-70aa11f8
mharindu 9 years ago
parent 8c748b3dfd
commit 7fed00a14d

@ -293,13 +293,16 @@ public class MonitoringManagerImpl implements MonitoringManager {
} catch (PolicyManagerDAOException e) { } catch (PolicyManagerDAOException e) {
PolicyManagementDAOFactory.rollbackTransaction(); PolicyManagementDAOFactory.rollbackTransaction();
throw new PolicyComplianceException("Error occurred reading the applied policies to devices.", e); throw new PolicyComplianceException("Error occurred reading the applied policies to devices.", e);
} catch (DeviceManagementException e) {
PolicyManagementDAOFactory.rollbackTransaction();
throw new PolicyComplianceException("Error occurred while adding monitoring operation to DB.");
} finally { } finally {
PolicyManagementDAOFactory.closeConnection(); PolicyManagementDAOFactory.closeConnection();
} }
} }
private void addMonitoringOperationsToDatabase(List<Device> devices) private void addMonitoringOperationsToDatabase(List<Device> devices)
throws PolicyComplianceException, OperationManagementException { throws PolicyComplianceException, OperationManagementException, DeviceManagementException {
List<DeviceIdentifier> deviceIdentifiers = this.getDeviceIdentifiersFromDevices(devices); List<DeviceIdentifier> deviceIdentifiers = this.getDeviceIdentifiersFromDevices(devices);
CommandOperation monitoringOperation = new CommandOperation(); CommandOperation monitoringOperation = new CommandOperation();
@ -308,9 +311,10 @@ public class MonitoringManagerImpl implements MonitoringManager {
monitoringOperation.setCode(OPERATION_MONITOR); monitoringOperation.setCode(OPERATION_MONITOR);
DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl();
if (service == null) {
throw new DeviceManagementException("Error occurred while retrieving Device Management Service");
}
service.addOperation(monitoringOperation, deviceIdentifiers); service.addOperation(monitoringOperation, deviceIdentifiers);
// PolicyManagementDataHolder.getInstance().getDeviceManagementService().
// addOperation(monitoringOperation, deviceIdentifiers);
} }
private List<DeviceIdentifier> getDeviceIdentifiersFromDevices(List<Device> devices) { private List<DeviceIdentifier> getDeviceIdentifiersFromDevices(List<Device> devices) {

Loading…
Cancel
Save