Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 402C6200CFD for ; Wed, 16 Aug 2017 10:45:42 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3F0C0168431; Wed, 16 Aug 2017 08:45:42 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CAA1716842F for ; Wed, 16 Aug 2017 10:45:39 +0200 (CEST) Received: (qmail 68071 invoked by uid 500); 16 Aug 2017 08:45:38 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 67358 invoked by uid 99); 16 Aug 2017 08:45:37 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Aug 2017 08:45:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6569AF5546; Wed, 16 Aug 2017 08:45:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: adoroszlai@apache.org To: commits@ambari.apache.org Date: Wed, 16 Aug 2017 08:45:44 -0000 Message-Id: <74f7ad1c13824e178edd52563f997016@git.apache.org> In-Reply-To: <32db31dc95484134ac4b6f80b68c3014@git.apache.org> References: <32db31dc95484134ac4b6f80b68c3014@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [11/13] ambari git commit: AMBARI-21723. Redundant type arguments (Java 8) archived-at: Wed, 16 Aug 2017 08:45:42 -0000 http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java index 16c6c16..7d8c683 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java @@ -792,7 +792,7 @@ public class Users { // make sure user entities are refreshed so that membership is updated userEntity = userDAO.findByPK(userEntity.getUserId()); - usersToGroups.put(userEntity.getUserName(), new HashSet()); + usersToGroups.put(userEntity.getUserName(), new HashSet<>()); for (MemberEntity memberEntity : userEntity.getMemberEntities()) { usersToGroups.get(userEntity.getUserName()).add(memberEntity.getGroup().getGroupName()); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/serveraction/AbstractServerAction.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/AbstractServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/AbstractServerAction.java index 9d1c992..64f84b6 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/AbstractServerAction.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/AbstractServerAction.java @@ -167,7 +167,7 @@ public abstract class AbstractServerAction implements ServerAction { * @return the (assumed read-only) configurations value from the ExecutionCommand */ protected Map> getConfigurations() { - return (executionCommand == null) ? Collections.>emptyMap() : executionCommand.getConfigurations(); + return (executionCommand == null) ? Collections.emptyMap() : executionCommand.getConfigurations(); } /** http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandler.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandler.java index 1d979d0..8749f81 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandler.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandler.java @@ -441,10 +441,10 @@ public abstract class KerberosOperationHandler { */ protected Keytab mergeKeytabs(Keytab keytab, Keytab updates) { List keytabEntries = (keytab == null) - ? Collections.emptyList() + ? Collections.emptyList() : new ArrayList<>(keytab.getEntries()); List updateEntries = (updates == null) - ? Collections.emptyList() + ? Collections.emptyList() : new ArrayList<>(updates.getEntries()); List mergedEntries = new ArrayList<>(); @@ -802,7 +802,7 @@ public abstract class KerberosOperationHandler { encryptionTypes = ENCRYPTION_TYPE_TRANSLATION_MAP.get(name.toLowerCase()); } - return (encryptionTypes == null) ? Collections.emptySet() : encryptionTypes; + return (encryptionTypes == null) ? Collections.emptySet() : encryptionTypes; } /** http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryAction.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryAction.java index e34fbe1..664cb2c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryAction.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryAction.java @@ -184,7 +184,7 @@ public class AutoSkipFailedSummaryAction extends AbstractServerAction { failures = new ArrayList<>(); hostComponents.put(hostName, failures); - publishedHostComponents.put(hostName, new HashSet()); + publishedHostComponents.put(hostName, new HashSet<>()); } Set publishedHostComponentsOnHost = publishedHostComponents.get(hostName); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java index 2b4398b..74120b6 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java @@ -34,7 +34,6 @@ import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.api.services.AmbariMetaInfo; import org.apache.ambari.server.state.ComponentInfo; import org.apache.ambari.server.state.CustomCommandDefinition; -import org.apache.ambari.server.state.PropertyInfo; import org.apache.ambari.server.state.QuickLinksConfigurationInfo; import org.apache.ambari.server.state.ServiceInfo; import org.apache.ambari.server.state.ServicePropertyInfo; @@ -217,7 +216,7 @@ public class ServiceModule extends BaseModule implem || serviceInfo.getRequiredServices().size() == 0) { serviceInfo.setRequiredServices(parent.getRequiredServices() != null ? parent.getRequiredServices() : - Collections.emptyList()); + Collections.emptyList()); } if (serviceInfo.isRestartRequiredAfterChange() == null) { @@ -426,7 +425,7 @@ public class ServiceModule extends BaseModule implem for (String excludedType : serviceInfo.getExcludedConfigTypes()) { if (! configurationModules.containsKey(excludedType)) { ConfigurationInfo configInfo = new ConfigurationInfo( - Collections.emptyList(), Collections.emptyMap()); + Collections.emptyList(), Collections.emptyMap()); ConfigurationModule config = new ConfigurationModule(excludedType, configInfo); config.setDeleted(true); @@ -545,7 +544,7 @@ public class ServiceModule extends BaseModule implem //currently there is no way to remove an inherited config dependency List configDependencies = serviceInfo.getConfigDependencies(); List parentConfigDependencies = parent.getConfigDependencies() != null ? - parent.getConfigDependencies() : Collections.emptyList(); + parent.getConfigDependencies() : Collections.emptyList(); if (configDependencies == null) { serviceInfo.setConfigDependencies(parentConfigDependencies); @@ -570,7 +569,7 @@ public class ServiceModule extends BaseModule implem ServiceModule parent, Map allStacks, Map commonServices, Map extensions) throws AmbariException { serviceInfo.getProperties().clear(); - serviceInfo.setAllConfigAttributes(new HashMap>>()); + serviceInfo.setAllConfigAttributes(new HashMap<>()); Collection mergedModules = mergeChildModules( allStacks, commonServices, extensions, configurationModules, parent.configurationModules); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/stack/StackManager.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackManager.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackManager.java index 57f7cb4..245e623 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackManager.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackManager.java @@ -250,7 +250,7 @@ public class StackManager { private void createLinks() { LOG.info("Creating links"); Collection extensions = getExtensions(); - Set names = new HashSet(); + Set names = new HashSet<>(); for(ExtensionInfo extension : extensions){ names.add(extension.getName()); } @@ -270,7 +270,7 @@ public class StackManager { */ private void createLinksForExtension(String name) { Collection collection = getExtensions(name); - List extensions = new ArrayList(collection.size()); + List extensions = new ArrayList<>(collection.size()); extensions.addAll(collection); try { helper.createExtensionLinks(this, extensions); @@ -316,11 +316,11 @@ public class StackManager { * @return A map of all stacks with the name as the key. */ public Map> getStacksByName() { - Map> stacks = new HashMap>(); + Map> stacks = new HashMap<>(); for (StackInfo stack: stackMap.values()) { List list = stacks.get(stack.getName()); if (list == null) { - list = new ArrayList(); + list = new ArrayList<>(); stacks.put(stack.getName(), list); } list.add(stack); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java index d73387d..ff1d378 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java @@ -240,7 +240,7 @@ public class StackModule extends BaseModule implements V } // Generate list of services that have no config types - List servicesWithNoConfigs = new ArrayList(); + List servicesWithNoConfigs = new ArrayList<>(); for(ServiceModule serviceModule: serviceModules.values()){ if (!serviceModule.hasConfigs()){ servicesWithNoConfigs.add(serviceModule.getId()); @@ -678,7 +678,7 @@ public class StackModule extends BaseModule implements V StackModule parent, Map allStacks, Map commonServices, Map extensions) throws AmbariException { stackInfo.getProperties().clear(); - stackInfo.setAllConfigAttributes(new HashMap>>()); + stackInfo.setAllConfigAttributes(new HashMap<>()); Collection mergedModules = mergeChildModules( allStacks, commonServices, extensions, configurationModules, parent.configurationModules); @@ -1162,7 +1162,7 @@ public class StackModule extends BaseModule implements V // Uniqueness is checked for each os type for (String osType: serviceReposByOsType.keySet()) { - List stackReposForOsType = stackReposByOsType.containsKey(osType) ? stackReposByOsType.get(osType) : Collections.emptyList(); + List stackReposForOsType = stackReposByOsType.containsKey(osType) ? stackReposByOsType.get(osType) : Collections.emptyList(); List serviceReposForOsType = serviceReposByOsType.get(osType); Set stackRepoNames = ImmutableSet.copyOf(Lists.transform(stackReposForOsType, RepositoryInfo.GET_REPO_NAME_FUNCTION)); Set stackRepoUrls = ImmutableSet.copyOf(Lists.transform(stackReposForOsType, RepositoryInfo.SAFE_GET_BASE_URL_FUNCTION)); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraph.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraph.java b/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraph.java index b508cd7..dd127d3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraph.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/stageplanner/RoleGraph.java @@ -332,7 +332,7 @@ public class RoleGraph { * when Ambari supports mpacks, custom services and service level role command order. * */ public void breakCycleGraph() throws AmbariException{ - List edges = new ArrayList(); + List edges = new ArrayList<>(); for (String role : graph.keySet()){ RoleGraphNode fromNode = graph.get(role); String fnRole = fromNode.getRole().name(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java index 6b82273..cb98dd2 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java @@ -399,7 +399,7 @@ public class ConfigHelper { for (Entry> attributesEntry : sourceAttributesMap.entrySet()) { String attributeName = attributesEntry.getKey(); if (!targetAttributesMap.containsKey(attributeName)) { - targetAttributesMap.put(attributeName, new TreeMap()); + targetAttributesMap.put(attributeName, new TreeMap<>()); } for (Entry attributesValue : attributesEntry.getValue().entrySet()) { targetAttributesMap.get(attributeName).put(attributesValue.getKey(), attributesValue.getValue()); @@ -411,7 +411,7 @@ public class ConfigHelper { public void applyCustomConfig(Map> configurations, String type, String name, String value, Boolean deleted) { if (!configurations.containsKey(type)) { - configurations.put(type, new HashMap()); + configurations.put(type, new HashMap<>()); } String nameToUse = deleted ? DELETED + name : name; Map properties = configurations.get(type); @@ -1070,7 +1070,7 @@ public class ConfigHelper { String authenticatedUserName, String serviceVersionNote) throws AmbariException { createConfigType(cluster, stackId, controller, configType, properties, - new HashMap>(), authenticatedUserName, serviceVersionNote); + new HashMap<>(), authenticatedUserName, serviceVersionNote); } public void createConfigType(Cluster cluster, StackId stackId, @@ -1109,13 +1109,13 @@ public class ConfigHelper { Map properties = entry.getValue(); Config baseConfig = createConfig(cluster, stackId, controller, type, FIRST_VERSION_TAG, - properties, Collections.> emptyMap()); + properties, Collections.emptyMap()); if (null != baseConfig) { try { String service = cluster.getServiceForConfigTypes(Collections.singleton(type)); if (!serviceMapped.containsKey(service)) { - serviceMapped.put(service, new HashSet()); + serviceMapped.put(service, new HashSet<>()); } serviceMapped.get(service).add(baseConfig); } catch (Exception e) { @@ -1208,7 +1208,7 @@ public class ConfigHelper { String type = ConfigHelper.fileNameToConfigType(stackDefaultProperty.getFilename()); if (!defaultPropertiesByType.containsKey(type)) { - defaultPropertiesByType.put(type, new HashMap()); + defaultPropertiesByType.put(type, new HashMap<>()); } defaultPropertiesByType.get(type).put(stackDefaultProperty.getName(), @@ -1240,7 +1240,7 @@ public class ConfigHelper { String type = ConfigHelper.fileNameToConfigType(stackDefaultProperty.getFilename()); if (!defaultPropertiesByType.containsKey(type)) { - defaultPropertiesByType.put(type, new HashMap()); + defaultPropertiesByType.put(type, new HashMap<>()); } defaultPropertiesByType.get(type).put(stackDefaultProperty.getName(), @@ -1256,7 +1256,7 @@ public class ConfigHelper { String type = ConfigHelper.fileNameToConfigType(serviceDefaultProperty.getFilename()); if (!defaultPropertiesByType.containsKey(type)) { - defaultPropertiesByType.put(type, new HashMap()); + defaultPropertiesByType.put(type, new HashMap<>()); } defaultPropertiesByType.get(type).put(serviceDefaultProperty.getName(), http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigImpl.java index cfcadd4..44d76af 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigImpl.java @@ -286,7 +286,7 @@ public class ConfigImpl implements Config { public Map getProperties() { propertyLock.readLock().lock(); try { - return properties == null ? new HashMap() : new HashMap<>(properties); + return properties == null ? new HashMap<>() : new HashMap<>(properties); } finally { propertyLock.readLock().unlock(); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java index bb24c8d..cf55660 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigMergeHelper.java @@ -117,7 +117,7 @@ public class ConfigMergeHelper { twv.savedValue = savedVal.trim(); if (!result.containsKey(entry.getKey())) { - result.put(entry.getKey(), new HashMap()); + result.put(entry.getKey(), new HashMap<>()); } result.get(entry.getKey()).put(prop, twv); @@ -152,7 +152,7 @@ public class ConfigMergeHelper { twv.savedValue = (null == savedVal) ? null : savedVal.trim(); if (!result.containsKey(entry.getKey())) { - result.put(entry.getKey(), new HashMap()); + result.put(entry.getKey(), new HashMap<>()); } result.get(entry.getKey()).put(prop, twv); @@ -168,7 +168,7 @@ public class ConfigMergeHelper { String type = ConfigHelper.fileNameToConfigType(pi.getFilename()); if (!map.containsKey(type)) { - map.put(type, new HashMap()); + map.put(type, new HashMap<>()); } map.get(type).put(pi.getName(), pi.getValue()); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java index 325434e..573a197 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java @@ -186,7 +186,7 @@ public class ServiceInfo implements Validable{ private List servicePropertyList = Lists.newArrayList(); @XmlTransient - private Map servicePropertyMap = ImmutableMap.copyOf(ensureMandatoryServiceProperties(Maps.newHashMap())); + private Map servicePropertyMap = ImmutableMap.copyOf(ensureMandatoryServiceProperties(Maps.newHashMap())); /** * @@ -633,7 +633,7 @@ public class ServiceInfo implements Validable{ */ public synchronized Map>> getConfigTypeAttributes() { Map>> tmpConfigTypes = configTypes == null ? - new HashMap>>() : configTypes; + new HashMap<>() : configTypes; for(String excludedtype : excludedConfigTypes){ tmpConfigTypes.remove(excludedtype); @@ -726,7 +726,7 @@ public class ServiceInfo implements Validable{ type = type.substring(0, idx); if (!configLayout.containsKey(type)) - configLayout.put(type, new HashSet()); + configLayout.put(type, new HashSet<>()); configLayout.get(type).add(pi.getName()); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java index 1494488..149579f 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java @@ -85,7 +85,7 @@ public class StackInfo implements Comparable, Validable { /** * List of services withnot configurations * */ - private List servicesWithNoConfigs = new ArrayList(); + private List servicesWithNoConfigs = new ArrayList<>(); public String getMinJdk() { return minJdk; @@ -247,7 +247,7 @@ public class StackInfo implements Comparable, Validable { */ public synchronized Map>> getConfigTypeAttributes() { return configTypes == null ? - Collections.>>emptyMap() : + Collections.emptyMap() : Collections.unmodifiableMap(configTypes); } @@ -344,7 +344,7 @@ public class StackInfo implements Comparable, Validable { isActive(), getParentStackVersion(), getConfigTypeAttributes(), (stackDescriptorFileFilePath == null) ? null : new File(stackDescriptorFileFilePath), serviceDescriptorFiles, - null == upgradePacks ? Collections.emptySet() : upgradePacks.keySet(), + null == upgradePacks ? Collections.emptySet() : upgradePacks.keySet(), isValid(), getErrors(), getMinJdk(), getMaxJdk()); } @@ -515,7 +515,7 @@ public class StackInfo implements Comparable, Validable { Set types = propertyInfo.getPropertyTypes(); for (PropertyInfo.PropertyType propertyType : types) { if (!propertiesTypes.containsKey(propertyType)) - propertiesTypes.put(propertyType, new HashSet()); + propertiesTypes.put(propertyType, new HashSet<>()); propertiesTypes.get(propertyType).add(propertyInfo.getName()); } } @@ -551,10 +551,10 @@ public class StackInfo implements Comparable, Validable { String hidden = pi.getPropertyValueAttributes().getHidden(); if(hidden != null){ if(!result.containsKey(propertyConfigType)){ - result.put(propertyConfigType, new HashMap>()); + result.put(propertyConfigType, new HashMap<>()); } if(!result.get(propertyConfigType).containsKey("hidden")){ - result.get(propertyConfigType).put("hidden", new HashMap()); + result.get(propertyConfigType).put("hidden", new HashMap<>()); } result.get(propertyConfigType).get("hidden").put(propertyName, hidden); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AggregateDefinitionMapping.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AggregateDefinitionMapping.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AggregateDefinitionMapping.java index b3f482c..9e66399 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AggregateDefinitionMapping.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AggregateDefinitionMapping.java @@ -81,7 +81,7 @@ public class AggregateDefinitionMapping { Long id = Long.valueOf(clusterId); if (!m_aggregateMap.containsKey(id)) { - m_aggregateMap.put(id, new HashMap()); + m_aggregateMap.put(id, new HashMap<>()); } Map map = m_aggregateMap.get(id); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java index c191358..84b411c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java @@ -378,16 +378,14 @@ public class ClusterImpl implements Cluster { /* get all the service component hosts **/ Service service = serviceKV.getValue(); if (!serviceComponentHosts.containsKey(service.getName())) { - serviceComponentHosts.put(service.getName(), - new ConcurrentHashMap>()); + serviceComponentHosts.put(service.getName(), new ConcurrentHashMap<>()); } for (Entry svcComponent : service.getServiceComponents().entrySet()) { ServiceComponent comp = svcComponent.getValue(); String componentName = svcComponent.getKey(); if (!serviceComponentHosts.get(service.getName()).containsKey(componentName)) { - serviceComponentHosts.get(service.getName()).put(componentName, - new ConcurrentHashMap()); + serviceComponentHosts.get(service.getName()).put(componentName, new ConcurrentHashMap<>()); } // Get Service Host Components @@ -395,8 +393,7 @@ public class ClusterImpl implements Cluster { String hostname = svchost.getKey(); ServiceComponentHost svcHostComponent = svchost.getValue(); if (!serviceComponentHostsByHost.containsKey(hostname)) { - serviceComponentHostsByHost.put(hostname, - new CopyOnWriteArrayList()); + serviceComponentHostsByHost.put(hostname, new CopyOnWriteArrayList<>()); } List compList = serviceComponentHostsByHost.get(hostname); @@ -640,13 +637,11 @@ public class ClusterImpl implements Cluster { } if (!serviceComponentHosts.containsKey(serviceName)) { - serviceComponentHosts.put(serviceName, - new ConcurrentHashMap>()); + serviceComponentHosts.put(serviceName, new ConcurrentHashMap<>()); } if (!serviceComponentHosts.get(serviceName).containsKey(componentName)) { - serviceComponentHosts.get(serviceName).put(componentName, - new ConcurrentHashMap()); + serviceComponentHosts.get(serviceName).put(componentName, new ConcurrentHashMap<>()); } if (serviceComponentHosts.get(serviceName).get(componentName).containsKey( @@ -657,8 +652,7 @@ public class ClusterImpl implements Cluster { } if (!serviceComponentHostsByHost.containsKey(hostname)) { - serviceComponentHostsByHost.put(hostname, - new CopyOnWriteArrayList()); + serviceComponentHostsByHost.put(hostname, new CopyOnWriteArrayList<>()); } if (LOG.isDebugEnabled()) { @@ -1162,7 +1156,7 @@ public class ClusterImpl implements Cluster { clusterGlobalLock.writeLock().lock(); try { if (!allConfigs.containsKey(config.getType())) { - allConfigs.put(config.getType(), new ConcurrentHashMap()); + allConfigs.put(config.getType(), new ConcurrentHashMap<>()); } allConfigs.get(config.getType()).put(config.getTag(), config); @@ -1624,8 +1618,7 @@ public class ClusterImpl implements Cluster { Set responses = getActiveServiceConfigVersionSet(); for (ServiceConfigVersionResponse response : responses) { if (map.get(response.getServiceName()) == null) { - map.put(response.getServiceName(), - new ArrayList()); + map.put(response.getServiceName(), new ArrayList<>()); } map.get(response.getServiceName()).add(response); } @@ -1745,7 +1738,7 @@ public class ClusterImpl implements Cluster { * @return serviceConfigVersionResponse */ private ServiceConfigVersionResponse getServiceConfigVersionResponseWithConfig(ServiceConfigVersionResponse serviceConfigVersionResponse, ServiceConfigEntity serviceConfigEntity) { - serviceConfigVersionResponse.setConfigurations(new ArrayList()); + serviceConfigVersionResponse.setConfigurations(new ArrayList<>()); List clusterConfigEntities = serviceConfigEntity.getClusterConfigEntities(); for (ClusterConfigEntity clusterConfigEntity : clusterConfigEntities) { Config config = allConfigs.get(clusterConfigEntity.getType()).get( @@ -1807,7 +1800,7 @@ public class ClusterImpl implements Cluster { Collection configTypes = serviceConfigTypes.get(serviceName); List enabledConfigs = clusterDAO.getEnabledConfigsByTypes(clusterId, configTypes); List serviceConfigEntities = serviceConfigEntity.getClusterConfigEntities(); - ArrayList duplicatevalues = new ArrayList(serviceConfigEntities); + ArrayList duplicatevalues = new ArrayList<>(serviceConfigEntities); duplicatevalues.retainAll(enabledConfigs); enabledConfigs.removeAll(duplicatevalues); serviceConfigEntities.removeAll(duplicatevalues); @@ -1967,7 +1960,7 @@ public class ClusterImpl implements Cluster { Map> desiredConfigsByHost = new HashMap<>(); for (Long hostId : hostIds) { - desiredConfigsByHost.put(hostId, new HashMap()); + desiredConfigsByHost.put(hostId, new HashMap<>()); } for (HostConfigMapping mappingEntity : mappingEntities) { @@ -2169,7 +2162,7 @@ public class ClusterImpl implements Cluster { //todo: in what conditions is AmbariException thrown? throw new RuntimeException("Unable to get hosts for cluster: " + clusterName, e); } - return hosts == null ? Collections.emptyList() : hosts.values(); + return hosts == null ? Collections.emptyList() : hosts.values(); } private ClusterHealthReport getClusterHealthReport( @@ -2310,7 +2303,7 @@ public class ClusterImpl implements Cluster { Map attributes = (Map) getSessionManager().getAttribute(getClusterSessionAttributeName()); - return attributes == null ? Collections.emptyMap() : attributes; + return attributes == null ? Collections.emptyMap() : attributes; } /** @@ -2521,7 +2514,7 @@ public class ClusterImpl implements Cluster { for (ClusterConfigEntity entity : clusterEntity.getClusterConfigEntities()) { if (!allConfigs.containsKey(entity.getType())) { - allConfigs.put(entity.getType(), new ConcurrentHashMap()); + allConfigs.put(entity.getType(), new ConcurrentHashMap<>()); } Config config = configFactory.createExisting(this, entity); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java index 26efc84..5ac1ac3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java @@ -177,7 +177,7 @@ public class ClustersImpl implements Clusters { Cluster currentCluster = clusterFactory.create(clusterEntity); clusters.put(clusterEntity.getClusterName(), currentCluster); clustersById.put(currentCluster.getClusterId(), currentCluster); - clusterHostMap.put(currentCluster.getClusterName(), Collections.newSetFromMap(new ConcurrentHashMap())); + clusterHostMap.put(currentCluster.getClusterName(), Collections.newSetFromMap(new ConcurrentHashMap<>())); } for (HostEntity hostEntity : hostEntities) { @@ -243,7 +243,7 @@ public class ClustersImpl implements Clusters { clusters.put(clusterName, cluster); clustersById.put(cluster.getClusterId(), cluster); clusterHostMap.put(clusterName, - Collections.newSetFromMap(new ConcurrentHashMap())); + Collections.newSetFromMap(new ConcurrentHashMap<>())); cluster.setCurrentStackVersion(stackId); } @@ -370,7 +370,7 @@ public class ClustersImpl implements Clusters { HostEntity hostEntity = new HostEntity(); hostEntity.setHostName(hostname); - hostEntity.setClusterEntities(new ArrayList()); + hostEntity.setClusterEntities(new ArrayList<>()); // not stored to DB Host host = hostFactory.create(hostEntity); @@ -378,7 +378,7 @@ public class ClustersImpl implements Clusters { List emptyDiskList = new CopyOnWriteArrayList<>(); host.setDisksInfo(emptyDiskList); host.setHealthStatus(new HostHealthStatus(HealthStatus.UNKNOWN, "")); - host.setHostAttributes(new ConcurrentHashMap()); + host.setHostAttributes(new ConcurrentHashMap<>()); host.setState(HostState.INIT); // the hosts by ID map is updated separately since the host has not yet @@ -386,7 +386,7 @@ public class ClustersImpl implements Clusters { hosts.put(hostname, host); hostClusterMap.put(hostname, - Collections.newSetFromMap(new ConcurrentHashMap())); + Collections.newSetFromMap(new ConcurrentHashMap<>())); if (LOG.isDebugEnabled()) { LOG.debug("Adding a host to Clusters, hostname={}", hostname); @@ -424,7 +424,7 @@ public class ClustersImpl implements Clusters { for (String clusterName : hostClusterNames) { if (clusterName != null && !clusterName.isEmpty()) { if (!clusterHosts.containsKey(clusterName)) { - clusterHosts.put(clusterName, new HashSet()); + clusterHosts.put(clusterName, new HashSet<>()); } clusterHosts.get(clusterName).add(hostname); } @@ -774,7 +774,7 @@ public class ClustersImpl implements Clusters { @Override public Map getSessionAttributes(String name) { Cluster cluster = findCluster(name); - return cluster == null ? Collections.emptyMap() : cluster.getSessionAttributes(); + return cluster == null ? Collections.emptyMap() : cluster.getSessionAttributes(); } /** http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java index 73267b6..d1fbf1d 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java @@ -124,10 +124,10 @@ public class ConfigGroupImpl implements ConfigGroup { configGroupEntity.setDescription(description); configGroupEntity.setServiceName(serviceName); - m_hosts = hosts == null ? new ConcurrentHashMap() + m_hosts = hosts == null ? new ConcurrentHashMap<>() : new ConcurrentHashMap<>(hosts); - m_configurations = configurations == null ? new ConcurrentHashMap() + m_configurations = configurations == null ? new ConcurrentHashMap<>() : new ConcurrentHashMap<>(configurations); // save the entity and grab the ID @@ -364,8 +364,7 @@ public class ConfigGroupImpl implements ConfigGroup { // Delete existing mappings and create new ones configGroupHostMappingDAO.removeAllByGroup(configGroupEntity.getGroupId()); - configGroupEntity.setConfigGroupHostMappingEntities( - new HashSet()); + configGroupEntity.setConfigGroupHostMappingEntities(new HashSet<>()); if (hosts != null && !hosts.isEmpty()) { configGroupEntity = persistHostMapping(hosts.values(), configGroupEntity); @@ -408,8 +407,7 @@ public class ConfigGroupImpl implements ConfigGroup { void persistConfigMapping(ClusterEntity clusterEntity, ConfigGroupEntity configGroupEntity, Map configurations) throws AmbariException { configGroupConfigMappingDAO.removeAllByGroup(configGroupEntity.getGroupId()); - configGroupEntity.setConfigGroupConfigMappingEntities( - new HashSet()); + configGroupEntity.setConfigGroupConfigMappingEntities(new HashSet<>()); if (configurations != null && !configurations.isEmpty()) { for (Entry entry : configurations.entrySet()) { http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java index 3ceaa48..274a425 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java @@ -1049,7 +1049,7 @@ public class HostImpl implements Host { } } - Map configGroups = (cluster == null) ? new HashMap() : cluster.getConfigGroupsByHostname(getHostName()); + Map configGroups = (cluster == null) ? new HashMap<>() : cluster.getConfigGroupsByHostname(getHostName()); if (configGroups != null && !configGroups.isEmpty()) { for (ConfigGroup configGroup : configGroups.values()) { http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/AbstractKerberosDescriptor.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/AbstractKerberosDescriptor.java b/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/AbstractKerberosDescriptor.java index 38100ac..7f53daa 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/AbstractKerberosDescriptor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/AbstractKerberosDescriptor.java @@ -185,15 +185,15 @@ public abstract class AbstractKerberosDescriptor { } public static Collection nullToEmpty(Collection collection) { - return collection == null ? Collections.emptyList() : collection; + return collection == null ? Collections.emptyList() : collection; } public static List nullToEmpty(List list) { - return list == null ? Collections.emptyList() : list; + return list == null ? Collections.emptyList() : list; } public static Map nullToEmpty(Map collection) { - return collection == null ? Collections.emptyMap() : collection; + return collection == null ? Collections.emptyMap() : collection; } @Override http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosServiceDescriptor.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosServiceDescriptor.java b/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosServiceDescriptor.java index 0777327..771a23c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosServiceDescriptor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosServiceDescriptor.java @@ -275,7 +275,7 @@ public class KerberosServiceDescriptor extends AbstractKerberosDescriptorContain public List getComponentIdentities(String componentName) { return getComponent(componentName) != null ? nullToEmpty(getComponent(componentName).getIdentities()) - : Collections.emptyList(); + : Collections.emptyList(); } @Override http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/DefaultQuickLinkVisibilityController.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/DefaultQuickLinkVisibilityController.java b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/DefaultQuickLinkVisibilityController.java index 730f01b..d0b0442 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/DefaultQuickLinkVisibilityController.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/DefaultQuickLinkVisibilityController.java @@ -91,17 +91,17 @@ public class DefaultQuickLinkVisibilityController implements QuickLinkVisibility } else { FilterEvaluator componentEvaluator = componentRules.get(ServiceComponent.of(service, quickLink.getComponentName())); - return componentEvaluator != null ? componentEvaluator.isVisible(quickLink) : Optional.absent(); + return componentEvaluator != null ? componentEvaluator.isVisible(quickLink) : Optional.absent(); } } private Optional evaluateServiceRules(@Nonnull String service, @Nonnull Link quickLink) { return serviceRules.containsKey(service) ? - serviceRules.get(service).isVisible(quickLink) : Optional.absent(); + serviceRules.get(service).isVisible(quickLink) : Optional.absent(); } static List nullToEmptyList(@Nullable List items) { - return items != null ? items : Collections.emptyList(); + return items != null ? items : Collections.emptyList(); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java index 45d8e8e..3ef3991 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java @@ -132,7 +132,7 @@ public class VersionDefinitionXml { if (availableServices.isEmpty()) { // !!! populate available services from the manifest for (ManifestService ms : manifests.values()) { - addToAvailable(ms, stack, Collections.emptySet()); + addToAvailable(ms, stack, Collections.emptySet()); } } else { for (AvailableServiceReference ref : availableServices) { @@ -193,7 +193,7 @@ public class VersionDefinitionXml { String name = manifest.serviceName; if (!manifestVersions.containsKey(name)) { - manifestVersions.put(manifest.serviceName, new TreeSet()); + manifestVersions.put(manifest.serviceName, new TreeSet<>()); } manifestVersions.get(manifest.serviceName).add(manifest.version); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java b/ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java index 73a661d..c7de5d0 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java @@ -197,7 +197,7 @@ public class AlertNoticeDispatchService extends AbstractScheduledService { */ public AlertNoticeDispatchService() { m_executor = new ThreadPoolExecutor(0, 2, 5L, TimeUnit.MINUTES, - new LinkedBlockingQueue(), new AlertDispatchThreadFactory(), + new LinkedBlockingQueue<>(), new AlertDispatchThreadFactory(), new ThreadPoolExecutor.CallerRunsPolicy()); GsonBuilder gsonBuilder = new GsonBuilder(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/stack/ConfigUpgradePack.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/ConfigUpgradePack.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/ConfigUpgradePack.java index db02e95..1320a43 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/ConfigUpgradePack.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/ConfigUpgradePack.java @@ -122,7 +122,7 @@ public class ConfigUpgradePack { for (ConfigUpgradePack configUpgradePack : cups) { for (AffectedService service : configUpgradePack.services) { if (! mergedServiceMap.containsKey(service.name)) { - mergedServiceMap.put(service.name, new HashMap()); + mergedServiceMap.put(service.name, new HashMap<>()); } Map mergedComponentMap = mergedServiceMap.get(service.name); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java index b0d961c..c0483e8 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java @@ -229,6 +229,6 @@ public class OsFamily { */ public Map getAliases() { return (null == jsonOsFamily || null == jsonOsFamily.getAliases()) ? - Collections.emptyMap() : jsonOsFamily.getAliases(); + Collections.emptyMap() : jsonOsFamily.getAliases(); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java index 7ad0257..65038e2 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java @@ -244,7 +244,7 @@ public class ClusterGrouping extends Grouping { return new StageWrapper( StageWrapper.Type.SERVER_SIDE_ACTION, execution.title, - new TaskWrapper(null, null, Collections.emptySet(), task)); + new TaskWrapper(null, null, Collections.emptySet(), task)); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java index 18f8cce..f8daf82 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ColocatedGrouping.java @@ -208,7 +208,7 @@ public class ColocatedGrouping extends Grouping { StageWrapper wrapper = new StageWrapper( StageWrapper.Type.SERVER_SIDE_ACTION, "Validate Partial " + upgradeContext.getDirection().getText(true), - new TaskWrapper(null, null, Collections.emptySet(), task)); + new TaskWrapper(null, null, Collections.emptySet(), task)); results.add(wrapper); } @@ -277,7 +277,7 @@ public class ColocatedGrouping extends Grouping { List tasks = new ArrayList<>(); Set displays = new HashSet<>(); for (String service : serviceChecks) { - tasks.add(new TaskWrapper(service, "", Collections.emptySet(), new ServiceCheckTask())); + tasks.add(new TaskWrapper(service, "", Collections.emptySet(), new ServiceCheckTask())); displays.add(service); } @@ -309,7 +309,7 @@ public class ColocatedGrouping extends Grouping { for (String host : tw.getHosts()) { if (!compLocations.containsKey(host)) { - compLocations.put(host, new HashSet()); + compLocations.put(host, new HashSet<>()); } compLocations.get(host).add(tw.getComponent()); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Grouping.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Grouping.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Grouping.java index bfa0b5b..a2257d9 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Grouping.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Grouping.java @@ -266,7 +266,7 @@ public class Grouping { List displays = new ArrayList<>(); for (String service : m_servicesToCheck) { tasks.add(new TaskWrapper( - service, "", Collections.emptySet(), new ServiceCheckTask())); + service, "", Collections.emptySet(), new ServiceCheckTask())); displays.add(upgradeContext.getServiceDisplay(service)); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java index dd2dd02..acf0639 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java @@ -280,7 +280,7 @@ public class HostOrderGrouping extends Grouping { } StageWrapper manualWrapper = new StageWrapper(StageWrapper.Type.SERVER_SIDE_ACTION, "Manual Confirmation", - new TaskWrapper(null, null, Collections.emptySet(), mt)); + new TaskWrapper(null, null, Collections.emptySet(), mt)); wrappers.add(manualWrapper); @@ -319,7 +319,7 @@ public class HostOrderGrouping extends Grouping { StageWrapper wrapper = new StageWrapper(StageWrapper.Type.SERVICE_CHECK, String.format("Service Check %s", upgradeContext.getServiceDisplay(serviceName)), - new TaskWrapper(serviceName, "", Collections.emptySet(), new ServiceCheckTask())); + new TaskWrapper(serviceName, "", Collections.emptySet(), new ServiceCheckTask())); wrappers.add(wrapper); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelper.java index bf47af0..60ad446 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelper.java @@ -268,7 +268,7 @@ public class RepositoryVersionHelper { } List packagesForService = amc.getPackagesForServiceHost(info, - new HashMap(), osFamily); + new HashMap<>(), osFamily); List blacklistedPackagePrefixes = configuration.get().getRollingUpgradeSkipPackagesPrefixes(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServiceCheckGrouping.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServiceCheckGrouping.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServiceCheckGrouping.java index 44c8ae1..9c47e5d 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServiceCheckGrouping.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServiceCheckGrouping.java @@ -279,7 +279,7 @@ public class ServiceCheckGrouping extends Grouping { ServiceCheckStageWrapper(String service, String serviceDisplay, boolean priority) { super(StageWrapper.Type.SERVICE_CHECK, String.format("Service Check %s", serviceDisplay), - new TaskWrapper(service, "", Collections.emptySet(), new ServiceCheckTask())); + new TaskWrapper(service, "", Collections.emptySet(), new ServiceCheckTask())); this.service = service; this.priority = priority; http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/StageWrapper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/StageWrapper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/StageWrapper.java index 70589ec..79147aa 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/StageWrapper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/StageWrapper.java @@ -78,7 +78,7 @@ public class StageWrapper { public StageWrapper(Type type, String text, Map params, List tasks) { this.type = type; this.text = text; - this.params = (params == null ? Collections.emptyMap() : params); + this.params = (params == null ? Collections.emptyMap() : params); this.tasks = tasks; } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/StageWrapperBuilder.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/StageWrapperBuilder.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/StageWrapperBuilder.java index 7fd8938..94e51d1 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/StageWrapperBuilder.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/StageWrapperBuilder.java @@ -154,7 +154,7 @@ public abstract class StageWrapperBuilder { skippedFailedCheck.messages.add(AUTO_SKIPPED_MESSAGE); TaskWrapper skippedFailedTaskWrapper = new TaskWrapper(null, null, - Collections. emptySet(), skippedFailedCheck); + Collections.emptySet(), skippedFailedCheck); StageWrapper skippedFailedStageWrapper = new StageWrapper( StageWrapper.Type.SERVER_SIDE_ACTION, "Verifying Skipped Failures", http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskWrapper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskWrapper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskWrapper.java index 8a87ff1..56047d7 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskWrapper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/TaskWrapper.java @@ -75,7 +75,7 @@ public class TaskWrapper { component = c; this.hosts = hosts; - this.params = (params == null) ? new HashMap() : params; + this.params = (params == null) ? new HashMap<>() : params; this.tasks = tasks; // !!! FIXME there should only be one task http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java index 7fcc778..8c83ed6 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java @@ -622,7 +622,7 @@ public class BlueprintImpl implements Blueprint { * @return set of repositories * */ private void processRepoSettings(){ - repoSettings = new ArrayList(); + repoSettings = new ArrayList<>(); if (setting != null){ Set> settingValue = setting.getSettingValue(Setting.SETTING_NAME_REPOSITORY_SETTINGS); for (Map setting : settingValue) { http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java index 28752c4..7bd377f 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java @@ -82,7 +82,7 @@ public class ClusterConfigurationRequest { this.stackAdvisorBlueprintProcessor = stackAdvisorBlueprintProcessor; removeOrphanConfigTypes(); if (setInitial) { - setConfigurationsOnCluster(clusterTopology, TopologyManager.INITIAL_CONFIG_TAG, Collections.emptySet()); + setConfigurationsOnCluster(clusterTopology, TopologyManager.INITIAL_CONFIG_TAG, Collections.emptySet()); } } @@ -240,7 +240,7 @@ public class ClusterConfigurationRequest { Collection components = blueprint.getComponents(service); serviceComponents.put(service, (components == null) - ? Collections.emptySet() + ? Collections.emptySet() : new HashSet<>(blueprint.getComponents(service))); } } @@ -304,7 +304,7 @@ public class ClusterConfigurationRequest { Configuration clusterConfiguration = clusterTopology.getConfiguration(); Map> existingConfigurations = clusterConfiguration.getFullProperties(); - existingConfigurations.put(CLUSTER_HOST_INFO, new HashMap()); + existingConfigurations.put(CLUSTER_HOST_INFO, new HashMap<>()); // apply Kerberos specific configurations Map> updatedConfigs = AmbariContext.getController().getKerberosHelper() http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java index 983e83e..28b62bc 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java @@ -123,7 +123,7 @@ public class Configuration { } Map> mergedProperties = parentConfiguration == null ? - new HashMap>() : + new HashMap<>() : new HashMap<>(parentConfiguration.getFullProperties(--depthLimit)); for (Map.Entry> entry : properties.entrySet()) { @@ -158,7 +158,7 @@ public class Configuration { */ public Map>> getFullAttributes() { Map>> mergedAttributeMap = parentConfiguration == null ? - new HashMap>>() : + new HashMap<>() : new HashMap<>(parentConfiguration.getFullAttributes()); for (Map.Entry>> typeEntry : attributes.entrySet()) { http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupImpl.java index c8a655a..9aeadd1 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupImpl.java @@ -206,7 +206,7 @@ public class HostGroupImpl implements HostGroup { public Collection getComponents(String service) { return componentsForService.containsKey(service) ? new HashSet<>(componentsForService.get(service)) : - Collections.emptySet(); + Collections.emptySet(); } /** http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java index 2c4e25e..7045912 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java @@ -191,7 +191,7 @@ public class HostRequest implements Comparable { InstallHostTask installTask = new InstallHostTask(topology, this, skipFailure); topologyTasks.add(installTask); - logicalTaskMap.put(installTask, new HashMap()); + logicalTaskMap.put(installTask, new HashMap<>()); boolean skipStartTaskCreate = topology.getProvisionAction().equals(INSTALL_ONLY); boolean skipInstallTaskCreate = topology.getProvisionAction().equals(START_ONLY); @@ -200,7 +200,7 @@ public class HostRequest implements Comparable { if (!skipStartTaskCreate) { startTask = new StartHostTask(topology, this, skipFailure); topologyTasks.add(startTask); - logicalTaskMap.put(startTask, new HashMap()); + logicalTaskMap.put(startTask, new HashMap<>()); } else { LOG.info("Skipping Start task creation since provision action = " + topology.getProvisionAction()); } @@ -256,14 +256,14 @@ public class HostRequest implements Comparable { topologyTasks.add(new RegisterWithConfigGroupTask(topology, this)); InstallHostTask installTask = new InstallHostTask(topology, this, skipFailure); topologyTasks.add(installTask); - logicalTaskMap.put(installTask, new HashMap()); + logicalTaskMap.put(installTask, new HashMap<>()); boolean skipStartTaskCreate = topology.getProvisionAction().equals(INSTALL_ONLY); if (!skipStartTaskCreate) { StartHostTask startTask = new StartHostTask(topology, this, skipFailure); topologyTasks.add(startTask); - logicalTaskMap.put(startTask, new HashMap()); + logicalTaskMap.put(startTask, new HashMap<>()); } AmbariContext ambariContext = topology.getAmbariContext(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java index 2f08115..b63bbad 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java @@ -506,7 +506,7 @@ public class LogicalRequest extends Request { String hostGroupName = hostGroupEntity.getName(); if ( !reservedHostNamesByHostGroups.containsKey(hostGroupName) ) - reservedHostNamesByHostGroups.put(hostGroupName, new HashSet()); + reservedHostNamesByHostGroups.put(hostGroupName, new HashSet<>()); for (TopologyHostInfoEntity hostInfoEntity: hostGroupEntity.getTopologyHostInfoEntities()) { if (StringUtils.isNotEmpty(hostInfoEntity.getFqdn())) { http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java index e64a16e..0273564 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java @@ -208,7 +208,7 @@ public class PersistedStateImpl implements PersistedState { clusterTopology.setProvisionAction(entity.getProvisionAction()); } topologyRequests.put(replayedRequest.getClusterId(), clusterTopology); - allRequests.put(clusterTopology, new ArrayList()); + allRequests.put(clusterTopology, new ArrayList<>()); } catch (InvalidTopologyException e) { throw new RuntimeException("Failed to construct cluster topology while replaying request: " + e, e); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java index 02c53cb..5b58e1d 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java @@ -391,8 +391,8 @@ public class TopologyManager { properties.put(CredentialResourceProvider.CREDENTIAL_KEY_PROPERTY_ID, credential.getKey()); properties.put(CredentialResourceProvider.CREDENTIAL_TYPE_PROPERTY_ID, credential.getType().name()); - org.apache.ambari.server.controller.spi.Request request = new RequestImpl(Collections.emptySet(), - Collections.singleton(properties), Collections.emptyMap(), null); + org.apache.ambari.server.controller.spi.Request request = new RequestImpl(Collections.emptySet(), + Collections.singleton(properties), Collections.emptyMap(), null); try { RequestStatus status = provider.createResources(request); @@ -443,7 +443,7 @@ public class TopologyManager { requestInfoProps.put(org.apache.ambari.server.controller.spi.Request.REQUEST_INFO_BODY_PROPERTY, "{\"" + ArtifactResourceProvider.ARTIFACT_DATA_PROPERTY + "\": " + descriptor + "}"); - org.apache.ambari.server.controller.spi.Request request = new RequestImpl(Collections.emptySet(), + org.apache.ambari.server.controller.spi.Request request = new RequestImpl(Collections.emptySet(), Collections.singleton(properties), requestInfoProps, null); try { @@ -745,7 +745,7 @@ public class TopologyManager { public Collection getTasks(long requestId) { ensureInitialized(); LogicalRequest request = allRequests.get(requestId); - return request == null ? Collections.emptyList() : request.getCommands(); + return request == null ? Collections.emptyList() : request.getCommands(); } public Collection getTasks(Collection requestIds) { @@ -761,7 +761,7 @@ public class TopologyManager { public Map getStageSummaries(Long requestId) { ensureInitialized(); LogicalRequest request = allRequests.get(requestId); - return request == null ? Collections.emptyMap() : + return request == null ? Collections.emptyMap() : request.getStageSummaries(); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidator.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidator.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidator.java index 4315bf2..4022fcb 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidator.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidator.java @@ -179,7 +179,7 @@ public class RequiredConfigPropertiesValidator implements TopologyValidator { } if (!missing.containsKey(hostGroup)) { - missing.put(hostGroup, new TreeSet()); + missing.put(hostGroup, new TreeSet<>()); } missing.get(hostGroup).addAll(values); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java index 1d277a7..1f10d7e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java @@ -397,17 +397,17 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog { // Do nothing } else if (upgradeBehavior.isDelete()) { if (!toRemoveProperties.containsKey(configType)) { - toRemoveProperties.put(configType, new HashSet()); + toRemoveProperties.put(configType, new HashSet<>()); } toRemoveProperties.get(configType).add(property.getName()); } else if (upgradeBehavior.isUpdate()) { if (!toUpdateProperties.containsKey(configType)) { - toUpdateProperties.put(configType, new HashSet()); + toUpdateProperties.put(configType, new HashSet<>()); } toUpdateProperties.get(configType).add(property.getName()); } else if (upgradeBehavior.isAdd()) { if (!toAddProperties.containsKey(configType)) { - toAddProperties.put(configType, new HashSet()); + toAddProperties.put(configType, new HashSet<>()); } toAddProperties.get(configType).add(property.getName()); } @@ -426,7 +426,7 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog { for (Entry> toRemove : toRemoveProperties.entrySet()) { String newPropertyKey = toRemove.getKey(); - updateConfigurationPropertiesWithValuesFromXml(newPropertyKey, Collections.emptySet(), toRemove.getValue(), false, true); + updateConfigurationPropertiesWithValuesFromXml(newPropertyKey, Collections.emptySet(), toRemove.getValue(), false, true); } } } @@ -626,7 +626,7 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog { protected void removeConfigurationPropertiesFromCluster(Cluster cluster, String configType, Set removePropertiesList) throws AmbariException { - updateConfigurationPropertiesForCluster(cluster, configType, new HashMap(), removePropertiesList, false, true); + updateConfigurationPropertiesForCluster(cluster, configType, new HashMap<>(), removePropertiesList, false, true); } /** http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java index 9409f70..b6287e6 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java @@ -271,7 +271,7 @@ public class StageUtils { } public static Map getCommandParamsStage(ActionExecutionContext actionExecContext, String requestContext) throws AmbariException { - Map commandParams = actionExecContext.getParameters() != null ? actionExecContext.getParameters() : new TreeMap(); + Map commandParams = actionExecContext.getParameters() != null ? actionExecContext.getParameters() : new TreeMap<>(); if (StringUtils.isNotEmpty(requestContext) && requestContext.toLowerCase().contains("rolling-restart")) { commandParams.put("rolling_restart", "true"); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java index f6a8789..da4e469 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java @@ -339,7 +339,7 @@ public class ViewContextImpl implements ViewContext, ViewController { @Override public Collection getViewDefinitions() { - return Collections.unmodifiableCollection(viewRegistry.getDefinitions()); + return Collections.unmodifiableCollection(viewRegistry.getDefinitions()); } @Override @@ -348,7 +348,7 @@ public class ViewContextImpl implements ViewContext, ViewController { for (ViewEntity viewEntity : viewRegistry.getDefinitions()) { instanceDefinitions.addAll(viewRegistry.getInstanceDefinitions(viewEntity)); } - return Collections.unmodifiableCollection(instanceDefinitions); + return Collections.unmodifiableCollection(instanceDefinitions); } @Override http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDataMigrationContextImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDataMigrationContextImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDataMigrationContextImpl.java index a13b01e..f3ba720 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDataMigrationContextImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDataMigrationContextImpl.java @@ -294,7 +294,7 @@ public class ViewDataMigrationContextImpl implements ViewDataMigrationContext { for (ViewInstanceDataEntity entity : instanceDefinition.getData()) { if (!instanceDataByUser.containsKey(entity.getUser())) { - instanceDataByUser.put(entity.getUser(), new HashMap()); + instanceDataByUser.put(entity.getUser(), new HashMap<>()); } instanceDataByUser.get(entity.getUser()).put(entity.getName(), entity.getValue()); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java index 349b647..4b3b8fe 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java @@ -324,13 +324,13 @@ public class ViewURLStreamProvider implements org.apache.ambari.view.URLStreamPr String[] hostAndPort = hostPortStr.trim().split(":"); if (hostAndPort.length == 1) { if (!allowed.containsKey(hostAndPort[0])) { - allowed.put(hostAndPort[0], new HashSet()); + allowed.put(hostAndPort[0], new HashSet<>()); } allowed.get(hostAndPort[0]).add("*"); LOG.debug("Allow proxy to host {} and all ports.", hostAndPort[0]); } else { if (!allowed.containsKey(hostAndPort[0])) { - allowed.put(hostAndPort[0], new HashSet()); + allowed.put(hostAndPort[0], new HashSet<>()); } allowed.get(hostAndPort[0]).add(hostAndPort[1]); LOG.debug("Allow proxy to host {} and port {}", hostAndPort[0], hostAndPort[1]); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/InstanceConfig.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/InstanceConfig.java b/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/InstanceConfig.java index b61ea4e..40f33e3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/InstanceConfig.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/InstanceConfig.java @@ -136,7 +136,7 @@ public class InstanceConfig { * @return the instance properties */ public List getProperties() { - return properties == null ? Collections.emptyList() : properties; + return properties == null ? Collections.emptyList() : properties; } } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/PersistenceConfig.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/PersistenceConfig.java b/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/PersistenceConfig.java index c4b32a4..7af1100 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/PersistenceConfig.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/PersistenceConfig.java @@ -41,6 +41,6 @@ public class PersistenceConfig { * @return the entity configurations */ public List getEntities() { - return entities == null ? Collections.emptyList() : entities; + return entities == null ? Collections.emptyList() : entities; } } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ResourceConfig.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ResourceConfig.java b/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ResourceConfig.java index 4457491..6e9bb26 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ResourceConfig.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ResourceConfig.java @@ -128,7 +128,7 @@ public class ResourceConfig { * @return the sub-resource names */ public List getSubResourceNames() { - return subResourceNames == null ? Collections.emptyList() : subResourceNames; + return subResourceNames == null ? Collections.emptyList() : subResourceNames; } /** http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ViewConfig.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ViewConfig.java b/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ViewConfig.java index 9fa0c80..91ee03d 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ViewConfig.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ViewConfig.java @@ -409,7 +409,7 @@ public class ViewConfig { * @return the list of parameters */ public List getParameters() { - return parameters == null ? Collections.emptyList() : parameters; + return parameters == null ? Collections.emptyList() : parameters; } /** @@ -418,7 +418,7 @@ public class ViewConfig { * @return return the list of resources */ public List getResources() { - return resources == null ? Collections.emptyList() : resources; + return resources == null ? Collections.emptyList() : resources; } /** @@ -436,7 +436,7 @@ public class ViewConfig { * @return the list of view instances */ public List getInstances() { - return instances == null ? Collections.emptyList() : instances; + return instances == null ? Collections.emptyList() : instances; } /** @@ -454,7 +454,7 @@ public class ViewConfig { * @return the list of custom permissions */ public List getPermissions() { - return permissions == null ? Collections.emptyList() : permissions; + return permissions == null ? Collections.emptyList() : permissions; } /** http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/main/java/org/apache/ambari/server/view/events/EventImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/events/EventImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/view/events/EventImpl.java index 4c52d6b..05bdd16 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/view/events/EventImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/view/events/EventImpl.java @@ -80,7 +80,7 @@ public class EventImpl implements Event { this.id = id; this.viewSubject = viewSubject; this.viewInstanceSubject = viewInstanceSubject; - this.properties = properties == null ? Collections.emptyMap() : + this.properties = properties == null ? Collections.emptyMap() : Collections.unmodifiableMap(properties); }