Ref: add new static analyser rule: bestpractices.xml/UnusedAssignment

This commit is contained in:
Laurent Clouet
2024-06-06 01:05:27 +00:00
parent fd33b6d666
commit 1b3cf096d1
8 changed files with 20 additions and 29 deletions

View File

@@ -197,7 +197,7 @@ public class Server extends Thread {
public Error.Type getConfiguration() {
OS os = OS.getOS();
String publickey = null;
String publickey;
try {
HttpUrl.Builder remoteURL = Objects.requireNonNull(HttpUrl.parse(this.base_url + "/server/config.php")).newBuilder();
FormBody formBody = new FormBody.Builder()
@@ -240,12 +240,9 @@ public class Server extends Thread {
if (ServerCode.fromInt(serverConfig.getStatus()) != ServerCode.OK) {
return Error.ServerCodeToType(ServerCode.fromInt(serverConfig.getStatus()));
}
publickey = serverConfig.getPublickey();
if (publickey.isEmpty()) {
publickey = null;
}
else {
if (publickey.isEmpty() == false) {
this.user_config.setPassword(publickey);
}
}
@@ -442,12 +439,11 @@ public class Server extends Thread {
}
Request request = builder.build();
Response response = null;
try {
response = httpClient.newCall(request).execute();
Response response = httpClient.newCall(request).execute();
if (!response.isSuccessful()) {
if (response.isSuccessful() == false) {
this.log.error("Received unsuccessful HTTP response " + response);
}
@@ -470,10 +466,9 @@ public class Server extends Thread {
}
Request request = builder.build();
Response response = null;
try {
response = httpClient.newCall(request).execute();
Response response = httpClient.newCall(request).execute();
if (checkIsSuccessful && !response.isSuccessful()) {
throw new IOException("Unexpected code " + response);
@@ -509,7 +504,7 @@ public class Server extends Thread {
long size = response.body().contentLength();
// only update the gui every 1MB
byte[] buffer = new byte[1024 * 1024];
int len = 0;
int len;
long written = 0;
if (size != -1) {