Commit d53eb3a3 authored by Ryan Wiedemann's avatar Ryan Wiedemann

pull all `URLDecoder.decode` calls into one method and suppress the warning...

pull all `URLDecoder.decode` calls into one method and suppress the warning since changing it appears to have broken things before.
parent ea25ad2c
Pipeline #1778 passed with stage
......@@ -264,12 +264,8 @@ public abstract class GuiDownloadService implements Runnable {
count++;
cardSkipped = true; //assume skipped unless saved successfully
String url = kv.getValue();
/*
* decode URL Key, Reverted to old version,
* on Android 6.0 it throws an error
* when you download the card price
*/
String decodedKey = URLDecoder.decode(kv.getKey());
String decodedKey = decodeURL(kv.getKey());
final File fileDest = new File(decodedKey);
final String filePath = fileDest.getPath();
final String subLastIndex = filePath.contains("pics") ? "\\pics\\" : "\\db\\";
......@@ -365,6 +361,16 @@ public abstract class GuiDownloadService implements Runnable {
GuiBase.getInterface().preventSystemSleep(false);
}
@SuppressWarnings("deprecation")
private static String decodeURL(String key) {
/*
* decode URL Key, Reverted to old version,
* on Android 6.0 it throws an error
* when you download the card price
*/
return URLDecoder.decode(key);
}
protected Proxy getProxy() {
if (type == 0) {
return Proxy.NO_PROXY;
......@@ -385,7 +391,7 @@ public abstract class GuiDownloadService implements Runnable {
protected static void addMissingItems(Map<String, String> list, String nameUrlFile, String dir) {
for (Pair<String, String> nameUrlPair : FileUtil.readNameUrlFile(nameUrlFile)) {
File f = new File(dir, URLDecoder.decode(nameUrlPair.getLeft()));
File f = new File(dir, decodeURL(nameUrlPair.getLeft()));
//System.out.println(f.getAbsolutePath());
if (!f.exists()) {
list.put(f.getAbsolutePath(), nameUrlPair.getRight());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment