Github user sjcorbett commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/949#discussion_r170685134
--- Diff:
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolver.java
---
@@ -181,24 +183,27 @@ public ManagementAddressResolveResult resolve(
LoginCredentials credChoice = null;
final Iterable<HostAndPort> managementCandidates =
getManagementCandidates(location, node, config, options);
- final Iterable<LoginCredentials> credentialCandidates =
getCredentialCandidates(location, node, options, config);
-
- // Try each pair of address and credential until one succeeds.
- if (shouldCheckCredentials() &&
options.pollForReachableAddresses()) {
- for (HostAndPort hap : managementCandidates) {
- for (LoginCredentials cred : credentialCandidates) {
- LOG.trace("Testing host={} with credential={}", hap,
cred);
- if (checkCredential(location, hap, cred, config,
options.isWindows())) {
- hapChoice = hap;
- credChoice = cred;
- break;
+ Iterable<LoginCredentials> credentialCandidates =
Lists.newArrayList();
--- End diff --
You could use `Collections.emptyList()` or `ImmutableList.of()` here to
save the redundant creation of an object. You could also assign it in an `else`
block for the list so its use is a little clearer.
---