Device credential value can be null
This commit is contained in:
		
							parent
							
								
									e974644d27
								
							
						
					
					
						commit
						2558b2ecda
					
				@ -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();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
@ -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 {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user