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

Fix bug when using default get limit. #1

Merged
merged 1 commit into from Dec 17, 2013
Merged

Conversation

pfdevmuller
Copy link
Contributor

Bug:
The existing code passed 0 as the default page size limit when calling
getArtists, getAlbums or getTracks. However, this resulted in a response
from last.fm that contained the right data, but had empty strings as the
the page, perPage and totalPages attributes. These attributes then
failed to parse in ResponseBuilder, resulting in a
NumberFormatException.

To Reproduce:
Call Library.getArtists(String user, String apiKey) on a library with
less than 50 artists.

Fix:
To fix this I changed the library get methods (Library.getArtists,
Library.getAlbums and Library.getTracks) to omit the limit parameter
if limit <= 0. This results in last.fm using its default limit, which is
currently 50, and the response has the appropriate page, perPage and
totalPage attributes set, eliminating the parsing issue in
ResponseBuilder.

Bug:
The existing code passed 0 as the default page size limit when calling
getArtists, getAlbums or getTracks. However, this resulted in a response
from last.fm that contained the right data, but had empty strings as the
the page, perPage and totalPages attributes. These attributes then
failed to parse in ResponseBuilder, resulting in a
NumberFormatException.

To Reproduce:
Call Library.getArtists(String user, String apiKey) on a library with
less than 50 artists.

Fix:
To fix this I changed the library get methods (Library.getArtists,
Library.getAlbums and Library.getTracks) to omit the limit parameter
if limit <= 0. This results in last.fm using its default limit, which is
currently 50, and the response has the appropriate page, perPage and
totalPage attributes set, eliminating the parsing issue in
ResponseBuilder.
jkovacs added a commit that referenced this pull request Dec 17, 2013
Fix bug when using default get limit.
@jkovacs jkovacs merged commit d706524 into jkovacs:master Dec 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants