mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-18 16:29: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.StationDepartures;
|
||||||
import de.schildbach.pte.dto.Stop;
|
import de.schildbach.pte.dto.Stop;
|
||||||
import de.schildbach.pte.exception.ParserException;
|
import de.schildbach.pte.exception.ParserException;
|
||||||
|
import de.schildbach.pte.exception.SessionExpiredException;
|
||||||
import de.schildbach.pte.util.Color;
|
import de.schildbach.pte.util.Color;
|
||||||
import de.schildbach.pte.util.ParserUtils;
|
import de.schildbach.pte.util.ParserUtils;
|
||||||
import de.schildbach.pte.util.XmlPullUtil;
|
import de.schildbach.pte.util.XmlPullUtil;
|
||||||
|
@ -1391,6 +1392,10 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
||||||
is = ParserUtils.scrapeInputStream(uri);
|
is = ParserUtils.scrapeInputStream(uri);
|
||||||
return queryConnections(uri, is);
|
return queryConnections(uri, is);
|
||||||
}
|
}
|
||||||
|
catch (final XmlPullParserException x)
|
||||||
|
{
|
||||||
|
throw new ParserException(x);
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (is != null)
|
if (is != null)
|
||||||
|
@ -1406,6 +1411,13 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
||||||
is = ParserUtils.scrapeInputStream(uri);
|
is = ParserUtils.scrapeInputStream(uri);
|
||||||
return queryConnections(uri, is);
|
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
|
finally
|
||||||
{
|
{
|
||||||
if (is != null)
|
if (is != null)
|
||||||
|
@ -1413,9 +1425,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private QueryConnectionsResult queryConnections(final String uri, final InputStream is) throws IOException
|
private QueryConnectionsResult queryConnections(final String uri, final InputStream is) throws XmlPullParserException, IOException
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
final XmlPullParser pp = parserFactory.newPullParser();
|
final XmlPullParser pp = parserFactory.newPullParser();
|
||||||
pp.setInput(is, null);
|
pp.setInput(is, null);
|
||||||
|
@ -1668,8 +1678,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
||||||
final String destinationIdStr = pp.getAttributeValue(null, "destID");
|
final String destinationIdStr = pp.getAttributeValue(null, "destID");
|
||||||
final String destinationName = normalizeLocationName(pp.getAttributeValue(null, "destination"));
|
final String destinationName = normalizeLocationName(pp.getAttributeValue(null, "destination"));
|
||||||
final Location destination = destinationIdStr.length() > 0 ? new Location(LocationType.STATION,
|
final Location destination = destinationIdStr.length() > 0 ? new Location(LocationType.STATION,
|
||||||
Integer.parseInt(destinationIdStr), null, destinationName) : new Location(LocationType.ANY, 0, null,
|
Integer.parseInt(destinationIdStr), null, destinationName) : new Location(LocationType.ANY, 0, null, destinationName);
|
||||||
destinationName);
|
|
||||||
final String lineStr;
|
final String lineStr;
|
||||||
if ("AST".equals(pp.getAttributeValue(null, "symbol")))
|
if ("AST".equals(pp.getAttributeValue(null, "symbol")))
|
||||||
lineStr = "BAST";
|
lineStr = "BAST";
|
||||||
|
@ -1742,8 +1751,8 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
||||||
if (XmlPullUtil.test(pp, "itdPathCoordinates"))
|
if (XmlPullUtil.test(pp, "itdPathCoordinates"))
|
||||||
path = processItdPathCoordinates(pp);
|
path = processItdPathCoordinates(pp);
|
||||||
|
|
||||||
parts.add(new Connection.Trip(line, destination, departureTime, departurePosition, departure, arrivalTime,
|
parts.add(new Connection.Trip(line, destination, departureTime, departurePosition, departure, arrivalTime, arrivalPosition,
|
||||||
arrivalPosition, arrival, intermediateStops, path));
|
arrival, intermediateStops, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlPullUtil.exit(pp, "itdPartialRoute");
|
XmlPullUtil.exit(pp, "itdPartialRoute");
|
||||||
|
@ -1802,11 +1811,6 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
||||||
return new QueryConnectionsResult(Status.NO_CONNECTIONS);
|
return new QueryConnectionsResult(Status.NO_CONNECTIONS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (final XmlPullParserException x)
|
|
||||||
{
|
|
||||||
throw new ParserException(x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Point> processItdPathCoordinates(final XmlPullParser pp) throws XmlPullParserException, IOException
|
private List<Point> processItdPathCoordinates(final XmlPullParser pp) throws XmlPullParserException, IOException
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue