kinyerakenneth / lastfm-java

Automatically exported from code.google.com/p/lastfm-java
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

User.getTopTracks throws NumberFormatException when querying certain users #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

    Collection<Track> userTracks = User.getTopTracks(user, p, key);

What is the expected output? What do you see instead?

Exception in thread "main" java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at de.umass.lastfm.Track$TrackFactory.createItemFromElement(Track.java:653)
    at de.umass.lastfm.Track$TrackFactory.createItemFromElement(Track.java:645)
    at de.umass.lastfm.ResponseBuilder.buildCollection(ResponseBuilder.java:70)
    at de.umass.lastfm.ResponseBuilder.buildCollection(ResponseBuilder.java:57)
    at de.umass.lastfm.ResponseBuilder.buildCollection(ResponseBuilder.java:51)
    at de.umass.lastfm.User.getTopTracks(User.java:207)
    at test.main(test.java:18)

What version of the product are you using? On what operating system?
Windows 7, last.fm-bindings-0.1.0

Please provide any additional information below.
Seems to happen only with certain users and when a certain period is requested.

Example: I'm able to get data from user "Quenzo" using Period.THREE_MONTHS, 
Period.TWELVE_MONTHS, and Period.TWELVE_MONTHS, but the exception is thrown 
when I use Period.SIX_MONTHS. Other users will only throw the exception when 
using Period.THREE_MONTHS, etc.

Original issue reported on code.google.com by Vertical...@gmail.com on 4 Aug 2011 at 5:39

GoogleCodeExporter commented 9 years ago
This is caused by empty <duration> elements returned by last.fm, but this issue 
is already fixed in the newest revision. You might want to check out trunk and 
build the code yourself or wait for the next release.

Original comment by jannikov...@gmail.com on 4 Aug 2011 at 12:33