parse 'unresolvable address'

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@350 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach 2010-11-12 23:45:01 +00:00
parent 5e82b7ccf8
commit 0a148cef5c
4 changed files with 15 additions and 8 deletions

View file

@ -268,7 +268,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
if (code.equals("K9380"))
return QueryConnectionsResult.TOO_CLOSE;
if (code.equals("K9220")) // Nearby to the given address stations could not be found
return QueryConnectionsResult.NO_CONNECTIONS;
return QueryConnectionsResult.UNRESOLVABLE_ADDRESS;
if (code.equals("K890")) // No connections found
return QueryConnectionsResult.NO_CONNECTIONS;
throw new IllegalStateException("error " + code + " " + XmlPullUtil.attr(pp, "text"));

View file

@ -159,7 +159,7 @@ public final class BahnProvider extends AbstractHafasProvider
"<select name=\"(REQ0JourneyStopsS0K|REQ0JourneyStopsZ0K|REQ0JourneyStops1\\.0K)\"[^>]*>(.*?)</select>", Pattern.DOTALL);
private static final Pattern P_ADDRESSES = Pattern.compile("<option[^>]*>\\s*(.*?)\\s*</option>", Pattern.DOTALL);
private static final Pattern P_CHECK_CONNECTIONS_ERROR = Pattern
.compile("(zu dicht beieinander|mehrfach vorhanden oder identisch)|(leider konnte zu Ihrer Anfrage keine Verbindung gefunden werden)|(derzeit nur Ausk&#252;nfte vom)|(zwischenzeitlich nicht mehr gespeichert)");
.compile("(zu dicht beieinander|mehrfach vorhanden oder identisch)|(keine geeigneten Haltestellen)|(keine Verbindung gefunden)|(derzeit nur Ausk&#252;nfte vom)|(zwischenzeitlich nicht mehr gespeichert)");
@Override
public QueryConnectionsResult queryConnections(final Location from, final Location via, final Location to, final Date date, final boolean dep,
@ -232,10 +232,12 @@ public final class BahnProvider extends AbstractHafasProvider
if (mError.group(1) != null)
return QueryConnectionsResult.TOO_CLOSE;
if (mError.group(2) != null)
return QueryConnectionsResult.NO_CONNECTIONS;
return QueryConnectionsResult.UNRESOLVABLE_ADDRESS;
if (mError.group(3) != null)
return QueryConnectionsResult.INVALID_DATE;
return QueryConnectionsResult.NO_CONNECTIONS;
if (mError.group(4) != null)
return QueryConnectionsResult.INVALID_DATE;
if (mError.group(5) != null)
throw new SessionExpiredException();
}

View file

@ -179,7 +179,7 @@ public final class BvgProvider implements NetworkProvider
private static final Pattern P_CHECK_FROM = Pattern.compile("Von:");
private static final Pattern P_CHECK_TO = Pattern.compile("Nach:");
private static final Pattern P_CHECK_CONNECTIONS_ERROR = Pattern
.compile("(zu dicht beieinander|mehrfach vorhanden oder identisch)|(keine Verbindung gefunden)|(derzeit nur Ausk&#252;nfte vom)");
.compile("(zu dicht beieinander|mehrfach vorhanden oder identisch)|(keine geeigneten Haltestellen)|(keine Verbindung gefunden)|(derzeit nur Ausk&#252;nfte vom)");
public QueryConnectionsResult queryConnections(final Location from, final Location via, final Location to, final Date date, final boolean dep,
final String products, final WalkSpeed walkSpeed) throws IOException
@ -193,8 +193,10 @@ public final class BvgProvider implements NetworkProvider
if (mError.group(1) != null)
return QueryConnectionsResult.TOO_CLOSE;
if (mError.group(2) != null)
return QueryConnectionsResult.NO_CONNECTIONS;
return QueryConnectionsResult.UNRESOLVABLE_ADDRESS;
if (mError.group(3) != null)
return QueryConnectionsResult.NO_CONNECTIONS;
if (mError.group(4) != null)
return QueryConnectionsResult.INVALID_DATE;
}

View file

@ -157,7 +157,8 @@ public class RmvProvider extends AbstractHafasProvider
private static final Pattern P_ADDRESSES = Pattern.compile(
"<span class=\"tplight\">.*?<a href=\"http://www.rmv.de/auskunft/bin/jp/query.exe/dox.*?\">\\s*(.*?)\\s*</a>.*?</span>", Pattern.DOTALL);
private static final Pattern P_CHECK_CONNECTIONS_ERROR = Pattern.compile(
"(mehrfach vorhanden oder identisch)|(keine Verbindung gefunden werden)|(derzeit nur Ausk&#252;nfte vom)", Pattern.CASE_INSENSITIVE);
"(mehrfach vorhanden oder identisch)|(keine geeigneten Haltestellen)|(keine Verbindung gefunden)|(derzeit nur Ausk&#252;nfte vom)",
Pattern.CASE_INSENSITIVE);
@Override
public QueryConnectionsResult queryConnections(final Location from, final Location via, final Location to, final Date date, final boolean dep,
@ -172,8 +173,10 @@ public class RmvProvider extends AbstractHafasProvider
if (mError.group(1) != null)
return QueryConnectionsResult.TOO_CLOSE;
if (mError.group(2) != null)
return QueryConnectionsResult.NO_CONNECTIONS;
return QueryConnectionsResult.UNRESOLVABLE_ADDRESS;
if (mError.group(3) != null)
return QueryConnectionsResult.NO_CONNECTIONS;
if (mError.group(4) != null)
return QueryConnectionsResult.INVALID_DATE;
}