Commit 3f5e77abb7814159f10f6bedb98e28a49b5c0592
1 parent
70f8a292
Check credentials type for null when saving
Showing
1 changed file
with
3 additions
and
0 deletions
@@ -81,6 +81,9 @@ public class DeviceCredentialsServiceImpl extends AbstractEntityService implemen | @@ -81,6 +81,9 @@ public class DeviceCredentialsServiceImpl extends AbstractEntityService implemen | ||
81 | } | 81 | } |
82 | 82 | ||
83 | private DeviceCredentials saveOrUpdate(TenantId tenantId, DeviceCredentials deviceCredentials) { | 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 | formatCredentials(deviceCredentials); | 87 | formatCredentials(deviceCredentials); |
85 | log.trace("Executing updateDeviceCredentials [{}]", deviceCredentials); | 88 | log.trace("Executing updateDeviceCredentials [{}]", deviceCredentials); |
86 | credentialsValidator.validate(deviceCredentials, id -> tenantId); | 89 | credentialsValidator.validate(deviceCredentials, id -> tenantId); |