From 246e354775354329a6c4544d3f31be0f054c640b Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 3 Mar 2015 18:01:54 -0800 Subject: Fix html errors not being recognized as errors --- src/github/daneren2005/dsub/service/RESTMusicService.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/github') diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java index 341b1158..69c0b236 100644 --- a/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -699,7 +699,7 @@ public class RESTMusicService implements MusicService { // If content type is XML, an error occured. Get it. String contentType = Util.getContentType(entity); - if (contentType != null && contentType.startsWith("text/xml")) { + if (contentType != null && (contentType.startsWith("text/xml") || contentType.startsWith("text/html"))) { new ErrorParser(context, getInstance(context)).parse(new InputStreamReader(in, Constants.UTF_8)); return null; // Never reached. } @@ -777,7 +777,7 @@ public class RESTMusicService implements MusicService { // If content type is XML, an error occurred. Get it. String contentType = Util.getContentType(response.getEntity()); - if (contentType != null && contentType.startsWith("text/xml")) { + if (contentType != null && (contentType.startsWith("text/xml") || contentType.startsWith("text/html"))) { InputStream in = response.getEntity().getContent(); Header contentEncoding = response.getEntity().getContentEncoding(); if (contentEncoding != null && contentEncoding.getValue().equalsIgnoreCase("gzip")) { @@ -1437,8 +1437,7 @@ public class RESTMusicService implements MusicService { // If content type is XML, an error occurred. Get it. String contentType = Util.getContentType(entity); - if (contentType != null && contentType.startsWith("text/xml")) - { + if (contentType != null && (contentType.startsWith("text/xml") || contentType.startsWith("text/html"))) { new ErrorParser(context, getInstance(context)).parse(new InputStreamReader(in, Constants.UTF_8)); return null; // Never reached. } @@ -1498,7 +1497,7 @@ public class RESTMusicService implements MusicService { // If content type is XML, an error occurred. Get it. String contentType = Util.getContentType(entity); - if (contentType != null && contentType.startsWith("text/xml")) { + if (contentType != null && (contentType.startsWith("text/xml") || contentType.startsWith("text/html"))) { new ErrorParser(context, getInstance(context)).parse(new InputStreamReader(in, Constants.UTF_8)); return null; // Never reached. } -- cgit v1.2.3