mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 16:20:34 +00:00
Handle case where no (further) trips can be found for binary trips (Hafas).
This commit is contained in:
parent
d241627c0f
commit
bae806d5cc
2 changed files with 37 additions and 18 deletions
|
@ -1566,6 +1566,31 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
|
||||
if (errorCode == 0)
|
||||
{
|
||||
// string encoding
|
||||
is.skipBytes(14);
|
||||
final Charset stringEncoding = Charset.forName(strings.read(is));
|
||||
strings.setEncoding(stringEncoding);
|
||||
|
||||
// read number of trips
|
||||
is.reset();
|
||||
is.skipBytes(30);
|
||||
|
||||
final int numTrips = is.readShortReverse();
|
||||
if (numTrips == 0)
|
||||
return new QueryTripsResult(header, uri, from, via, to, null, new LinkedList<Trip>());
|
||||
|
||||
// read rest of header
|
||||
is.reset();
|
||||
is.skipBytes(0x02);
|
||||
|
||||
final Location resDeparture = location(is, strings);
|
||||
final Location resArrival = location(is, strings);
|
||||
|
||||
is.skipBytes(10);
|
||||
|
||||
final long resDate = date(is);
|
||||
/* final long resDate30 = */date(is);
|
||||
|
||||
is.reset();
|
||||
is.skipBytes(extensionHeaderPtr + 0x8);
|
||||
|
||||
|
@ -1585,10 +1610,8 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
|
||||
final int disruptionsPtr = is.readIntReverse();
|
||||
|
||||
is.skipBytes(8);
|
||||
is.skipBytes(10);
|
||||
|
||||
final Charset stringEncoding = Charset.forName(strings.read(is));
|
||||
strings.setEncoding(stringEncoding);
|
||||
final String ld = strings.read(is);
|
||||
final int attrsOffset = is.readIntReverse();
|
||||
|
||||
|
@ -1626,21 +1649,6 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
// read comments
|
||||
final CommentTable comments = new CommentTable(is, commentTablePtr, tripDetailsPtr - commentTablePtr, strings);
|
||||
|
||||
// really read header
|
||||
is.reset();
|
||||
is.skipBytes(0x02);
|
||||
|
||||
final Location resDeparture = location(is, strings);
|
||||
final Location resArrival = location(is, strings);
|
||||
|
||||
final int numTrips = is.readShortReverse();
|
||||
|
||||
is.readInt();
|
||||
is.readInt();
|
||||
|
||||
final long resDate = date(is);
|
||||
/* final long resDate30 = */date(is);
|
||||
|
||||
final List<Trip> trips = new ArrayList<Trip>(numTrips);
|
||||
|
||||
// read trips
|
||||
|
|
|
@ -126,6 +126,17 @@ public class VbbProviderLiveTest extends AbstractProviderLiveTest
|
|||
print(earlierResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shortFootwayTrip() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, null, 52435193, 13473409, "12357 Berlin-Buckow",
|
||||
"Kernbeisserweg 4"), null, new Location(LocationType.ADDRESS, null, 52433989, 13474353, "12357 Berlin-Buckow", "Distelfinkweg 35"),
|
||||
new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shortViaTrip() throws Exception
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue