Skip to content

Commit

Permalink
GH-1419: Sonar Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
garyrussell committed Oct 14, 2022
1 parent 8045f2c commit 4927cc5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Expand Up @@ -38,6 +38,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.springframework.http.HttpStatus;
import org.springframework.util.Base64Utils;
import org.springframework.util.StringUtils;
import org.springframework.web.util.UriUtils;
Expand Down Expand Up @@ -379,11 +380,9 @@ private Channel createQueues(Connection connection) throws IOException, URISynta
channel.queueDeclare(queueName, true, false, false, null);
}
}
if (this.management) {
if (!alivenessTest()) {
throw new BrokerNotAliveException("Aliveness test failed for localhost:15672 guest/quest; "
+ "management not available");
}
if (this.management && !alivenessTest()) {
throw new BrokerNotAliveException("Aliveness test failed for localhost:15672 guest/quest; "
+ "management not available");
}
return channel;
}
Expand Down Expand Up @@ -417,7 +416,11 @@ protected PasswordAuthentication getPasswordAuthentication() {
Thread.currentThread().interrupt();
return false;
}
return response.body().contentEquals("{\"status\":\"ok\"}");
String body = null;
if (response.statusCode() == HttpStatus.OK.value()) {
response.body();
}
return body != null && body.contentEquals("{\"status\":\"ok\"}");
}

public static boolean fatal() {
Expand Down
Expand Up @@ -54,7 +54,7 @@ public Map<String, Object> restCall(WebClient client, String baseUri, String vho
.bodyToMono(new ParameterizedTypeReference<HashMap<String, Object>>() {
})
.block(Duration.ofSeconds(10)); // NOSONAR magic#
return queueInfo;
return queueInfo != null ? queueInfo : null;
}

/**
Expand Down

0 comments on commit 4927cc5

Please sign in to comment.