Buggy code:
@ Component public class EC2Engine extends ManagerBase { protected static final Logger logger = Logger . getLogger ( EC2Engine . class ) ; String managementServer = null ; String cloudAPIPort = null ; @ Inject OfferingDao ofDao ; @ Inject CloudStackAccountDao accDao ; private CloudStackApi _eng = null ; private CloudStackAccount currentAccount = null ; public EC2Engine ( ) throws IOException { } @ Override public boolean configure ( String name , Map < String , Object > params ) throws ConfigurationException { } private void loadConfigValues ( ) throws IOException { } private CloudStackApi getApi ( ) { } public boolean validateAccount ( String accessKey , String secretKey ) throws EC2ServiceException { } public EC2SecurityGroup createSecurityGroup ( String groupName , String groupDesc ) { } public boolean deleteSecurityGroup ( String groupName ) { } public EC2DescribeSecurityGroupsResponse describeSecurityGroups ( EC2DescribeSecurityGroups request ) { } public boolean revokeSecurityGroup ( EC2AuthorizeRevokeSecurityGroup request ) { try { String [ ] groupSet = new String [ 1 ] ; groupSet [ 0 ] = request . getName ( ) ; String ruleId = null ; EC2IpPermission [ ] items = request . getIpPermissionSet ( ) ; <START_BUG> EC2DescribeSecurityGroupsResponse response = listSecurityGroups ( groupSet , null ) ; <END_BUG> EC2SecurityGroup [ ] groups = response . getGroupSet ( ) ; if ( ( groups . length ) == 0 ) { throw new Exception ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>security<seq2seq4repair_space>group<seq2seq4repair_space>name" ) ; } for ( EC2SecurityGroup group : groups ) { EC2IpPermission [ ] perms = group . getIpPermissionSet ( ) ; for ( EC2IpPermission perm : perms ) { ruleId = doesRuleMatch ( items [ 0 ] , perm ) ; if ( ruleId != null ) break ; } } if ( null == ruleId ) throw new Exception ( "Specified<seq2seq4repair_space>Ip<seq2seq4repair_space>permission<seq2seq4repair_space>is<seq2seq4repair_space>invalid" ) ; CloudStackInfoResponse resp = getApi ( ) . revokeSecurityGroupIngress ( ruleId ) ; if ( resp != null ) { return resp . getSuccess ( ) ; } } catch ( Exception e ) { EC2Engine . logger . error ( ( ( "EC2<seq2seq4repair_space>revokeSecurityGroupIngress" + "<seq2seq4repair_space>-<seq2seq4repair_space>" ) + ( e . getMessage ( ) ) ) ) ; handleException ( e ) ; } return false ; } public boolean authorizeSecurityGroup ( EC2AuthorizeRevokeSecurityGroup request ) { } private String doesRuleMatch ( EC2IpPermission permLeft , EC2IpPermission permRight ) { } public EC2DescribeSnapshotsResponse describeSnapshots ( EC2DescribeSnapshots request ) { } public EC2Snapshot createSnapshot ( String volumeId ) { } public boolean deleteSnapshot ( String snapshotId ) { } public boolean modifyImageAttribute ( EC2ModifyImageAttribute request ) { } public EC2ImageAttributes describeImageAttribute ( EC2DescribeImageAttribute request ) { } public EC2PasswordData getPasswordData ( String instanceId ) { } public EC2DescribeKeyPairsResponse describeKeyPairs ( EC2DescribeKeyPairs request ) { } public boolean deleteKeyPair ( EC2DeleteKeyPair request ) { } public EC2SSHKeyPair createKeyPair ( EC2CreateKeyPair request ) { } public EC2SSHKeyPair importKeyPair ( EC2ImportKeyPair request ) { } public EC2DescribeAddressesResponse describeAddresses ( EC2DescribeAddresses request ) { } public boolean releaseAddress ( EC2ReleaseAddress request ) { } public boolean associateAddress ( EC2AssociateAddress request ) { } public boolean disassociateAddress ( EC2DisassociateAddress request ) { } public EC2Address allocateAddress ( ) { } public EC2DescribeImagesResponse describeImages ( EC2DescribeImages request ) { } public EC2CreateImageResponse createImage ( EC2CreateImage request ) { } public EC2CreateImageResponse registerImage ( EC2RegisterImage request ) { } public boolean deregisterImage ( EC2Image image ) { } public EC2DescribeInstancesResponse describeInstances ( EC2DescribeInstances request ) { } public EC2DescribeAvailabilityZonesResponse describeAvailabilityZones ( EC2DescribeAvailabilityZones request ) { } public EC2DescribeVolumesResponse describeVolumes ( EC2DescribeVolumes request ) { } public EC2Volume attachVolume ( EC2Volume request ) { } public EC2Volume detachVolume ( EC2Volume request ) { } public EC2Volume createVolume ( EC2CreateVolume request ) { } public EC2Volume deleteVolume ( EC2Volume request ) { } public boolean modifyTags ( EC2Tags request , String operation ) { } public EC2DescribeTagsResponse describeTags ( EC2DescribeTags request ) { } public boolean rebootInstances ( EC2RebootInstances request ) { } public EC2RunInstancesResponse runInstances ( EC2RunInstances request ) { } public EC2StartInstancesResponse startInstances ( EC2StartInstances request ) { } public EC2StopInstancesResponse stopInstances ( EC2StopInstances request ) { } public boolean modifyInstanceAttribute ( EC2ModifyInstanceAttribute request ) { } private int calculateAllowedInstances ( ) throws Exception { } private EC2DescribeInstancesResponse listVirtualMachines ( String [ ] virtualMachineIds , EC2InstanceFilterSet ifs , List < CloudStackKeyValue > resourceTags ) throws Exception { } private EC2DescribeVolumesResponse listVolumes ( String volumeId , String instanceId , EC2DescribeVolumesResponse volumes , List < CloudStackKeyValue > resourceTagSet ) throws Exception { } private String toZoneId ( String zoneName , String domainId ) throws Exception { } private CloudStackServiceOffering getCSServiceOfferingId ( String instanceType ) throws Exception { } private String serviceOfferingIdToInstanceType ( String serviceOfferingId ) throws Exception { } private String toOSTypeId ( String osTypeName ) throws Exception { } private EC2DescribeAvailabilityZonesResponse listZones ( String [ ] interestedZones , String domainId ) throws Exception { } private EC2DescribeInstancesResponse lookupInstances ( String instanceId , EC2DescribeInstancesResponse instances , List < CloudStackKeyValue > resourceTagSet ) throws Exception { } private EC2DescribeImagesResponse listTemplates ( String templateId , EC2DescribeImagesResponse images ) throws Exception { } private EC2DescribeSecurityGroupsResponse listSecurityGroups ( String [ ] interestedGroups , String [ ] interestedIDs ) throws Exception { } private EC2DescribeKeyPairsResponse listKeyPairs ( String [ ] keyNames ) throws Exception { } private EC2DescribeAddressesResponse listAddresses ( String [ ] addressNames ) throws Exception { } private EC2DescribeSnapshotsResponse listSnapshots ( String [ ] snapshotIds , List < CloudStackKeyValue > resourceTagSet ) throws Exception { } private boolean toPermission ( EC2SecurityGroup response , CloudStackSecurityGroup group ) { } public CloudStackAccount getCurrentAccount ( ) throws Exception { } private CloudStackNetwork getNetworksWithSecurityGroupEnabled ( String zoneId ) throws Exception { } private CloudStackNetwork createDefaultGuestNetwork ( String zoneId , CloudStackNetworkOffering offering , CloudStackAccount owner ) throws Exception { } private CloudStackNetwork getNetworksWithoutSecurityGroupEnabled ( String zoneId ) throws Exception { } private CloudStackNetwork findNetwork ( CloudStackZone zone ) throws Exception { } private CloudStackZone findZone ( ) throws Exception { } private String getDefaultZoneId ( String accountId ) throws Exception { } public String cloudDeviceIdToDevicePath ( String hypervisor , String deviceId ) { }

Fix:
EC2DescribeSecurityGroupsResponse response = listSecurityGroups ( groupSet , new String [ 0 ] ) ;