diff --git a/src/main/java/eu/m724/wtapi/provider/impl/openweathermap/OpenWeatherMapProvider.java b/src/main/java/eu/m724/wtapi/provider/impl/openweathermap/OpenWeatherMapProvider.java index e6e4e51..c78eedf 100644 --- a/src/main/java/eu/m724/wtapi/provider/impl/openweathermap/OpenWeatherMapProvider.java +++ b/src/main/java/eu/m724/wtapi/provider/impl/openweathermap/OpenWeatherMapProvider.java @@ -22,12 +22,10 @@ import eu.m724.wtapi.provider.exception.QuotaExceededException; import eu.m724.wtapi.provider.exception.ServerProviderException; public class OpenWeatherMapProvider extends WeatherProvider { - private String requestUrlFormat; private String apiKey; public OpenWeatherMapProvider(String apiKey) { this.apiKey = apiKey; - this.requestUrlFormat = "https://api.openweathermap.org/data/2.5/weather?lat=%f&lon=%f&appid=" + apiKey; } @Override @@ -44,8 +42,8 @@ public class OpenWeatherMapProvider extends WeatherProvider { @Override public CompletableFuture getWeather(Coordinates coordinates) { - String url = String.format( - requestUrlFormat, coordinates.latitude, coordinates.longitude); + String url = "https://api.openweathermap.org/data/2.5/weather?lat=%f&lon=%f&appid=%s" + .formatted(coordinates.latitude, coordinates.longitude, apiKey); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url))