Browse Source

Java 5 migration

pull/559/head
TacoTheDank 4 years ago
parent
commit
4256193edd
  1. 2
      app/src/main/java/org/transdroid/daemon/adapters/deluge/DelugeRpcClient.java
  2. 6
      app/src/main/java/org/transdroid/daemon/adapters/synology/SynologyAdapter.java
  3. 4
      app/src/main/java/org/transdroid/daemon/task/SetTransferRatesTask.java
  4. 2
      app/src/main/java/org/transdroid/daemon/util/SelfSignedTrustManager.java

2
app/src/main/java/org/transdroid/daemon/adapters/deluge/DelugeRpcClient.java

@ -162,7 +162,7 @@ class DelugeRpcClient implements Closeable { @@ -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());

6
app/src/main/java/org/transdroid/daemon/adapters/synology/SynologyAdapter.java

@ -323,7 +323,7 @@ public class SynologyAdapter implements IDaemonAdapter { @@ -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 { @@ -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),

4
app/src/main/java/org/transdroid/daemon/task/SetTransferRatesTask.java

@ -29,8 +29,8 @@ public class SetTransferRatesTask extends DaemonTask { @@ -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);
}

2
app/src/main/java/org/transdroid/daemon/util/SelfSignedTrustManager.java

@ -48,7 +48,7 @@ public class SelfSignedTrustManager implements X509TrustManager { @@ -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]);

Loading…
Cancel
Save