commit
67ae7ef3b2
@ -392,6 +392,11 @@ public class TelemetryController extends BaseController {
|
||||
if (attributes.isEmpty()) {
|
||||
return getImmediateDeferredResult("No attributes data found in request body!", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
for (AttributeKvEntry attributeKvEntry: attributes) {
|
||||
if (attributeKvEntry.getKey().isEmpty() || attributeKvEntry.getKey().trim().length() == 0) {
|
||||
return getImmediateDeferredResult("Key cannot be empty or contains only spaces", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
SecurityUser user = getCurrentUser();
|
||||
return accessValidator.validateEntityAndCallback(getCurrentUser(), Operation.WRITE_ATTRIBUTES, entityIdSrc, (result, tenantId, entityId) -> {
|
||||
tsSubService.saveAndNotify(tenantId, entityId, scope, attributes, new FutureCallback<Void>() {
|
||||
|
||||
@ -122,7 +122,13 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
|
||||
log.trace("[{}] Processing msg: {}", sessionId, msg);
|
||||
try {
|
||||
if (msg instanceof MqttMessage) {
|
||||
processMqttMsg(ctx, (MqttMessage) msg);
|
||||
MqttMessage message = (MqttMessage) msg;
|
||||
if (message.decoderResult().isSuccess()) {
|
||||
processMqttMsg(ctx, message);
|
||||
} else {
|
||||
log.error("[{}] Message processing failed: {}", sessionId, message.decoderResult().cause().getMessage());
|
||||
ctx.close();
|
||||
}
|
||||
} else {
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
@ -548,7 +548,7 @@ public class DeviceServiceImpl extends AbstractEntityService implements DeviceSe
|
||||
|
||||
@Override
|
||||
protected void validateDataImpl(TenantId tenantId, Device device) {
|
||||
if (StringUtils.isEmpty(device.getName())) {
|
||||
if (StringUtils.isEmpty(device.getName()) || device.getName().trim().length() == 0) {
|
||||
throw new DataValidationException("Device name should be specified!");
|
||||
}
|
||||
if (device.getTenantId() == null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user