Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-1088

azurecompute: NPE in DeploymentToNodeMetadata.apply

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.9.2
    • 2.0.0
    • jclouds-labs

    Description

      I'm using the Azure provider azurecompute from JClouds Labs master and I encountered a situation in which DeploymentToNodeMetadata.apply throws a NPE. This is because there's a code like this:

      final CloudService cloudService = api.getCloudServiceApi().get(from.name());
      if (cloudService != null) {
         builder.location(FluentIterable.from(locations.get()).
                 firstMatch(LocationPredicates.idEquals(cloudService.location())).
                 orNull());
      }
      

      LocationPredicates.idEquals throws a NPE if its argument is null, and CloudService.location() is @Nullable. The location can easily be null if the cloud service is instead associated with an affinity group.

      Therefore, DeploymentToNodeMetadata.apply should check if cloudService.location() is null and if it is, the location should be obtained from the affinity group.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ladicek Ladislav Thon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: