Browse Source

fix_bug: lwm2m Bootstrap ShortServerId must not be less than 0 and more than 65535!

pull/10978/head
nick 2 years ago
parent
commit
d5f954d3df
  1. 4
      dao/src/main/java/org/thingsboard/server/dao/service/validator/DeviceProfileDataValidator.java

4
dao/src/main/java/org/thingsboard/server/dao/service/validator/DeviceProfileDataValidator.java

@ -331,6 +331,10 @@ public class DeviceProfileDataValidator extends AbstractHasOtaPackageValidator<D
throw new DeviceCredentialsValidationException("LwM2M Server ShortServerId must not be less than 1 and more than 65534!"); throw new DeviceCredentialsValidationException("LwM2M Server ShortServerId must not be less than 1 and more than 65534!");
} }
if (serverConfig.isBootstrapServerIs() && !(serverConfig.getShortServerId() < 0 || serverConfig.getShortServerId() > 65535)) {
throw new DeviceCredentialsValidationException("Bootstrap Server ShortServerId must not be less than 0 and more than 65535!");
}
String server = serverConfig.isBootstrapServerIs() ? "Bootstrap Server" : "LwM2M Server"; String server = serverConfig.isBootstrapServerIs() ? "Bootstrap Server" : "LwM2M Server";
if (!shortServerIds.add(serverConfig.getShortServerId())) { if (!shortServerIds.add(serverConfig.getShortServerId())) {
throw new DeviceCredentialsValidationException(server + " \"Short server Id\" value = " + serverConfig.getShortServerId() + ". This value must be a unique value for all servers!"); throw new DeviceCredentialsValidationException(server + " \"Short server Id\" value = " + serverConfig.getShortServerId() + ". This value must be a unique value for all servers!");

Loading…
Cancel
Save