Merge pull request #470 from rasika/release-2.0.x

Fixing device identifier is null and Throwing exception when device not found
revert-70aa11f8
Ruwan 8 years ago committed by GitHub
commit f2f304ccc4

@ -67,6 +67,7 @@ public class DeviceTypePluginDAO {
if (resultSet.next()) { if (resultSet.next()) {
device = new Device(); device = new Device();
device.setDeviceIdentifier(deviceId);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(deviceId + " data has been fetched from " + deviceDAODefinition.getDeviceTableName() + log.debug(deviceId + " data has been fetched from " + deviceDAODefinition.getDeviceTableName() +
" database."); " database.");

@ -823,11 +823,12 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
DeviceManagementDAOFactory.openConnection(); DeviceManagementDAOFactory.openConnection();
device = deviceDAO.getDevice(deviceId, this.getTenantId()); device = deviceDAO.getDevice(deviceId, this.getTenantId());
if (device == null) { if (device == null) {
String msg = "No device is found upon the type '" + deviceId.getType() + "' and id '" +
deviceId.getId() + "'";
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("No device is found upon the type '" + deviceId.getType() + "' and id '" + log.debug(msg);
deviceId.getId() + "'");
} }
return null; throw new DeviceManagementException(msg);
} }
DeviceInfo info = deviceInfoDAO.getDeviceInformation(device.getId()); DeviceInfo info = deviceInfoDAO.getDeviceInformation(device.getId());
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());

Loading…
Cancel
Save