Merge pull request #778 from harshanL/master

Code refactored.
revert-70aa11f8
Ruwan 7 years ago committed by GitHub
commit 5d4c85b61e

@ -265,9 +265,14 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
@Override @Override
public List<Application> getApplicationListForDevice( public List<Application> getApplicationListForDevice(
DeviceIdentifier deviceId) throws ApplicationManagementException { DeviceIdentifier deviceId) throws ApplicationManagementException {
Device device = null;
try { try {
Device device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceId, device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceId,
false); false);
} catch (DeviceManagementException e) {
throw new ApplicationManagementException("Error occurred while fetching the device of '" +
deviceId.getType() + "' carrying the identifier'" + deviceId.getId(), e);
}
if (device == null) { if (device == null) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("No device is found upon the device identifier '" + deviceId.getId() + log.debug("No device is found upon the device identifier '" + deviceId.getId() +
@ -275,6 +280,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
} }
return null; return null;
} }
try {
DeviceManagementDAOFactory.openConnection(); DeviceManagementDAOFactory.openConnection();
return applicationDAO.getInstalledApplications(device.getId()); return applicationDAO.getInstalledApplications(device.getId());
} catch (DeviceManagementDAOException e) { } catch (DeviceManagementDAOException e) {
@ -282,9 +288,6 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
deviceId.getType() + "' device carrying the identifier'" + deviceId.getId(), e); deviceId.getType() + "' device carrying the identifier'" + deviceId.getId(), e);
} catch (SQLException e) { } catch (SQLException e) {
throw new ApplicationManagementException("Error occurred while opening a connection to the data source", e); throw new ApplicationManagementException("Error occurred while opening a connection to the data source", e);
} catch (DeviceManagementException e) {
throw new ApplicationManagementException("Error occurred while fetching the device of '" +
deviceId.getType() + "' carrying the identifier'" + deviceId.getId(), e);
} finally { } finally {
DeviceManagementDAOFactory.closeConnection(); DeviceManagementDAOFactory.closeConnection();
} }

Loading…
Cancel
Save