Skip to content

Commit

Permalink
Merge pull request #5367 from HSLdevcom/fix-park-and-ride
Browse files Browse the repository at this point in the history
Fix issue with null headers in HSL park updater
  • Loading branch information
optionsome authored Sep 22, 2023
2 parents 9fc27a8 + bcd4e6c commit 96b1230
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public HslParkUpdater(
parameters.utilizationsUrl(),
"",
parkPatchMapper::parseUtilization,
null
Map.of()
);
this.facilitiesFrequencySec = parameters.facilitiesFrequencySec();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -23,26 +25,26 @@ public class JsonDataListDownloader<T> {
private final OtpHttpClient otpHttpClient;

public JsonDataListDownloader(
String url,
String jsonParsePath,
Function<JsonNode, T> elementParser,
Map<String, String> headers
@Nonnull String url,
@Nonnull String jsonParsePath,
@Nonnull Function<JsonNode, T> elementParser,
@Nonnull Map<String, String> headers
) {
this(url, jsonParsePath, elementParser, headers, new OtpHttpClient());
}

public JsonDataListDownloader(
String url,
String jsonParsePath,
Function<JsonNode, T> elementParser,
Map<String, String> headers,
OtpHttpClient OtpHttpClient
@Nonnull String url,
@Nonnull String jsonParsePath,
@Nonnull Function<JsonNode, T> elementParser,
@Nonnull Map<String, String> headers,
@Nonnull OtpHttpClient OtpHttpClient
) {
this.url = url;
this.jsonParsePath = jsonParsePath;
this.headers = headers;
this.elementParser = elementParser;
this.otpHttpClient = OtpHttpClient;
this.url = Objects.requireNonNull(url);
this.jsonParsePath = Objects.requireNonNull(jsonParsePath);
this.headers = Objects.requireNonNull(headers);
this.elementParser = Objects.requireNonNull(elementParser);
this.otpHttpClient = Objects.requireNonNull(OtpHttpClient);
}

public List<T> download() {
Expand Down

0 comments on commit 96b1230

Please sign in to comment.