-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/27050/
-----------------------------------------------------------
Review request for Ambari.
Bugs: AMBARI-6700
https://issues.apache.org/jira/browse/AMBARI-6700
Repository: ambari
Description
-------
Supplying a non-existent host in the hostRole/host_name filter to the
host_components end point in the Ambari API results in a "500 Server Error" to
the client and a Null Pointer Exception in the logs.
FIX:
Modify ClustersImpl.getClustersForHost to throw a HostNotFoundException for a
non existent host.
LOG:
16:51:11,033 WARN [qtp2101150571-448] ServletHandler:514 -
/api/v1/clusters/PoC/host_components
java.lang.NullPointerException
at
java.util.Collections$UnmodifiableCollection.<init>(Collections.java:1051)
at java.util.Collections$UnmodifiableSet.<init>(Collections.java:1122)
at java.util.Collections.unmodifiableSet(Collections.java:1112)
at
org.apache.ambari.server.state.cluster.ClustersImpl.getClustersForHost(ClustersImpl.java:260)
at
org.apache.ambari.server.controller.AmbariManagementControllerImpl.getHostComponents(AmbariManagementControllerImpl.java:737)
at
org.apache.ambari.server.controller.AmbariManagementControllerImpl.getHostComponents(AmbariManagementControllerImpl.java:2364)
Diffs
-----
ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
a57e9c2
ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
2baa5c5
Diff: https://reviews.apache.org/r/27050/diff/
Testing
-------
Modified a test case testClusterHostMapping in ClustersTest.java which tests
the particular scenario for passing an invalid hostname to
ClustersImpl.getClustersForHost.
Thanks,
Ritesh Jaltare