Handle Lyrics fetch HttpResponseException

Also marked 503 error as retryable and added log message for socket error
master
Evan Harris 5 years ago
parent 394dfa1ce7
commit 73768b94ea
No known key found for this signature in database
GPG Key ID: FF3BD4DA59FF9EDC
  1. 7
      airsonic-main/src/main/java/org/airsonic/player/ajax/LyricsService.java

@ -21,6 +21,7 @@ package org.airsonic.player.ajax;
import org.airsonic.player.util.StringUtil; import org.airsonic.player.util.StringUtil;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.ResponseHandler; import org.apache.http.client.ResponseHandler;
import org.apache.http.client.config.RequestConfig; import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
@ -73,7 +74,13 @@ public class LyricsService {
String xml = executeGetRequest(url); String xml = executeGetRequest(url);
lyrics = parseSearchResult(xml); lyrics = parseSearchResult(xml);
} catch (HttpResponseException x) {
LOG.warn("Failed to get lyrics for song '{}'. Request failed: {}", song, x.toString());
if (x.getStatusCode() == 503) {
lyrics.setTryLater(true);
}
} catch (SocketException x) { } catch (SocketException x) {
LOG.warn("Failed to get lyrics for song '{}': {}", song, x.toString());
lyrics.setTryLater(true); lyrics.setTryLater(true);
} catch (Exception x) { } catch (Exception x) {
LOG.warn("Failed to get lyrics for song '" + song + "'.", x); LOG.warn("Failed to get lyrics for song '" + song + "'.", x);

Loading…
Cancel
Save