Device credential value can be null

This commit is contained in:
Volodymyr Babak 2021-08-05 15:11:08 +03:00
parent e974644d27
commit 2558b2ecda
3 changed files with 5 additions and 3 deletions

View File

@ -77,7 +77,7 @@ public class DeviceMsgConstructor {
.setCredentialsId(deviceCredentials.getCredentialsId());
}
if (deviceCredentials.getCredentialsValue() != null) {
builder.setCredentialsValue(deviceCredentials.getCredentialsValue());
builder.setCredentialsValue(getStringValue(deviceCredentials.getCredentialsValue()));
}
return builder.build();
}

View File

@ -144,7 +144,9 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor {
DeviceCredentials deviceCredentials = deviceCredentialsService.findDeviceCredentialsByDeviceId(tenantId, device.getId());
deviceCredentials.setCredentialsType(DeviceCredentialsType.valueOf(deviceCredentialsUpdateMsg.getCredentialsType()));
deviceCredentials.setCredentialsId(deviceCredentialsUpdateMsg.getCredentialsId());
deviceCredentials.setCredentialsValue(deviceCredentialsUpdateMsg.getCredentialsValue());
if (deviceCredentialsUpdateMsg.hasCredentialsValue()) {
deviceCredentials.setCredentialsValue(deviceCredentialsUpdateMsg.getCredentialsValue().getValue());
}
deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
} catch (Exception e) {
log.error("Can't update device credentials for device [{}], deviceCredentialsUpdateMsg [{}]", device.getName(), deviceCredentialsUpdateMsg, e);

View File

@ -219,7 +219,7 @@ message DeviceCredentialsUpdateMsg {
int64 deviceIdLSB = 2;
string credentialsType = 3;
string credentialsId = 4;
string credentialsValue = 5;
google.protobuf.StringValue credentialsValue = 5;
}
message AssetUpdateMsg {