Merge branch 'rc' into fix/4124-gateway-fixes_new-version-support

This commit is contained in:
Max Petrov 2024-10-02 14:36:19 +03:00 committed by GitHub
commit b849869a2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -100,6 +100,7 @@ public class CoapEfentoTransportResource extends AbstractCoapTransportResource {
List<String> uriPath = request.getOptions().getUriPath(); List<String> uriPath = request.getOptions().getUriPath();
boolean validPath = uriPath.size() == CHILD_RESOURCE_POSITION && uriPath.get(1).equals(CURRENT_TIMESTAMP); boolean validPath = uriPath.size() == CHILD_RESOURCE_POSITION && uriPath.get(1).equals(CURRENT_TIMESTAMP);
if (!validPath) { if (!validPath) {
log.trace("Invalid path: [{}]", uriPath);
exchange.respond(CoAP.ResponseCode.BAD_REQUEST); exchange.respond(CoAP.ResponseCode.BAD_REQUEST);
} else { } else {
int dateInSec = (int) (System.currentTimeMillis() / 1000); int dateInSec = (int) (System.currentTimeMillis() / 1000);
@ -114,6 +115,7 @@ public class CoapEfentoTransportResource extends AbstractCoapTransportResource {
Request request = advanced.getRequest(); Request request = advanced.getRequest();
List<String> uriPath = request.getOptions().getUriPath(); List<String> uriPath = request.getOptions().getUriPath();
if (uriPath.size() != CHILD_RESOURCE_POSITION) { if (uriPath.size() != CHILD_RESOURCE_POSITION) {
log.trace("Unexpected uri path size, uri path: [{}]", uriPath);
exchange.respond(CoAP.ResponseCode.BAD_REQUEST); exchange.respond(CoAP.ResponseCode.BAD_REQUEST);
return; return;
} }
@ -129,6 +131,7 @@ public class CoapEfentoTransportResource extends AbstractCoapTransportResource {
processConfigurationRequest(exchange); processConfigurationRequest(exchange);
break; break;
default: default:
log.trace("Unexpected request type: [{}]", requestType);
exchange.respond(CoAP.ResponseCode.BAD_REQUEST); exchange.respond(CoAP.ResponseCode.BAD_REQUEST);
break; break;
} }
@ -195,6 +198,7 @@ public class CoapEfentoTransportResource extends AbstractCoapTransportResource {
log.error("[{}] Failed to decode Efento ProtoConfig: ", sessionId, e); log.error("[{}] Failed to decode Efento ProtoConfig: ", sessionId, e);
exchange.respond(CoAP.ResponseCode.BAD_REQUEST); exchange.respond(CoAP.ResponseCode.BAD_REQUEST);
} catch (InvalidProtocolBufferException e) { } catch (InvalidProtocolBufferException e) {
log.error("[{}] Error while processing efento message: ", sessionId, e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}); });