Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-23158

Fix NPE in Host Components query.

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      serviceComponentHostRequest may not get instantiated if HOST_COMPONENT_HOST_COMPONENT_ID_PROPERTY_ID is null.

      /ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
        private ServiceComponentHostRequest getRequest(Map<String, Object> properties) {
          ServiceComponentHostRequest serviceComponentHostRequest = null;
          if (properties.get(HOST_COMPONENT_HOST_COMPONENT_ID_PROPERTY_ID) != null) {
            Long hostComponentId = properties.get(HOST_COMPONENT_HOST_COMPONENT_ID_PROPERTY_ID) instanceof String ?
                    Long.parseLong((String) properties.get(HOST_COMPONENT_HOST_COMPONENT_ID_PROPERTY_ID)) :
                    (Long) properties.get(HOST_COMPONENT_HOST_COMPONENT_ID_PROPERTY_ID);
      
            serviceComponentHostRequest = new ServiceComponentHostRequest(
                    (String) properties.get(HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID),
                    (String) properties.get(HOST_COMPONENT_SERVICE_GROUP_NAME_PROPERTY_ID),
                    (String) properties.get(HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID),
                    hostComponentId,
                    (String) properties.get(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID),
                    (String) properties.get(HOST_COMPONENT_COMPONENT_TYPE_PROPERTY_ID),
                    (String) properties.get(HOST_COMPONENT_HOST_NAME_PROPERTY_ID),
                    (String) properties.get(HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID));
          }
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            swapanshridhar Swapan Shridhar
            swapanshridhar Swapan Shridhar

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h

                Slack

                  Issue deployment