yyqdbngt opened a new pull request, #2848:
URL: https://github.com/apache/rocketmq-dashboard/pull/2848

   ## Summary
   - Clamp the page-size contribution of every in-memory `subList` page slice to
     `>= 0` in the shared provider paging defaults and the vendor/DLQ overrides
     (InstanceProvider, MetadataProvider, ApacheInstanceProvider path,
     TencentInstanceProvider, AliyunInstanceProvider, RocketMQMetadataProvider,
     RocketMQDLQProvider).
   - Rewrite the two DLQ slice computations from `min(offset + pageSize, size)` 
to the
     clamp-then-add form, which also removes a `long` overflow when
     `Pagination.pageOffset` caps the offset at `Long.MAX_VALUE`.
   - Added regression tests: negative `pageSize` yields an empty page on all 
three
     `InstanceProvider` default page methods, and the DLQ group listing now 
survives
     both a negative `pageSize` and a `page` value that overflows `offset + 
pageSize`.
   
   ## Why
   Controllers pass `page`/`pageSize` through as raw `@RequestParam int` values
   (`TopicController` has no `@Validated`, and `DLQController.listDLQGroups` 
declares
   no bounds). With `pageSize = -1` the slice end was computed as `to < from`, 
so
   `List.subList(from, to)` threw `IndexOutOfBoundsException` — HTTP 500 
instead of
   an empty page. In the DLQ paths the `offset + pageSize` addition additionally
   overflowed `long` for very large page numbers (the offset is intentionally 
capped
   at `Long.MAX_VALUE` by `Pagination.pageOffset`), producing the same 500 even 
with
   a positive, controller-validated `pageSize`.
   
   ## Testing
   - `cd server && mvn -Dtest=InstanceProviderTest,RocketMQDLQProviderTest test`
     — Tests run: 26, Failures: 0, Errors: 0
   - `cd server && mvn -Dtest=RocketMQMetadataProviderTest test`
     — Tests run: 34, Failures: 0, Errors: 0
   


-- 
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]

Reply via email to