Matthew Champion created JCLOUDS-1112:
-----------------------------------------

             Summary: NPE thrown when lookuking up the ID of a AWS security 
group from the name
                 Key: JCLOUDS-1112
                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1112
             Project: jclouds
          Issue Type: Bug
    Affects Versions: 1.9.2, 2.0.0
            Reporter: Matthew Champion
            Priority: Minor


A NullPointerException is thrown if JClouds fails to lookup the security group 
ID from the name using the EC2SecurityGroupIdFromName function.

This function appears to be used in two classes 
AWSEC2CreateSecurityGroupIfNeeded and AWSEC2SecurityGroupExtension.

AWSEC2CreateSecurityGroupIfNeeded:
In 1.9.x after creating a security group JClouds attempts to lookup the ID from 
the name. In 2.0.0 it receives the ID as part of the response to the creation 
request but uses EC2SecurityGroupIdFromName a security group with the same name 
exists.

AWSEC2SecurityGroupExtension:
Same for 1.9.x and 2.0.0. A security group is created by the LoadingCacge 
groupCreator and then the ID is looked up by name

{noformat}
    at 
org.jclouds.ec2.compute.strategy.CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.getSecurityGroupsForTagAndOptions(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.java:183)
    at 
org.jclouds.ec2.compute.strategy.CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.addSecurityGroups(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.java:109)
    at 
org.jclouds.aws.ec2.compute.strategy.CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.addSecurityGroups(CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.java:185)
    at 
org.jclouds.ec2.compute.strategy.CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.execute(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.java:80)
    at 
org.jclouds.aws.ec2.compute.strategy.CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.execute(CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.java:79)
    at 
org.jclouds.aws.ec2.compute.strategy.CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.execute(CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.java:50)
    at 
org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet.createKeyPairAndSecurityGroupsAsNeededThenRunInstances(EC2CreateNodesInGroupThenAddToSet.java:213)
    at 
org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet.runInstancesAndWarnOnInvisible(EC2CreateNodesInGroupThenAddToSet.java:151)
    at 
org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet.execute(EC2CreateNodesInGroupThenAddToSet.java:132)
    at 
org.jclouds.compute.internal.BaseComputeService.createNodesInGroup(BaseComputeService.java:210)
    at 
org.jclouds.ec2.compute.EC2ComputeService.createNodesInGroup(EC2ComputeService.java:149)
    at 
org.apache.brooklyn.location.jclouds.JcloudsLocation.obtainOnce(JcloudsLocation.java:715)
    at 
org.apache.brooklyn.location.jclouds.JcloudsLocation.obtain(JcloudsLocation.java:610)
    at 
org.apache.brooklyn.entity.software.base.lifecycle.MachineLifecycleEffectorTasks$ObtainLocationTask.call(MachineLifecycleEffectorTasks.java:404)
    at 
org.apache.brooklyn.entity.software.base.lifecycle.MachineLifecycleEffectorTasks$ObtainLocationTask.call(MachineLifecycleEffectorTasks.java:394)
    at 
org.apache.brooklyn.util.core.task.Tasks.withBlockingDetails(Tasks.java:98)
    at 
org.apache.brooklyn.entity.software.base.lifecycle.MachineLifecycleEffectorTasks$ProvisionMachineTask.call(MachineLifecycleEffectorTasks.java:378)
    at 
org.apache.brooklyn.entity.software.base.lifecycle.MachineLifecycleEffectorTasks$ProvisionMachineTask.call(MachineLifecycleEffectorTasks.java:362)
    ... 6 more
Caused by: java.lang.NullPointerException
    at 
org.jclouds.ec2.compute.functions.EC2SecurityGroupIdFromName.apply(EC2SecurityGroupIdFromName.java:46)
    at 
org.jclouds.ec2.compute.functions.EC2SecurityGroupIdFromName.apply(EC2SecurityGroupIdFromName.java:30)
    at 
org.jclouds.aws.ec2.compute.loaders.AWSEC2CreateSecurityGroupIfNeeded.createSecurityGroupInRegion(AWSEC2CreateSecurityGroupIfNeeded.java:94)
    at 
org.jclouds.aws.ec2.compute.loaders.AWSEC2CreateSecurityGroupIfNeeded.load(AWSEC2CreateSecurityGroupIfNeeded.java:72)
    at 
org.jclouds.aws.ec2.compute.loaders.AWSEC2CreateSecurityGroupIfNeeded.load(AWSEC2CreateSecurityGroupIfNeeded.java:45)
    at 
com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
    at 
com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
    ... 28 more
{noformat}



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

Reply via email to