fixed null pointer in the initial operations

revert-70aa11f8
ayyoob 8 years ago
parent 483d09ebf1
commit cb9db4dd1d

@ -2114,22 +2114,25 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
deviceIdentifiers.add(deviceIdentifier); deviceIdentifiers.add(deviceIdentifier);
if (init != null) { if (init != null) {
List<String> initialOperations = init.getOperations(); List<String> initialOperations = init.getOperations();
if (initialOperations != null) {
for (String str : initialOperations) { for (String str : initialOperations) {
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
operation.setEnabled(true); operation.setEnabled(true);
operation.setType(Operation.Type.COMMAND); operation.setType(Operation.Type.COMMAND);
operation.setCode(str); operation.setCode(str);
try { try {
deviceManagementProviderService. deviceManagementProviderService.
addOperation(deviceType, addOperation(deviceType,
operation, deviceIdentifiers); operation, deviceIdentifiers);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
throw new DeviceManagementException("Unable to find the device with the id: '" + deviceIdentifier.getId(), throw new DeviceManagementException(
e); "Unable to find the device with the id: '" + deviceIdentifier.getId(),
} catch (InvalidDeviceException e) { e);
throw new DeviceManagementException("Unable to find the device with the id: '" + deviceIdentifier.getId(), } catch (InvalidDeviceException e) {
e); throw new DeviceManagementException(
"Unable to find the device with the id: '" + deviceIdentifier.getId(),
e);
}
} }
} }
} }

Loading…
Cancel
Save