base retry mechanism on response code rather than content type

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@394 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach@gmail.com 2010-12-15 21:29:14 +00:00
parent 5c37e919fa
commit 028008cc08

View file

@ -195,13 +195,14 @@ public final class ParserUtils
writer.close(); writer.close();
} }
if (connection.getContentType() != null) final int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK)
{ {
return connection.getInputStream(); return connection.getInputStream();
} }
else else
{ {
final String message = "got page without content type"; final String message = "got response: " + responseCode + " " + connection.getResponseMessage();
if (tries-- > 0) if (tries-- > 0)
System.out.println(message + ", retrying..."); System.out.println(message + ", retrying...");
else else