You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ambari.apache.org by "Jayush Luniya (JIRA)" <ji...@apache.org> on 2017/09/06 20:28:00 UTC

[jira] [Created] (AMBARI-21897) Fix NPE in InstallHostTask

Jayush Luniya created AMBARI-21897:
--------------------------------------

             Summary: 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: 3.0.0
            Reporter: Jayush Luniya
            Assignee: Jayush Luniya
            Priority: Blocker
             Fix For: 3.0.0


{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)