mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 08:49:58 +00:00
Assert for valid stationId in queryDepartures().
This commit is contained in:
parent
6c934ff071
commit
7545abea7a
7 changed files with 32 additions and 1 deletions
|
@ -1446,6 +1446,8 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
public QueryDeparturesResult queryDepartures(final String stationId, final @Nullable Date time, final int maxDepartures, final boolean equivs)
|
||||
throws IOException
|
||||
{
|
||||
checkNotNull(Strings.emptyToNull(stationId));
|
||||
|
||||
return xsltDepartureMonitorRequest(stationId, time, maxDepartures, equivs);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package de.schildbach.pte;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
|
@ -52,6 +54,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
|||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
|
@ -451,6 +454,8 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
public QueryDeparturesResult queryDepartures(final String stationId, final @Nullable Date time, final int maxDepartures, final boolean equivs)
|
||||
throws IOException
|
||||
{
|
||||
checkNotNull(Strings.emptyToNull(stationId));
|
||||
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
appendXmlStationBoardParameters(uri, time, stationId, maxDepartures, equivs, "vs_java3");
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ import org.json.JSONException;
|
|||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.LineDestination;
|
||||
|
@ -836,6 +838,8 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider
|
|||
public QueryDeparturesResult queryDepartures(final String stationId, final @Nullable Date time, final int maxDepartures, final boolean equivs)
|
||||
throws IOException
|
||||
{
|
||||
checkNotNull(Strings.emptyToNull(stationId));
|
||||
|
||||
final ResultHeader resultHeader = new ResultHeader(network, SERVER_PRODUCT, SERVER_VERSION, 0, null);
|
||||
|
||||
try
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package de.schildbach.pte;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.EnumSet;
|
||||
|
@ -25,6 +27,7 @@ import java.util.Set;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
|
@ -117,6 +120,8 @@ public class BayernProvider extends AbstractEfaProvider
|
|||
public QueryDeparturesResult queryDepartures(final String stationId, final @Nullable Date time, final int maxDepartures, final boolean equivs)
|
||||
throws IOException
|
||||
{
|
||||
checkNotNull(Strings.emptyToNull(stationId));
|
||||
|
||||
return queryDeparturesMobile(stationId, time, maxDepartures, equivs);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package de.schildbach.pte;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
@ -34,6 +36,7 @@ import java.util.regex.Pattern;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
|
@ -175,6 +178,8 @@ public class InvgProvider extends AbstractHafasProvider
|
|||
public QueryDeparturesResult queryDepartures(final String stationId, final @Nullable Date time, final int maxDepartures, final boolean equivs)
|
||||
throws IOException
|
||||
{
|
||||
checkNotNull(Strings.emptyToNull(stationId));
|
||||
|
||||
final ResultHeader header = new ResultHeader(network, SERVER_PRODUCT);
|
||||
final QueryDeparturesResult result = new QueryDeparturesResult(header);
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package de.schildbach.pte;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
@ -32,6 +34,8 @@ import java.util.regex.Pattern;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
|
@ -161,6 +165,8 @@ public class SeptaProvider extends AbstractHafasProvider
|
|||
public QueryDeparturesResult queryDepartures(final String stationId, final @Nullable Date time, final int maxDepartures, final boolean equivs)
|
||||
throws IOException
|
||||
{
|
||||
checkNotNull(Strings.emptyToNull(stationId));
|
||||
|
||||
final ResultHeader header = new ResultHeader(network, SERVER_PRODUCT);
|
||||
final QueryDeparturesResult result = new QueryDeparturesResult(header);
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package de.schildbach.pte;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -438,8 +440,10 @@ public class VrsProvider extends AbstractNetworkProvider
|
|||
// VRS does not show LongDistanceTrains departures. Parameter p for product
|
||||
// filter is supported, but LongDistanceTrains filter seems to be ignored.
|
||||
// equivs not supported.
|
||||
public QueryDeparturesResult queryDepartures(String stationId, @Nullable Date time, int maxDepartures, boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, @Nullable Date time, int maxDepartures, boolean equivs) throws IOException
|
||||
{
|
||||
checkNotNull(Strings.emptyToNull(stationId));
|
||||
|
||||
// g=p means group by product; not used here
|
||||
// d=minutes overwrites c=count and returns departures for the next d minutes
|
||||
final StringBuilder uri = new StringBuilder(API_BASE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue