codeconsole commented on code in PR #16323:
URL: https://github.com/apache/grails-core/pull/16323#discussion_r3974133416
##########
grails-views-gson/src/main/groovy/grails/plugin/json/view/api/internal/DefaultJsonViewHelper.groovy:
##########
@@ -160,33 +160,33 @@ class DefaultJsonViewHelper extends
DefaultGrailsViewHelper {
ViewUtils.getBooleanFromMap(ASSOCIATIONS, arguments, true)
}
- protected List<Link> getPaginationLinks(Object object, Integer total,
Parameters params) {
- int offset = params.int(PAGINATION_OFFSET, 0)
+ protected List<Link> getPaginationLinks(Object object, Long total,
Parameters params) {
+ long offset = params.long(PAGINATION_OFFSET, 0L)
int max = params.int(PAGINATION_MAX, 10)
Review Comment:
No — `max` is a page size, and GORM takes it as an `int` at the source
(`Query.max(int)`, `Query.maxResults(int)`). `total` and `offset` are positions
in the result set, which is what can exceed 2^31.
Every expression mixing them already widens through the `Long` operand —
`offset + max`, `Math.max(offset - max, 0L)`, `laststep * max` — so nothing
truncates.
--
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]