[ 
https://issues.apache.org/jira/browse/AMBARI-21897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16156086#comment-16156086
 ] 

Jayush Luniya commented on AMBARI-21897:
----------------------------------------

Trunk
commit 98b00094c458c904b500919d4ab08190ff4c5155
Author: Jayush Luniya <jlun...@hortonworks.com>
Date:   Wed Sep 6 14:48:02 2017 -0700

    AMBARI-21897: Fix NPE in InstallHostTask (jluniya)

> Fix NPE in InstallHostTask
> --------------------------
>
>                 Key: AMBARI-21897
>                 URL: https://issues.apache.org/jira/browse/AMBARI-21897
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-server
>    Affects Versions: 2.6.0
>            Reporter: Jayush Luniya
>            Assignee: Jayush Luniya
>            Priority: Blocker
>             Fix For: 2.6.0
>
>         Attachments: AMBARI-21897.patch
>
>
> {code}
> Exception in thread "pool-4-thread-1" java.lang.NullPointerException
>         at 
> org.apache.ambari.server.topology.tasks.InstallHostTask.runTask(InstallHostTask.java:54)
>         at 
> org.apache.ambari.server.topology.tasks.TopologyHostTask.run(TopologyHostTask.java:51)
>         at 
> org.apache.ambari.server.topology.HostOfferResponse$1.run(HostOfferResponse.java:83)
>         at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>         at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>         at java.lang.Thread.run(Thread.java:745)
> {code}
> This seems to be because response can be null if stages is null and we don't 
> have a check for it. 
> {code}
>     RequestStatusResponse response = 
> clusterTopology.installHost(hostRequest.getHostName(), skipInstallTaskCreate, 
> skipFailure);
>       List<ShortTaskStatus> underlyingTasks = response.getTasks();
> {code}
> {code}
> /**
>  * Build a request status response.
>  *
>  * @return a {@link 
> org.apache.ambari.server.controller.RequestStatusResponse} for the request
>  */
> public RequestStatusResponse getRequestStatusResponse() {
>   RequestStatusResponse response = null;
>   if (! stages.isEmpty()) {
>     response = new RequestStatusResponse(id);
>     List<HostRoleCommand> hostRoleCommands =
>         actionManager.getRequestTasks(id);
>     response.setRequestContext(actionManager.getRequestContext(id));
>     List<ShortTaskStatus> tasks = new ArrayList<>();
>     for (HostRoleCommand hostRoleCommand : hostRoleCommands) {
>       tasks.add(new ShortTaskStatus(hostRoleCommand));
>     }
>     response.setTasks(tasks);
>   }
>   return response;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to