Copilot commented on code in PR #10775:
URL: https://github.com/apache/rocketmq/pull/10775#discussion_r3701875318
##########
proxy/src/main/java/org/apache/rocketmq/proxy/processor/ProducerProcessor.java:
##########
@@ -72,6 +72,9 @@ public CompletableFuture<List<SendResult>>
sendMessage(ProxyContext ctx, QueueSe
long beginTimestampFirst = System.currentTimeMillis();
AddressableMessageQueue messageQueue = null;
try {
+ if (messageList == null || messageList.isEmpty()) {
+ throw new ProxyException(ProxyExceptionCode.FORBIDDEN,
"message list is empty");
+ }
Review Comment:
`sendMessage` treats a null/empty `messageList` as
`ProxyExceptionCode.FORBIDDEN`. In this codebase `FORBIDDEN` is mapped to
permission errors (Remoting: `ResponseCode.NO_PERMISSION` in
`AbstractRemotingActivity`; gRPC: `Code.FORBIDDEN` in `GrpcProxyException`), so
an invalid request payload will be reported to clients as an auth/ACL problem
rather than a bad request/message-illegal error.
Consider introducing a dedicated `ProxyExceptionCode` for invalid arguments
(e.g., `BAD_REQUEST`/`INVALID_REQUEST`) and mapping it to a client-input error
(e.g., remoting `ResponseCode.MESSAGE_ILLEGAL` and gRPC `Code.BAD_REQUEST`),
then updating the tests accordingly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]