From 4af721ac6f07668c9952774d0e7b5a4770fc9d3a Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Wed, 28 Aug 2019 09:37:40 +0800 Subject: [PATCH] Shorter Log --- .../java/forge/download/GuiDownloadService.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/forge-gui/src/main/java/forge/download/GuiDownloadService.java b/forge-gui/src/main/java/forge/download/GuiDownloadService.java index b6e308b55bc..80b39ddde47 100644 --- a/forge-gui/src/main/java/forge/download/GuiDownloadService.java +++ b/forge-gui/src/main/java/forge/download/GuiDownloadService.java @@ -255,6 +255,8 @@ public abstract class GuiDownloadService implements Runnable { byte[] buffer = new byte[1024]; for (Entry kv : files.entrySet()) { + boolean isJPG = true; + boolean isLogged = false; if (cancel) {//stop prevent sleep GuiBase.getInterface().preventSystemSleep(false); break; } @@ -265,8 +267,10 @@ public abstract class GuiDownloadService implements Runnable { //decode URL Key String decodedKey = URLDecoder.decode(kv.getKey()); final File fileDest = new File(decodedKey); + final String filePath = fileDest.getPath(); + final String subLastIndex = filePath.contains("pics") ? "\\pics\\" : "\\db\\"; - System.out.println(count + "/" + totalCount + " - " + fileDest); + System.out.println(count + "/" + totalCount + " - ..\\" + filePath.substring(filePath.lastIndexOf(subLastIndex)+1)); FileOutputStream fos = null; try { @@ -287,8 +291,12 @@ public abstract class GuiDownloadService implements Runnable { // if file is not found and this is a JPG, give PNG a shot... if ((conn.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) && (url.endsWith(".jpg"))) { + isJPG = false; conn.disconnect(); - System.out.println(" File not found: " + url); + if(url.contains("/images/")){ + isLogged = true; + System.out.println("File not found: ../" + url.substring(url.lastIndexOf("/images/")+1)); + } url = url.substring(0,url.length() - 4) + ".png"; imageUrl = new URL(url); conn = (HttpURLConnection) imageUrl.openConnection(p); @@ -307,7 +315,8 @@ public abstract class GuiDownloadService implements Runnable { break; case HttpURLConnection.HTTP_NOT_FOUND: conn.disconnect(); - System.out.println(" File not found: " + url); + if(url.contains("/images/") && !isJPG && !isLogged) + System.out.println("File not found: ../" + url.substring(url.lastIndexOf("/images/")+1)); break; default: conn.disconnect();