Program: 14194
Project: 14194
Buggy source:
@Override public void create(int stepNum) throws Exception {
  ServiceConfiguration configuration=Topology.lookup(Compute.class);
switch (stepNum) {
case 0:
    CreateSecurityGroupType createSecurityGroupType=new CreateSecurityGroupType();
  if (properties.getGroupDescription() != null && !properties.getGroupDescription().isEmpty()) {
    createSecurityGroupType.setGroupDescription(properties.getGroupDescription());
  }
String groupName=getStackEntity().getStackName() + "String_Node_Str" + getResourceInfo().getLogicalResourceId()+ "String_Node_Str"+ Crypto.generateAlphanumericId(13,"String_Node_Str");
createSecurityGroupType.setGroupName(groupName);
createSecurityGroupType.setEffectiveUserId(getResourceInfo().getEffectiveUserId());
CreateSecurityGroupResponseType createSecurityGroupResponseType=AsyncRequests.<CreateSecurityGroupType,CreateSecurityGroupResponseType>sendSync(configuration,createSecurityGroupType);
String groupId=createSecurityGroupResponseType.getGroupId();
info.setGroupId(groupId);
info.setPhysicalResourceId(groupName);
info.setReferenceValueJson(JsonHelper.getStringFromJsonNode(new TextNode(info.getPhysicalResourceId())));
break;
case 1:
if (properties.getSecurityGroupIngress() != null) {
for (EC2SecurityGroupRule ec2SecurityGroupRule : properties.getSecurityGroupIngress()) {
AuthorizeSecurityGroupIngressType authorizeSecurityGroupIngressType=new AuthorizeSecurityGroupIngressType();
authorizeSecurityGroupIngressType.setEffectiveUserId(getResourceInfo().getEffectiveUserId());
if (info.getPhysicalResourceId() != null && !info.getPhysicalResourceId().isEmpty()) {
authorizeSecurityGroupIngressType.setGroupName(info.getPhysicalResourceId());
}
if (info.getGroupId() != null && !info.getGroupId().isEmpty()) {
authorizeSecurityGroupIngressType.setGroupId(info.getGroupId());
}
int fromPort=-1;
String ipProtocol=ec2SecurityGroupRule.getIpProtocol();
try {
fromPort=Integer.parseInt(ec2SecurityGroupRule.getFromPort());
}
 catch (Exception ignore) {
}
int toPort=-1;
try {
toPort=Integer.parseInt(ec2SecurityGroupRule.getToPort());
}
 catch (Exception ignore) {
}
String sourceSecurityGroupName=ec2SecurityGroupRule.getSourceSecurityGroupName();
String sourceSecurityGroupOwnerId=ec2SecurityGroupRule.getSourceSecurityGroupOwnerId();
if (sourceSecurityGroupOwnerId == null && sourceSecurityGroupName != null) {
sourceSecurityGroupOwnerId=stackEntity.getAccountId();
}
String cidrIp=ec2SecurityGroupRule.getCidrIp();
IpPermissionType ipPermissionType=new IpPermissionType(ipProtocol,fromPort,toPort);
if (sourceSecurityGroupName != null) {
ipPermissionType.setGroups(Lists.newArrayList(new UserIdGroupPairType(sourceSecurityGroupOwnerId,sourceSecurityGroupName,null)));
}
if (cidrIp != null) {
ipPermissionType.setCidrIpRanges(Lists.newArrayList(cidrIp));
}
authorizeSecurityGroupIngressType.setIpPermissions(Lists.newArrayList(ipPermissionType));
AuthorizeSecurityGroupIngressResponseType authorizeSecurityGroupIngressResponseType=AsyncRequests.<AuthorizeSecurityGroupIngressType,AuthorizeSecurityGroupIngressResponseType>sendSync(configuration,authorizeSecurityGroupIngressType);
}
}
break;
default :
throw new IllegalStateException("String_Node_Str" + stepNum);
}
}

Fixed version (ground truth):
@Override public void create(int stepNum) throws Exception {
  ServiceConfiguration configuration=Topology.lookup(Compute.class);
switch (stepNum) {
case 0:
    CreateSecurityGroupType createSecurityGroupType=new CreateSecurityGroupType();
  if (properties.getGroupDescription() != null && !properties.getGroupDescription().isEmpty()) {
    createSecurityGroupType.setGroupDescription(properties.getGroupDescription());
  }
String groupName=getDefaultPhysicalResourceId();
createSecurityGroupType.setGroupName(groupName);
createSecurityGroupType.setEffectiveUserId(getResourceInfo().getEffectiveUserId());
CreateSecurityGroupResponseType createSecurityGroupResponseType=AsyncRequests.<CreateSecurityGroupType,CreateSecurityGroupResponseType>sendSync(configuration,createSecurityGroupType);
String groupId=createSecurityGroupResponseType.getGroupId();
info.setGroupId(groupId);
info.setPhysicalResourceId(groupName);
info.setReferenceValueJson(JsonHelper.getStringFromJsonNode(new TextNode(info.getPhysicalResourceId())));
break;
case 1:
if (properties.getSecurityGroupIngress() != null) {
for (EC2SecurityGroupRule ec2SecurityGroupRule : properties.getSecurityGroupIngress()) {
AuthorizeSecurityGroupIngressType authorizeSecurityGroupIngressType=new AuthorizeSecurityGroupIngressType();
authorizeSecurityGroupIngressType.setEffectiveUserId(getResourceInfo().getEffectiveUserId());
if (info.getPhysicalResourceId() != null && !info.getPhysicalResourceId().isEmpty()) {
authorizeSecurityGroupIngressType.setGroupName(info.getPhysicalResourceId());
}
if (info.getGroupId() != null && !info.getGroupId().isEmpty()) {
authorizeSecurityGroupIngressType.setGroupId(info.getGroupId());
}
int fromPort=-1;
String ipProtocol=ec2SecurityGroupRule.getIpProtocol();
try {
fromPort=Integer.parseInt(ec2SecurityGroupRule.getFromPort());
}
 catch (Exception ignore) {
}
int toPort=-1;
try {
toPort=Integer.parseInt(ec2SecurityGroupRule.getToPort());
}
 catch (Exception ignore) {
}
String sourceSecurityGroupName=ec2SecurityGroupRule.getSourceSecurityGroupName();
String sourceSecurityGroupOwnerId=ec2SecurityGroupRule.getSourceSecurityGroupOwnerId();
if (sourceSecurityGroupOwnerId == null && sourceSecurityGroupName != null) {
sourceSecurityGroupOwnerId=stackEntity.getAccountId();
}
String cidrIp=ec2SecurityGroupRule.getCidrIp();
IpPermissionType ipPermissionType=new IpPermissionType(ipProtocol,fromPort,toPort);
if (sourceSecurityGroupName != null) {
ipPermissionType.setGroups(Lists.newArrayList(new UserIdGroupPairType(sourceSecurityGroupOwnerId,sourceSecurityGroupName,null)));
}
if (cidrIp != null) {
ipPermissionType.setCidrIpRanges(Lists.newArrayList(cidrIp));
}
authorizeSecurityGroupIngressType.setIpPermissions(Lists.newArrayList(ipPermissionType));
AuthorizeSecurityGroupIngressResponseType authorizeSecurityGroupIngressResponseType=AsyncRequests.<AuthorizeSecurityGroupIngressType,AuthorizeSecurityGroupIngressResponseType>sendSync(configuration,authorizeSecurityGroupIngressType);
}
}
break;
default :
throw new IllegalStateException("String_Node_Str" + stepNum);
}
}