Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returned size is the -1 from the parameter that is given [DATAREST-698] #1070

Closed
spring-projects-issues opened this issue Oct 28, 2015 · 2 comments
Assignees
Labels
status: duplicate type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Oct 28, 2015

Petar Tahchiev opened DATAREST-698 and commented

I'm calling this url:

https://solar.local:8112/storefront/rest/product?projection=search&_dc=1445984507953&page=2&size=10

and I only get 9 results back. As far as I understand the reason is in PageableHandlerMethodArgumentResolver:240 and there we see the following:


		int page = StringUtils.hasText(pageString) ? parseAndApplyBoundaries(pageString, Integer.MAX_VALUE)
				: defaultOrFallback.getPageNumber();
		int pageSize = StringUtils.hasText(pageSizeString) ? parseAndApplyBoundaries(pageSizeString, maxPageSize)
				: defaultOrFallback.getPageSize();

The same method parseAndApplyBoundaries is called for both page and size parameters. And in this method there is a check if I'm using oneIndexedParameters which is yes in my case. Then it will substract -1 because I'm using oneIndexedParameters:

int parsed = Integer.parseInt(parameter) - (oneIndexedParameters ? 1 : 0);

so now it becomes 9.


Affects: 2.4 GA (Gosling)

Backported to: 2.4.1 (Gosling SR1)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Nov 2, 2015

Oliver Drotbohm commented

I think that's a duplicate of DATACMNS-761, which is already fixed for Gosling SR1 and Hopper. Feel free to give the snapshots a spin

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Nov 2, 2015

Petar Tahchiev commented

Just to confirm that the latest Hopper SNAPSHOT works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate type: bug
Projects
None yet
Development

No branches or pull requests

2 participants