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

Exception while trying get all tracks via Library util #1

Open
snooppy opened this issue Aug 17, 2013 · 1 comment
Open

Exception while trying get all tracks via Library util #1

snooppy opened this issue Aug 17, 2013 · 1 comment
Labels

Comments

@snooppy
Copy link
Owner

snooppy commented Aug 17, 2013

While executing Library.getTracks(...), Library.getAllTracks(...) I get exception:
Exception in thread "main" de.umass.lastfm.CallException: java.net.SocketException: Unexpected end of file from server

Post in both cases looks like:
INFO: Post body: method=library.getTracks&limit=0&page=1&api_key=key&user=user

Stacktrace:
Exception in thread "main" de.umass.lastfm.CallException: java.net.SocketException: Unexpected end of file from server
at de.umass.lastfm.Caller.call(Caller.java:251)
at de.umass.lastfm.Caller.call(Caller.java:189)
at de.umass.lastfm.Library.getTracks(Library.java:216)
at de.umass.lastfm.Library.getTracks(Library.java:199)
at de.umass.lastfm.Library.getAllTracks(Library.java:232)
at com.dmitrykrivenko.testmavenproject.App.main(App.java:48)
Caused by: java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:718)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:579)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:715)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:579)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1322)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at de.umass.lastfm.Caller.getInputStreamFromConnection(Caller.java:312)
at de.umass.lastfm.Caller.call(Caller.java:231)
... 5 more

I'm using the latest version of the library (0.1.2). OS - Ubuntu 12.04.

@ghost ghost assigned snooppy Aug 17, 2013
@snooppy
Copy link
Owner Author

snooppy commented Aug 18, 2013

I think it happens, because default limit in the method Library.getTracks(...) is setted as 0. And when server receives this request it tries to get All tracks from the library. But if library is a big, like in my case, server tries to send a very big xml to us, and this causes the error I described above.
The same error we can get in method getArtists(), getAlbums().
So, I'm offering to set DEFAULT_PAGE and DEFAULT_LIMIT (see my ISSUE-53.patch).
And also I'm offering to remove all methods getAll*() from Library to prevent excess load on the server and to prevent such errors I got.

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

No branches or pull requests

1 participant