Commit 3f5e77abb7814159f10f6bedb98e28a49b5c0592

Authored by Viacheslav Klimov
1 parent 70f8a292

Check credentials type for null when saving

... ... @@ -81,6 +81,9 @@ public class DeviceCredentialsServiceImpl extends AbstractEntityService implemen
81 81 }
82 82
83 83 private DeviceCredentials saveOrUpdate(TenantId tenantId, DeviceCredentials deviceCredentials) {
  84 + if (deviceCredentials.getCredentialsType() == null) {
  85 + throw new DataValidationException("Device credentials type should be specified");
  86 + }
84 87 formatCredentials(deviceCredentials);
85 88 log.trace("Executing updateDeviceCredentials [{}]", deviceCredentials);
86 89 credentialsValidator.validate(deviceCredentials, id -> tenantId);
... ...