Commit 2558b2ecda6a9aec4573f21ceafed66bc716e6cf
1 parent
e974644d
Device credential value can be null
Showing
3 changed files
with
5 additions
and
3 deletions
@@ -77,7 +77,7 @@ public class DeviceMsgConstructor { | @@ -77,7 +77,7 @@ public class DeviceMsgConstructor { | ||
77 | .setCredentialsId(deviceCredentials.getCredentialsId()); | 77 | .setCredentialsId(deviceCredentials.getCredentialsId()); |
78 | } | 78 | } |
79 | if (deviceCredentials.getCredentialsValue() != null) { | 79 | if (deviceCredentials.getCredentialsValue() != null) { |
80 | - builder.setCredentialsValue(deviceCredentials.getCredentialsValue()); | 80 | + builder.setCredentialsValue(getStringValue(deviceCredentials.getCredentialsValue())); |
81 | } | 81 | } |
82 | return builder.build(); | 82 | return builder.build(); |
83 | } | 83 | } |
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/DeviceEdgeProcessor.java
@@ -144,7 +144,9 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor { | @@ -144,7 +144,9 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor { | ||
144 | DeviceCredentials deviceCredentials = deviceCredentialsService.findDeviceCredentialsByDeviceId(tenantId, device.getId()); | 144 | DeviceCredentials deviceCredentials = deviceCredentialsService.findDeviceCredentialsByDeviceId(tenantId, device.getId()); |
145 | deviceCredentials.setCredentialsType(DeviceCredentialsType.valueOf(deviceCredentialsUpdateMsg.getCredentialsType())); | 145 | deviceCredentials.setCredentialsType(DeviceCredentialsType.valueOf(deviceCredentialsUpdateMsg.getCredentialsType())); |
146 | deviceCredentials.setCredentialsId(deviceCredentialsUpdateMsg.getCredentialsId()); | 146 | deviceCredentials.setCredentialsId(deviceCredentialsUpdateMsg.getCredentialsId()); |
147 | - deviceCredentials.setCredentialsValue(deviceCredentialsUpdateMsg.getCredentialsValue()); | 147 | + if (deviceCredentialsUpdateMsg.hasCredentialsValue()) { |
148 | + deviceCredentials.setCredentialsValue(deviceCredentialsUpdateMsg.getCredentialsValue().getValue()); | ||
149 | + } | ||
148 | deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials); | 150 | deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials); |
149 | } catch (Exception e) { | 151 | } catch (Exception e) { |
150 | log.error("Can't update device credentials for device [{}], deviceCredentialsUpdateMsg [{}]", device.getName(), deviceCredentialsUpdateMsg, e); | 152 | log.error("Can't update device credentials for device [{}], deviceCredentialsUpdateMsg [{}]", device.getName(), deviceCredentialsUpdateMsg, e); |
@@ -219,7 +219,7 @@ message DeviceCredentialsUpdateMsg { | @@ -219,7 +219,7 @@ message DeviceCredentialsUpdateMsg { | ||
219 | int64 deviceIdLSB = 2; | 219 | int64 deviceIdLSB = 2; |
220 | string credentialsType = 3; | 220 | string credentialsType = 3; |
221 | string credentialsId = 4; | 221 | string credentialsId = 4; |
222 | - string credentialsValue = 5; | 222 | + google.protobuf.StringValue credentialsValue = 5; |
223 | } | 223 | } |
224 | 224 | ||
225 | message AssetUpdateMsg { | 225 | message AssetUpdateMsg { |