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

Ladislav Thon commented on JCLOUDS-1088:
----------------------------------------

https://github.com/jclouds/jclouds-labs/pull/243

> azurecompute: NPE in DeploymentToNodeMetadata.apply
> ---------------------------------------------------
>
>                 Key: JCLOUDS-1088
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1088
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-labs
>    Affects Versions: 1.9.2
>            Reporter: Ladislav Thon
>              Labels: azurecompute
>
> 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:
> {code:java}
> final CloudService cloudService = api.getCloudServiceApi().get(from.name());
> if (cloudService != null) {
>    builder.location(FluentIterable.from(locations.get()).
>            firstMatch(LocationPredicates.idEquals(cloudService.location())).
>            orNull());
> }
> {code}
> {{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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to