mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-14 00:30:31 +00:00
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:
parent
5c37e919fa
commit
028008cc08
1 changed files with 3 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue