Aias00 opened a new pull request, #7207: URL: https://github.com/apache/rocketmq-dashboard/pull/7207
### Which Issue(s) This PR Fixes Fixes #7206. ### Brief Description `POST /api/topics/send` accepts an omitted, null, or empty body even though RocketMQ rejects zero-byte messages. The request reaches ownership/route resolution and the pooled producer, where SDK validation is reported as an upstream error instead of invalid input. Require a nonempty body on the REST DTO and enforce the zero-byte lower bound in the Apache provider's existing message-size validation. Reject direct provider calls before ownership/client resolution and keep the existing failure audit behavior. Use `@NotEmpty`, so nonempty whitespace is preserved and sent byte-for-byte. Document the HTTP 400 response. ### How Did You Test This Change? JDK 21.0.12.1, Maven 3.10.0: - Direct probe of the project's RocketMQ 5.5.0 `Validators.checkMessage` confirmed null and empty bodies throw `MQClientException`; a whitespace-only body is accepted. - Before the implementation, the seven new boundary/control cases had five assertion failures and no errors: three REST cases reached the service and returned 200 in the controller slice, and two provider cases failed to reject input before downstream work. Both whitespace controls already passed. - `mvn -f server/pom.xml -o -B -ntp '-Dtest=TopicControllerTest,RocketMQAdminClientImplTest' test`: 137 passed. - `mvn -f server/pom.xml -o -B -ntp -Dspring.profiles.active=dev '-Dtest=org.apache.rocketmq.studio.provider.apache.**,org.apache.rocketmq.studio.instance.topic.**,org.apache.rocketmq.studio.instance.dlq.**,MessageSendToolHandlerTest,MessageRedeliveryToolHandlerTest,MessageRedeliveryDlqToolHandlerTest' test`: 725 passed, 0 failures/errors/skips; compilation and bound Checkstyle validation passed. - `git diff --cached --check`: passed. Tests use controller slices and stubbed RocketMQ interactions; no live broker, MySQL, or full repository suite was run. ### Checklist - [x] One coherent validation fix - [x] Conventional commit subject - [x] New test methods end with Test - [x] REST and direct-provider rejection plus whitespace preservation covered - [x] Existing related tests, compilation, Checkstyle, and whitespace checks pass - [x] API behavior documented; no UI or schema changes -- 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]
