Merge pull request #5469 from hitch17/fix-verifycarddatatest

buildfix for VerifyCardDataTest
This commit is contained in:
Oleg Agafonov 2018-12-21 05:11:30 +04:00 committed by GitHub
commit b62dc39ea1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View file

@ -47,4 +47,7 @@ class JsonCard {
public List<String> variations;
public String watermark;
public String tcgplayerProductId;
public String scryfallId;
public boolean isAlternative;
public String frameEffect;
}

View file

@ -20,4 +20,5 @@ public class JsonToken {
public String uuid;
public String watermark;
public boolean isOnlineOnly;
public String scryfallId;
}

View file

@ -9,6 +9,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.text.Normalizer;
@ -120,7 +121,9 @@ public final class MtgJson {
if (stream == null) {
File file = new File(filename);
if (!file.exists()) {
InputStream download = new URL("http://mtgjson.com/v4/json/" + filename).openStream();
URLConnection connection = new URL("https://mtgjson.com/json/" + filename).openConnection();
connection.setRequestProperty("user-agent", "xmage");
InputStream download = connection.getInputStream();
Files.copy(download, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
System.out.println("Downloaded " + filename + " to " + file.getAbsolutePath());
} else {