Commit 2558b2ecda6a9aec4573f21ceafed66bc716e6cf

Authored by Volodymyr Babak
1 parent e974644d

Device credential value can be null

... ... @@ -77,7 +77,7 @@ public class DeviceMsgConstructor {
77 77 .setCredentialsId(deviceCredentials.getCredentialsId());
78 78 }
79 79 if (deviceCredentials.getCredentialsValue() != null) {
80   - builder.setCredentialsValue(deviceCredentials.getCredentialsValue());
  80 + builder.setCredentialsValue(getStringValue(deviceCredentials.getCredentialsValue()));
81 81 }
82 82 return builder.build();
83 83 }
... ...
... ... @@ -144,7 +144,9 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor {
144 144 DeviceCredentials deviceCredentials = deviceCredentialsService.findDeviceCredentialsByDeviceId(tenantId, device.getId());
145 145 deviceCredentials.setCredentialsType(DeviceCredentialsType.valueOf(deviceCredentialsUpdateMsg.getCredentialsType()));
146 146 deviceCredentials.setCredentialsId(deviceCredentialsUpdateMsg.getCredentialsId());
147   - deviceCredentials.setCredentialsValue(deviceCredentialsUpdateMsg.getCredentialsValue());
  147 + if (deviceCredentialsUpdateMsg.hasCredentialsValue()) {
  148 + deviceCredentials.setCredentialsValue(deviceCredentialsUpdateMsg.getCredentialsValue().getValue());
  149 + }
148 150 deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
149 151 } catch (Exception e) {
150 152 log.error("Can't update device credentials for device [{}], deviceCredentialsUpdateMsg [{}]", device.getName(), deviceCredentialsUpdateMsg, e);
... ...
... ... @@ -219,7 +219,7 @@ message DeviceCredentialsUpdateMsg {
219 219 int64 deviceIdLSB = 2;
220 220 string credentialsType = 3;
221 221 string credentialsId = 4;
222   - string credentialsValue = 5;
  222 + google.protobuf.StringValue credentialsValue = 5;
223 223 }
224 224
225 225 message AssetUpdateMsg {
... ...