mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-18 08:19:51 +00:00
detect session expiry
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@587 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
5d37d864e4
commit
2cd4ebb926
1 changed files with 346 additions and 342 deletions
|
@ -56,6 +56,7 @@ import de.schildbach.pte.dto.QueryDeparturesResult;
|
|||
import de.schildbach.pte.dto.StationDepartures;
|
||||
import de.schildbach.pte.dto.Stop;
|
||||
import de.schildbach.pte.exception.ParserException;
|
||||
import de.schildbach.pte.exception.SessionExpiredException;
|
||||
import de.schildbach.pte.util.Color;
|
||||
import de.schildbach.pte.util.ParserUtils;
|
||||
import de.schildbach.pte.util.XmlPullUtil;
|
||||
|
@ -1391,6 +1392,10 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
is = ParserUtils.scrapeInputStream(uri);
|
||||
return queryConnections(uri, is);
|
||||
}
|
||||
catch (final XmlPullParserException x)
|
||||
{
|
||||
throw new ParserException(x);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (is != null)
|
||||
|
@ -1406,6 +1411,13 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
is = ParserUtils.scrapeInputStream(uri);
|
||||
return queryConnections(uri, is);
|
||||
}
|
||||
catch (final XmlPullParserException x)
|
||||
{
|
||||
if (x.getMessage().startsWith("expected: START_TAG {null}itdRequest"))
|
||||
throw new SessionExpiredException();
|
||||
else
|
||||
throw new ParserException(x);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (is != null)
|
||||
|
@ -1413,9 +1425,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
}
|
||||
}
|
||||
|
||||
private QueryConnectionsResult queryConnections(final String uri, final InputStream is) throws IOException
|
||||
{
|
||||
try
|
||||
private QueryConnectionsResult queryConnections(final String uri, final InputStream is) throws XmlPullParserException, IOException
|
||||
{
|
||||
final XmlPullParser pp = parserFactory.newPullParser();
|
||||
pp.setInput(is, null);
|
||||
|
@ -1668,8 +1678,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
final String destinationIdStr = pp.getAttributeValue(null, "destID");
|
||||
final String destinationName = normalizeLocationName(pp.getAttributeValue(null, "destination"));
|
||||
final Location destination = destinationIdStr.length() > 0 ? new Location(LocationType.STATION,
|
||||
Integer.parseInt(destinationIdStr), null, destinationName) : new Location(LocationType.ANY, 0, null,
|
||||
destinationName);
|
||||
Integer.parseInt(destinationIdStr), null, destinationName) : new Location(LocationType.ANY, 0, null, destinationName);
|
||||
final String lineStr;
|
||||
if ("AST".equals(pp.getAttributeValue(null, "symbol")))
|
||||
lineStr = "BAST";
|
||||
|
@ -1742,8 +1751,8 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
if (XmlPullUtil.test(pp, "itdPathCoordinates"))
|
||||
path = processItdPathCoordinates(pp);
|
||||
|
||||
parts.add(new Connection.Trip(line, destination, departureTime, departurePosition, departure, arrivalTime,
|
||||
arrivalPosition, arrival, intermediateStops, path));
|
||||
parts.add(new Connection.Trip(line, destination, departureTime, departurePosition, departure, arrivalTime, arrivalPosition,
|
||||
arrival, intermediateStops, path));
|
||||
}
|
||||
|
||||
XmlPullUtil.exit(pp, "itdPartialRoute");
|
||||
|
@ -1802,11 +1811,6 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
return new QueryConnectionsResult(Status.NO_CONNECTIONS);
|
||||
}
|
||||
}
|
||||
catch (final XmlPullParserException x)
|
||||
{
|
||||
throw new ParserException(x);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Point> processItdPathCoordinates(final XmlPullParser pp) throws XmlPullParserException, IOException
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue