From 4256193edd55ca7fdb961b68feb844cb2e8b93d2 Mon Sep 17 00:00:00 2001 From: TacoTheDank Date: Fri, 10 Jul 2020 18:40:40 -0400 Subject: [PATCH] Java 5 migration --- .../transdroid/daemon/adapters/deluge/DelugeRpcClient.java | 2 +- .../daemon/adapters/synology/SynologyAdapter.java | 6 +++--- .../org/transdroid/daemon/task/SetTransferRatesTask.java | 4 ++-- .../org/transdroid/daemon/util/SelfSignedTrustManager.java | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/transdroid/daemon/adapters/deluge/DelugeRpcClient.java b/app/src/main/java/org/transdroid/daemon/adapters/deluge/DelugeRpcClient.java index ffc4c6fe..aec2fb76 100644 --- a/app/src/main/java/org/transdroid/daemon/adapters/deluge/DelugeRpcClient.java +++ b/app/src/main/java/org/transdroid/daemon/adapters/deluge/DelugeRpcClient.java @@ -162,7 +162,7 @@ class DelugeRpcClient implements Closeable { if (!(responseObject instanceof List)) { throw new DaemonException(ExceptionType.UnexpectedResponse, responseObject.toString()); } - final List response = (List) responseObject; + final List response = (List) responseObject; if (response.size() < RESPONSE_RETURN_VALUE_INDEX + 1) { throw new DaemonException(ExceptionType.UnexpectedResponse, responseObject.toString()); diff --git a/app/src/main/java/org/transdroid/daemon/adapters/synology/SynologyAdapter.java b/app/src/main/java/org/transdroid/daemon/adapters/synology/SynologyAdapter.java index ea49facf..45c39888 100644 --- a/app/src/main/java/org/transdroid/daemon/adapters/synology/SynologyAdapter.java +++ b/app/src/main/java/org/transdroid/daemon/adapters/synology/SynologyAdapter.java @@ -323,7 +323,7 @@ public class SynologyAdapter implements IDaemonAdapter { long downloaded = transfer.getLong("size_downloaded"); int speed = transfer.getInt("speed_download"); long size = jsonTorrent.getLong("size"); - Float eta = Float.valueOf(size - downloaded) / speed; + float eta = (float) (size - downloaded) / speed; int totalSeeders = 0; int totalLeechers = 0; if (additional.has("tracker")) { @@ -349,11 +349,11 @@ public class SynologyAdapter implements IDaemonAdapter { totalSeeders, detail.getInt("connected_leechers"), totalLeechers, - eta.intValue(), + (int) eta, downloaded, transfer.getLong("size_uploaded"), size, - (size == 0) ? 0 : (Float.valueOf(downloaded) / size), + (size == 0) ? 0 : ((float) downloaded / size), 0, jsonTorrent.getString("title"), new Date(detail.getLong("create_time") * 1000), diff --git a/app/src/main/java/org/transdroid/daemon/task/SetTransferRatesTask.java b/app/src/main/java/org/transdroid/daemon/task/SetTransferRatesTask.java index 33c27dbf..5171f599 100644 --- a/app/src/main/java/org/transdroid/daemon/task/SetTransferRatesTask.java +++ b/app/src/main/java/org/transdroid/daemon/task/SetTransferRatesTask.java @@ -29,8 +29,8 @@ public class SetTransferRatesTask extends DaemonTask { public static SetTransferRatesTask create(IDaemonAdapter adapter, Integer uploadRate, Integer downloadRate) { Bundle data = new Bundle(); - data.putInt("UPLOAD_RATE", (uploadRate == null ? -1 : uploadRate.intValue())); - data.putInt("DOWNLOAD_RATE", (downloadRate == null ? -1 : downloadRate.intValue())); + data.putInt("UPLOAD_RATE", (uploadRate == null ? -1 : uploadRate)); + data.putInt("DOWNLOAD_RATE", (downloadRate == null ? -1 : downloadRate)); return new SetTransferRatesTask(adapter, data); } diff --git a/app/src/main/java/org/transdroid/daemon/util/SelfSignedTrustManager.java b/app/src/main/java/org/transdroid/daemon/util/SelfSignedTrustManager.java index d8fc8111..b9eb924b 100644 --- a/app/src/main/java/org/transdroid/daemon/util/SelfSignedTrustManager.java +++ b/app/src/main/java/org/transdroid/daemon/util/SelfSignedTrustManager.java @@ -48,7 +48,7 @@ public class SelfSignedTrustManager implements X509TrustManager { private static String hexify(byte[] bytes) { char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; - StringBuffer buf = new StringBuffer(bytes.length * 2); + StringBuilder buf = new StringBuilder(bytes.length * 2); for (byte aByte : bytes) { buf.append(hexDigits[(aByte & 0xf0) >> 4]); buf.append(hexDigits[aByte & 0x0f]);