mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-14 00:30:31 +00:00
parse 'session expired'
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@349 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
1b086c063c
commit
5e82b7ccf8
1 changed files with 9 additions and 2 deletions
|
@ -311,14 +311,21 @@ public final class BahnProvider extends AbstractHafasProvider
|
||||||
+ "Übergang.*?" //
|
+ "Übergang.*?" //
|
||||||
+ "<span class=\"bold\">\\s*(.+?)\\s*</span><br />\n" // arrival
|
+ "<span class=\"bold\">\\s*(.+?)\\s*</span><br />\n" // arrival
|
||||||
+ ")", Pattern.DOTALL);
|
+ ")", Pattern.DOTALL);
|
||||||
private static final Pattern P_CONNECTION_DETAILS_MESSAGES = Pattern
|
private static final Pattern P_CONNECTION_DETAILS_ERROR = Pattern.compile("(zwischenzeitlich nicht mehr gespeichert)");
|
||||||
.compile("Dauer: \\d+:\\d+|(Anschlusszug nicht mehr rechtzeitig)|(Anschlusszug jedoch erreicht werden)|(nur teilweise dargestellt)|(Längerer Aufenthalt)|(äquivalentem Bahnhof)|(Bahnhof wird mehrfach durchfahren)");
|
private static final Pattern P_CONNECTION_DETAILS_MESSAGES = Pattern.compile("Dauer: \\d+:\\d+");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GetConnectionDetailsResult getConnectionDetails(final String uri) throws IOException
|
public GetConnectionDetailsResult getConnectionDetails(final String uri) throws IOException
|
||||||
{
|
{
|
||||||
final CharSequence page = ParserUtils.scrape(uri);
|
final CharSequence page = ParserUtils.scrape(uri);
|
||||||
|
|
||||||
|
final Matcher mError = P_CONNECTION_DETAILS_ERROR.matcher(page);
|
||||||
|
if (mError.find())
|
||||||
|
{
|
||||||
|
if (mError.group(1) != null)
|
||||||
|
throw new SessionExpiredException();
|
||||||
|
}
|
||||||
|
|
||||||
final Matcher mHead = P_CONNECTION_DETAILS_HEAD.matcher(page);
|
final Matcher mHead = P_CONNECTION_DETAILS_HEAD.matcher(page);
|
||||||
if (mHead.matches())
|
if (mHead.matches())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue