Merge pull request #5947 from ViacheslavKlimov/fix/lwm2m-config-validation-npe
[3.3.3] Fix NPE during Lwm2mDeviceProfileTransportConfiguration validation
This commit is contained in:
commit
847630259c
@ -420,12 +420,14 @@ public class DeviceProfileServiceImpl extends AbstractEntityService implements D
|
||||
}
|
||||
} else if (transportConfiguration instanceof Lwm2mDeviceProfileTransportConfiguration) {
|
||||
List<LwM2MBootstrapServerCredential> lwM2MBootstrapServersConfigurations = ((Lwm2mDeviceProfileTransportConfiguration) transportConfiguration).getBootstrap();
|
||||
if (lwM2MBootstrapServersConfigurations != null) {
|
||||
validateLwm2mServersConfigOfBootstrapForClient(lwM2MBootstrapServersConfigurations,
|
||||
((Lwm2mDeviceProfileTransportConfiguration) transportConfiguration).isBootstrapServerUpdateEnable());
|
||||
for (LwM2MBootstrapServerCredential bootstrapServerCredential : lwM2MBootstrapServersConfigurations) {
|
||||
validateLwm2mServersCredentialOfBootstrapForClient(bootstrapServerCredential);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<DeviceProfileAlarm> profileAlarms = deviceProfile.getProfileData().getAlarms();
|
||||
|
||||
@ -722,21 +724,19 @@ public class DeviceProfileServiceImpl extends AbstractEntityService implements D
|
||||
}
|
||||
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!");
|
||||
};
|
||||
}
|
||||
String uri = serverConfig.getHost() + ":" + serverConfig.getPort();
|
||||
if (!uris.add(uri)) {
|
||||
throw new DeviceCredentialsValidationException(server + " \"Host + port\" value = " + uri + ". This value must be a unique value for all servers!");
|
||||
};
|
||||
}
|
||||
Integer port;
|
||||
if (LwM2MSecurityMode.NO_SEC.equals(serverConfig.getSecurityMode())) {
|
||||
port = serverConfig.isBootstrapServerIs() ? 5687 : 5685;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
port = serverConfig.isBootstrapServerIs() ? 5688 : 5686;
|
||||
}
|
||||
if (serverConfig.getPort() == null || serverConfig.getPort().intValue() != port) {
|
||||
throw new DeviceCredentialsValidationException(server + " \"Port\" value = " + serverConfig.getPort() + ". This value for security " + serverConfig.getSecurityMode().name() + " must be " + port + "!");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user