ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ritesh Jaltare" <rjalt...@pivotal.io>
Subject Re: Review Request 27050: Rest API Null Pointer Exception for non-existent host in HostRoles/host_name filter for host_components.
Date Fri, 24 Oct 2014 23:15:35 GMT


> On Oct. 23, 2014, 2:30 a.m., Alejandro Fernandez wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java,
line 290
> > <https://reviews.apache.org/r/27050/diff/1/?file=728843#file728843line290>
> >
> >     What are the implications of this?
> >     This function is called in several places, HeartBeartHandler, HeartbeatMonitor,
ConfigHelper,  etc.
> >     
> >     What led to the non-existent host being called in getHostComponents?

if we access the hostcomponent api with a non-existent host for example
http://localhost:8080/api/v1/clusters/test/hosts/c6402.ambari.apache./host_components

Here "c6402.ambari.apache." is non-existent. We get the null pointer exception in the logs
and api returns the 500 server error status.


- Ritesh


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/27050/#review57961
-----------------------------------------------------------


On Oct. 22, 2014, 8:23 p.m., Ritesh Jaltare wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/27050/
> -----------------------------------------------------------
> 
> (Updated Oct. 22, 2014, 8:23 p.m.)
> 
> 
> 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
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message