fixed forbidden api failures:

Arrays.newArrayList() -> new ArrayList<>()
ImmutableSet.of() -> Collections.emptyList()

Original commit: elastic/x-pack-elasticsearch@a36a4eaa16
This commit is contained in:
Martijn van Groningen 2015-08-28 10:18:48 +02:00
parent 6da0a38ebf
commit fc9aff30bc
4 changed files with 6 additions and 8 deletions

View File

@ -5,7 +5,6 @@
*/
package org.elasticsearch.shield.action.authc.cache;
import com.google.common.collect.Lists;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.nodes.TransportNodesAction;
@ -20,6 +19,7 @@ import org.elasticsearch.shield.authc.support.CachingUsernamePasswordRealm;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicReferenceArray;
@ -42,7 +42,7 @@ public class TransportClearRealmCacheAction extends TransportNodesAction<ClearRe
@Override
protected ClearRealmCacheResponse newResponse(ClearRealmCacheRequest request, AtomicReferenceArray responses) {
final List<ClearRealmCacheResponse.Node> nodes = Lists.newArrayList();
final List<ClearRealmCacheResponse.Node> nodes = new ArrayList<>();
for (int i = 0; i < responses.length(); i++) {
Object resp = responses.get(i);
if (resp instanceof ClearRealmCacheResponse.Node) {

View File

@ -5,7 +5,6 @@
*/
package org.elasticsearch.shield.authc;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.common.component.AbstractLifecycleComponent;
@ -69,7 +68,7 @@ public class Realms extends AbstractLifecycleComponent<Realms> implements Iterab
protected List<Realm> initRealms() {
Settings realmsSettings = settings.getAsSettings("shield.authc.realms");
Set<String> internalTypes = Sets.newHashSet();
List<Realm> realms = Lists.newArrayList();
List<Realm> realms = new ArrayList<>();
for (String name : realmsSettings.names()) {
Settings realmSettings = realmsSettings.getAsSettings(name);
String type = realmSettings.get("type");

View File

@ -381,7 +381,7 @@ public class ESUsersTool extends CliTool {
Path file = FileUserRolesStore.resolveFile(esusersSettings, env);
Map<String, String[]> userRoles = FileUserRolesStore.parseFile(file, null);
List<String> roles = Lists.newArrayList();
List<String> roles = new ArrayList<>();
if (userRoles.get(username) != null) {
roles.addAll(Arrays.asList(userRoles.get(username)));
}

View File

@ -6,7 +6,6 @@
package org.elasticsearch.shield.authz.indicesresolver;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.elasticsearch.action.AliasesRequest;
import org.elasticsearch.action.CompositeIndicesRequest;
@ -98,7 +97,7 @@ public class DefaultIndicesAndAliasesResolver implements IndicesAndAliasesResolv
}
private List<String> loadAuthorizedAliases(List<String> authorizedIndices, MetaData metaData) {
List<String> authorizedAliases = Lists.newArrayList();
List<String> authorizedAliases = new ArrayList<>();
SortedMap<String, AliasOrIndex> existingAliases = metaData.getAliasAndIndexLookup();
for (String authorizedIndex : authorizedIndices) {
AliasOrIndex aliasOrIndex = existingAliases.get(authorizedIndex);
@ -110,7 +109,7 @@ public class DefaultIndicesAndAliasesResolver implements IndicesAndAliasesResolv
}
private List<String> replaceWildcardsWithAuthorizedAliases(String[] aliases, List<String> authorizedAliases) {
List<String> finalAliases = Lists.newArrayList();
List<String> finalAliases = new ArrayList<>();
//IndicesAliasesRequest doesn't support empty aliases (validation fails) but GetAliasesRequest does (in which case empty means _all)
boolean matchAllAliases = aliases.length == 0;