fix exception throwing in init
This commit is contained in:
parent
607596a86e
commit
a04043c101
1 changed files with 4 additions and 5 deletions
|
@ -8,6 +8,7 @@ import java.net.http.HttpResponse;
|
||||||
import java.net.http.HttpResponse.BodyHandlers;
|
import java.net.http.HttpResponse.BodyHandlers;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.CompletionException;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
@ -36,11 +37,9 @@ public class OpenWeatherMapProvider extends WeatherProvider {
|
||||||
getWeather(new Coordinates(0, 0));
|
getWeather(new Coordinates(0, 0));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
weatherFuture.get();
|
weatherFuture.join();
|
||||||
} catch (InterruptedException e) {
|
} catch (CompletionException e) {
|
||||||
throw new ProviderException("unexpected interruptedexception");
|
throw (ProviderException) e;
|
||||||
} catch (ExecutionException e) {
|
|
||||||
throw (ProviderException) e.getSuppressed()[0]; // TODO
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue