mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 16:20:34 +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();
|
||||
}
|
||||
|
||||
if (connection.getContentType() != null)
|
||||
final int responseCode = connection.getResponseCode();
|
||||
if (responseCode == HttpURLConnection.HTTP_OK)
|
||||
{
|
||||
return connection.getInputStream();
|
||||
}
|
||||
else
|
||||
{
|
||||
final String message = "got page without content type";
|
||||
final String message = "got response: " + responseCode + " " + connection.getResponseMessage();
|
||||
if (tries-- > 0)
|
||||
System.out.println(message + ", retrying...");
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue