workaround zebra mechanism is currently broken on service

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@344 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach 2010-11-05 21:50:10 +00:00
parent 114f8db546
commit 0a77d3391f

View file

@ -108,7 +108,8 @@ public class SbbProvider extends AbstractHafasProvider
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures) throws IOException public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures) throws IOException
{ {
final CharSequence page = ParserUtils.scrape(departuresQueryUri(stationId, maxDepartures)); final String uri = departuresQueryUri(stationId, maxDepartures);
final CharSequence page = ParserUtils.scrape(uri);
// parse page // parse page
final Matcher mHeadCoarse = P_DEPARTURES_HEAD_COARSE.matcher(page); final Matcher mHeadCoarse = P_DEPARTURES_HEAD_COARSE.matcher(page);
@ -131,16 +132,17 @@ public class SbbProvider extends AbstractHafasProvider
.parseTime(mHeadFine.group(2))); .parseTime(mHeadFine.group(2)));
final int locationId = Integer.parseInt(mHeadFine.group(4)); final int locationId = Integer.parseInt(mHeadFine.group(4));
final List<Departure> departures = new ArrayList<Departure>(8); final List<Departure> departures = new ArrayList<Departure>(8);
String oldZebra = null; // String oldZebra = null;
final Matcher mDepCoarse = P_DEPARTURES_COARSE.matcher(mHeadCoarse.group(2)); final Matcher mDepCoarse = P_DEPARTURES_COARSE.matcher(mHeadCoarse.group(2));
while (mDepCoarse.find()) while (mDepCoarse.find())
{ {
final String zebra = mDepCoarse.group(1); // zebra mechanism is currently broken on service
if (oldZebra != null && zebra.equals(oldZebra)) // final String zebra = mDepCoarse.group(1);
throw new IllegalArgumentException("missed row? last:" + zebra); // if (oldZebra != null && zebra.equals(oldZebra))
else // throw new IllegalArgumentException("missed row? last:" + zebra);
oldZebra = zebra; // else
// oldZebra = zebra;
final Matcher mDepFine = P_DEPARTURES_FINE.matcher(mDepCoarse.group(2)); final Matcher mDepFine = P_DEPARTURES_FINE.matcher(mDepCoarse.group(2));
if (mDepFine.matches()) if (mDepFine.matches())