License Administration - issue with search
This was originally https://github.com/ufal/clarin-dspace/issues/1055#issuecomment-1559257517
Still can reproduce, see the vid: https://github.com/user-attachments/assets/847dbb38-bec4-40b0-a861-d78286971812
The most recent error in dspace.log seems to match the error in the comment above:
2025-01-27 14:17:14,875 ERROR 3c6f655c-77cc-4c92-8388-3e9f0d5c26e9 4d7221af-bd34-405a-a2d5-79c4f0690205 org.dspace.app.rest.exception.DSpaceApiExceptionControllerAdvice @ An exception has occurred (status:500)
org.dspace.app.rest.exception.PaginationException: null
at org.dspace.app.rest.utils.Utils.getPageObjectList(Utils.java:188) ~[classes/:7.6.1]
at org.dspace.app.rest.converter.ConverterService.toRestPage(ConverterService.java:208) ~[classes/:7.6.1]
at org.dspace.app.rest.converter.ConverterService$$FastClassBySpringCGLIB$$41367eae.invoke(<generated>) ~[classes/:7.6.1]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.27.jar:5.3.27]
Couldn't get the PaginationException anymore, by playing with frontend.
However, the exception can be reproduced by passing the invalid request to clarinlicenses API, e.g.
GET /server/api/core/clarinlicenses/search/byNameLike?page=3&size=10&sort=,DESC&name=Universal
The exception is thrown, when the total size of the records is less than 30 (e.g. 25).
In this case, the offset is calculated as page * size, which is 30, and if the offset is bigger than the totalSize, the PaginationException is thrown, and the PaginationException results in 500 Error.
Clarin-DSpace should somehow catch this exception, and rather provide the empty response.
Pull Request: https://github.com/ufal/clarin-dspace/pull/1184
fixed in #1184