Dev: updated json lib, added tests;

This commit is contained in:
Oleg Agafonov 2021-10-01 13:41:54 +04:00
parent fa29b8a2a2
commit c899c332b8
4 changed files with 203 additions and 8 deletions

View file

@ -173,9 +173,7 @@ public enum ScryfallImageSource implements CardImageSource {
}
// OK, found card data, parse it
JsonParser jp = new JsonParser();
JsonElement root = jp.parse(new InputStreamReader(jsonStream));
JsonObject jsonCard = root.getAsJsonObject();
JsonObject jsonCard = JsonParser.parseReader(new InputStreamReader(jsonStream)).getAsJsonObject();
if (!jsonCard.has("card_faces")) {
throw new MageException("Couldn't find card_faces in card's JSON data: " + jsonUrl);
}