Program: 105682
Project: 105682
Buggy source:
@Override public ApplicationLoadBalancerResponse createLoadBalancerContainerReponse(ApplicationLoadBalancerRule lb,Map<Ip,UserVm> lbInstances){
  ApplicationLoadBalancerResponse lbResponse=new ApplicationLoadBalancerResponse();
  lbResponse.setId(lb.getUuid());
  lbResponse.setName(lb.getName());
  lbResponse.setDescription(lb.getDescription());
  lbResponse.setAlgorithm(lb.getAlgorithm());
  lbResponse.setForDisplay(lb.isDisplay());
  Network nw=ApiDBUtils.findNetworkById(lb.getNetworkId());
  lbResponse.setNetworkId(nw.getUuid());
  populateOwner(lbResponse,lb);
  if (lb.getScheme() == Scheme.Internal) {
    lbResponse.setSourceIp(lb.getSourceIp().addr());
    Network network=ApiDBUtils.findNetworkById(lb.getNetworkId());
    lbResponse.setSourceIpNetworkId(network.getUuid());
  }
 else {
    IpAddress publicIp=ApiDBUtils.findIpAddressById(lb.getSourceIpAddressId());
    lbResponse.setSourceIp(publicIp.getAddress().addr());
    Network ntwk=ApiDBUtils.findNetworkById(publicIp.getNetworkId());
    lbResponse.setSourceIpNetworkId(ntwk.getUuid());
  }
  List<ApplicationLoadBalancerRuleResponse> ruleResponses=new ArrayList<ApplicationLoadBalancerRuleResponse>();
  ApplicationLoadBalancerRuleResponse ruleResponse=new ApplicationLoadBalancerRuleResponse();
  ruleResponse.setInstancePort(lb.getDefaultPortStart());
  ruleResponse.setSourcePort(lb.getSourcePortStart());
  FirewallRule.State stateToSet=lb.getState();
  if (stateToSet.equals(FirewallRule.State.Revoke)) {
    stateToSet=FirewallRule.State.Deleting;
  }
  ruleResponse.setState(stateToSet.toString());
  ruleResponse.setObjectName("String_Node_Str");
  ruleResponses.add(ruleResponse);
  lbResponse.setLbRules(ruleResponses);
  List<ApplicationLoadBalancerInstanceResponse> instanceResponses=new ArrayList<ApplicationLoadBalancerInstanceResponse>();
  for (  Map.Entry<Ip,UserVm> entry : lbInstances.entrySet()) {
    Ip ip=entry.getKey();
    UserVm vm=entry.getValue();
    ApplicationLoadBalancerInstanceResponse instanceResponse=new ApplicationLoadBalancerInstanceResponse();
    instanceResponse.setIpAddress(ip.addr());
    instanceResponse.setId(vm.getUuid());
    instanceResponse.setName(vm.getInstanceName());
    instanceResponse.setObjectName("String_Node_Str");
    instanceResponses.add(instanceResponse);
  }
  lbResponse.setLbInstances(instanceResponses);
  List<? extends ResourceTag> tags=ApiDBUtils.listByResourceTypeAndId(ResourceObjectType.LoadBalancer,lb.getId());
  List<ResourceTagResponse> tagResponses=new ArrayList<ResourceTagResponse>();
  for (  ResourceTag tag : tags) {
    ResourceTagResponse tagResponse=createResourceTagResponse(tag,true);
    tagResponses.add(tagResponse);
  }
  lbResponse.setTags(tagResponses);
  lbResponse.setObjectName("String_Node_Str");
  return lbResponse;
}

Fixed version (ground truth):
@Override public ApplicationLoadBalancerResponse createLoadBalancerContainerReponse(ApplicationLoadBalancerRule lb,Map<Ip,UserVm> lbInstances){
  ApplicationLoadBalancerResponse lbResponse=new ApplicationLoadBalancerResponse();
  lbResponse.setId(lb.getUuid());
  lbResponse.setName(lb.getName());
  lbResponse.setDescription(lb.getDescription());
  lbResponse.setAlgorithm(lb.getAlgorithm());
  lbResponse.setForDisplay(lb.isDisplay());
  Network nw=ApiDBUtils.findNetworkById(lb.getNetworkId());
  lbResponse.setNetworkId(nw.getUuid());
  populateOwner(lbResponse,lb);
  if (lb.getScheme() == Scheme.Internal) {
    lbResponse.setSourceIp(lb.getSourceIp().addr());
    Network network=ApiDBUtils.findNetworkById(lb.getNetworkId());
    lbResponse.setSourceIpNetworkId(network.getUuid());
  }
 else {
    IpAddress publicIp=ApiDBUtils.findIpAddressById(lb.getSourceIpAddressId());
    lbResponse.setSourceIp(publicIp.getAddress().addr());
    Network ntwk=ApiDBUtils.findNetworkById(publicIp.getNetworkId());
    lbResponse.setSourceIpNetworkId(ntwk.getUuid());
  }
  List<ApplicationLoadBalancerRuleResponse> ruleResponses=new ArrayList<ApplicationLoadBalancerRuleResponse>();
  ApplicationLoadBalancerRuleResponse ruleResponse=new ApplicationLoadBalancerRuleResponse();
  ruleResponse.setInstancePort(lb.getDefaultPortStart());
  ruleResponse.setSourcePort(lb.getSourcePortStart());
  FirewallRule.State stateToSet=lb.getState();
  if (stateToSet.equals(FirewallRule.State.Revoke)) {
    stateToSet=FirewallRule.State.Deleting;
  }
  ruleResponse.setState(stateToSet.toString());
  ruleResponse.setObjectName("String_Node_Str");
  ruleResponses.add(ruleResponse);
  lbResponse.setLbRules(ruleResponses);
  List<ApplicationLoadBalancerInstanceResponse> instanceResponses=new ArrayList<ApplicationLoadBalancerInstanceResponse>();
  for (  Ip ip : lbInstances.keySet()) {
    ApplicationLoadBalancerInstanceResponse instanceResponse=new ApplicationLoadBalancerInstanceResponse();
    instanceResponse.setIpAddress(ip.addr());
    UserVm vm=lbInstances.get(ip);
    instanceResponse.setId(vm.getUuid());
    instanceResponse.setName(vm.getInstanceName());
    instanceResponse.setObjectName("String_Node_Str");
    instanceResponses.add(instanceResponse);
  }
  lbResponse.setLbInstances(instanceResponses);
  List<? extends ResourceTag> tags=ApiDBUtils.listByResourceTypeAndId(ResourceObjectType.LoadBalancer,lb.getId());
  List<ResourceTagResponse> tagResponses=new ArrayList<ResourceTagResponse>();
  for (  ResourceTag tag : tags) {
    ResourceTagResponse tagResponse=createResourceTagResponse(tag,true);
    tagResponses.add(tagResponse);
  }
  lbResponse.setTags(tagResponses);
  lbResponse.setObjectName("String_Node_Str");
  return lbResponse;
}