Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.9.2
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.