try {
try (Scanner scanner = new Scanner(url.openStream(), "UTF-8").useDelimiter("\\A")) {
String json = scanner.next();
return new JsonObject(json);
} catch (NoSuchElementException e) {
throw new VertxException("Empty network configuration file.");
} catch (DecodeException e) {
throw new VertxException("Invalid network configuration file.");
}
} catch (IOException e) {
throw new VertxException("Failed to read network configuration file.");
}
}