Program: 105995
Project: 105995
Buggy source:
@Override public SecurityGroupResponse createSecurityGroupResponseFromSecurityGroupRule(List<? extends SecurityRule> securityRules){
  SecurityGroupResponse response=new SecurityGroupResponse();
  Map<Long,Account> securiytGroupAccounts=new HashMap<Long,Account>();
  Map<Long,SecurityGroup> allowedSecurityGroups=new HashMap<Long,SecurityGroup>();
  Map<Long,Account> allowedSecuriytGroupAccounts=new HashMap<Long,Account>();
  if ((securityRules != null) && !securityRules.isEmpty()) {
    SecurityGroupJoinVO securityGroup=ApiDBUtils.findSecurityGroupViewById(securityRules.get(0).getSecurityGroupId()).get(0);
    response.setId(securityGroup.getUuid());
    response.setName(securityGroup.getName());
    response.setDescription(securityGroup.getDescription());
    Account account=securiytGroupAccounts.get(securityGroup.getAccountId());
    if (securityGroup.getAccountType() == Account.ACCOUNT_TYPE_PROJECT) {
      response.setProjectId(securityGroup.getProjectUuid());
      response.setProjectName(securityGroup.getProjectName());
    }
 else {
      response.setAccountName(securityGroup.getAccountName());
    }
    response.setDomainId(securityGroup.getDomainUuid());
    response.setDomainName(securityGroup.getDomainName());
    for (    SecurityRule securityRule : securityRules) {
      SecurityGroupRuleResponse securityGroupData=new SecurityGroupRuleResponse();
      securityGroupData.setRuleId(securityRule.getUuid());
      securityGroupData.setProtocol(securityRule.getProtocol());
      if ("String_Node_Str".equalsIgnoreCase(securityRule.getProtocol())) {
        securityGroupData.setIcmpType(securityRule.getStartPort());
        securityGroupData.setIcmpCode(securityRule.getEndPort());
      }
 else {
        securityGroupData.setStartPort(securityRule.getStartPort());
        securityGroupData.setEndPort(securityRule.getEndPort());
      }
      Long allowedSecurityGroupId=securityRule.getAllowedNetworkId();
      if (allowedSecurityGroupId != null) {
        List<SecurityGroupJoinVO> sgs=ApiDBUtils.findSecurityGroupViewById(allowedSecurityGroupId);
        if (sgs != null && sgs.size() > 0) {
          SecurityGroupJoinVO sg=sgs.get(0);
          securityGroupData.setSecurityGroupName(sg.getName());
          securityGroupData.setAccountName(sg.getAccountName());
        }
      }
 else {
        securityGroupData.setCidr(securityRule.getAllowedSourceIpCidr());
      }
      if (securityRule.getRuleType() == SecurityRuleType.IngressRule) {
        securityGroupData.setObjectName("String_Node_Str");
        response.addSecurityGroupIngressRule(securityGroupData);
      }
 else {
        securityGroupData.setObjectName("String_Node_Str");
        response.addSecurityGroupEgressRule(securityGroupData);
      }
    }
    response.setObjectName("String_Node_Str");
  }
  return response;
}

Fixed version (ground truth):
@Override public SecurityGroupResponse createSecurityGroupResponseFromSecurityGroupRule(List<? extends SecurityRule> securityRules){
  SecurityGroupResponse response=new SecurityGroupResponse();
  Map<Long,Account> securiytGroupAccounts=new HashMap<Long,Account>();
  if ((securityRules != null) && !securityRules.isEmpty()) {
    SecurityGroupJoinVO securityGroup=ApiDBUtils.findSecurityGroupViewById(securityRules.get(0).getSecurityGroupId()).get(0);
    response.setId(securityGroup.getUuid());
    response.setName(securityGroup.getName());
    response.setDescription(securityGroup.getDescription());
    Account account=securiytGroupAccounts.get(securityGroup.getAccountId());
    if (securityGroup.getAccountType() == Account.ACCOUNT_TYPE_PROJECT) {
      response.setProjectId(securityGroup.getProjectUuid());
      response.setProjectName(securityGroup.getProjectName());
    }
 else {
      response.setAccountName(securityGroup.getAccountName());
    }
    response.setDomainId(securityGroup.getDomainUuid());
    response.setDomainName(securityGroup.getDomainName());
    for (    SecurityRule securityRule : securityRules) {
      SecurityGroupRuleResponse securityGroupData=new SecurityGroupRuleResponse();
      securityGroupData.setRuleId(securityRule.getUuid());
      securityGroupData.setProtocol(securityRule.getProtocol());
      if ("String_Node_Str".equalsIgnoreCase(securityRule.getProtocol())) {
        securityGroupData.setIcmpType(securityRule.getStartPort());
        securityGroupData.setIcmpCode(securityRule.getEndPort());
      }
 else {
        securityGroupData.setStartPort(securityRule.getStartPort());
        securityGroupData.setEndPort(securityRule.getEndPort());
      }
      Long allowedSecurityGroupId=securityRule.getAllowedNetworkId();
      if (allowedSecurityGroupId != null) {
        List<SecurityGroupJoinVO> sgs=ApiDBUtils.findSecurityGroupViewById(allowedSecurityGroupId);
        if (sgs != null && sgs.size() > 0) {
          SecurityGroupJoinVO sg=sgs.get(0);
          securityGroupData.setSecurityGroupName(sg.getName());
          securityGroupData.setAccountName(sg.getAccountName());
        }
      }
 else {
        securityGroupData.setCidr(securityRule.getAllowedSourceIpCidr());
      }
      if (securityRule.getRuleType() == SecurityRuleType.IngressRule) {
        securityGroupData.setObjectName("String_Node_Str");
        response.addSecurityGroupIngressRule(securityGroupData);
      }
 else {
        securityGroupData.setObjectName("String_Node_Str");
        response.addSecurityGroupEgressRule(securityGroupData);
      }
    }
    response.setObjectName("String_Node_Str");
  }
  return response;
}