Repository: ambari Updated Branches: refs/heads/trunk df00fd6e4 -> 2c660d32e
AMBARI-15726. Removing unknown host from cluster throws NPE (ajit) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2c660d32 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2c660d32 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2c660d32 Branch: refs/heads/trunk Commit: 2c660d32ea1b499cb8ee7908d43fec25f011f96f Parents: df00fd6 Author: Ajit Kumar <[email protected]> Authored: Wed Apr 6 17:42:16 2016 -0700 Committer: Ajit Kumar <[email protected]> Committed: Wed Apr 6 17:42:51 2016 -0700 ---------------------------------------------------------------------- .../org/apache/ambari/server/state/cluster/ClustersImpl.java | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/2c660d32/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 bed5153..caab7df 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 @@ -840,6 +840,10 @@ public class ClustersImpl implements Clusters { // a copy of this to ensure that we can pass in the original set of // clusters that the host belonged to to the host removal event Set<Cluster> clusters = hostClusterMap.get(hostname); + if (clusters == null) { + throw new HostNotFoundException(hostname); + } + Set<Cluster> hostsClusters = new HashSet<>(clusters); deleteHostEntityRelationships(hostname);
