tju-yxq opened a new issue, #1441: URL: https://github.com/apache/rocketmq-dashboard/issues/1441
## Bug Report ### Before Creating the Bug Report - [x] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq/discussions). - [x] I have searched the [GitHub Issues](https://github.com/apache/rocketmq/issues) and [GitHub Discussions](https://github.com/apache/rocketmq/discussions) of this repository and believe that this is not a duplicate. - [x] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ. ### Runtime platform environment OS: Ubuntu 20.04 / Any OS running RocketMQ Studio ### RocketMQ version branch: rocketmq-studio version: 5.3.2+ Git commit id: f727341 ### JDK Version OpenJDK 21 ### Describe the Bug `ResetConsumerOffsetDTO` does not require the `topic` field (`@NotBlank` is missing). The `resetOffset` method passes the topic directly to `admin.resetOffsetByTimestamp()` without validation. When topic is null or blank, the admin API throws a confusing NPE or internal error instead of a clear 400 Bad Request. ### Steps to Reproduce 1. Call `POST /api/groups/reset-offset` with a body that omits `topic`: ```json {"instanceId": "xxx", "name": "my-group", "timestamp": 1699999999000} ``` 2. Observe: HTTP 500 with "Failed to reset offset: ..." (confusing internal error). ### What Did You Expected to See? HTTP 400 with "topic is required". ### What Did You See Instead? HTTP 500 with a confusing internal error message. ### Additional Context **Affected files**: - `server/src/main/java/org/apache/rocketmq/studio/instance/group/ResetConsumerOffsetDTO.java` - missing `@NotBlank` on `topic` - `server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQAdminClientImpl.java` - `resetOffset()` should validate topic before calling admin API **Fix**: Add `@NotBlank` to the `topic` field in `ResetConsumerOffsetDTO`, and add a runtime validation in `resetOffset()`: ```java public void resetOffset(String instanceId, String name, long timestamp, String topic) { if (!StringUtils.hasText(topic)) { throw new BusinessException(400, "topic is required for offset reset"); } // ... } ``` This is a 5-line fix across 2 files. -- 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]
