Program: 105631
Project: 105631
Buggy source:
@Override public NetworkOfferingResponse createNetworkOfferingResponse(NetworkOffering offering){
  NetworkOfferingResponse response=new NetworkOfferingResponse();
  response.setId(offering.getUuid());
  response.setName(offering.getName());
  response.setDisplayText(offering.getDisplayText());
  response.setTags(offering.getTags());
  response.setTrafficType(offering.getTrafficType().toString());
  response.setIsDefault(offering.isDefault());
  response.setSpecifyVlan(offering.getSpecifyVlan());
  response.setConserveMode(offering.isConserveMode());
  response.setSpecifyIpRanges(offering.getSpecifyIpRanges());
  response.setAvailability(offering.getAvailability().toString());
  response.setIsPersistent(offering.getIsPersistent());
  response.setNetworkRate(ApiDBUtils.getNetworkRate(offering.getId()));
  response.setEgressDefaultPolicy(offering.getEgressDefaultPolicy());
  response.setConcurrentConnections(offering.getConcurrentConnections());
  response.setSupportsStrechedL2Subnet(offering.getSupportsStrechedL2());
  Long so=null;
  if (offering.getServiceOfferingId() != null) {
    so=offering.getServiceOfferingId();
  }
 else {
    so=ApiDBUtils.findDefaultRouterServiceOffering();
  }
  if (so != null) {
    ServiceOffering soffering=ApiDBUtils.findServiceOfferingById(so);
    if (soffering != null) {
      response.setServiceOfferingId(soffering.getUuid());
    }
  }
  if (offering.getGuestType() != null) {
    response.setGuestIpType(offering.getGuestType().toString());
  }
  response.setState(offering.getState().name());
  Map<Service,Set<Provider>> serviceProviderMap=ApiDBUtils.listNetworkOfferingServices(offering.getId());
  List<ServiceResponse> serviceResponses=new ArrayList<ServiceResponse>();
  for (  Service service : serviceProviderMap.keySet()) {
    ServiceResponse svcRsp=new ServiceResponse();
    if (service == Service.Gateway) {
      continue;
    }
    svcRsp.setName(service.getName());
    List<ProviderResponse> providers=new ArrayList<ProviderResponse>();
    for (    Provider provider : serviceProviderMap.get(service)) {
      if (provider != null) {
        ProviderResponse providerRsp=new ProviderResponse();
        providerRsp.setName(provider.getName());
        providers.add(providerRsp);
      }
    }
    svcRsp.setProviders(providers);
    if (Service.Lb == service) {
      List<CapabilityResponse> lbCapResponse=new ArrayList<CapabilityResponse>();
      CapabilityResponse lbIsoaltion=new CapabilityResponse();
      lbIsoaltion.setName(Capability.SupportedLBIsolation.getName());
      lbIsoaltion.setValue(offering.getDedicatedLB() ? "String_Node_Str" : "String_Node_Str");
      lbCapResponse.add(lbIsoaltion);
      CapabilityResponse eLb=new CapabilityResponse();
      eLb.setName(Capability.ElasticLb.getName());
      eLb.setValue(offering.getElasticLb() ? "String_Node_Str" : "String_Node_Str");
      lbCapResponse.add(eLb);
      CapabilityResponse inline=new CapabilityResponse();
      inline.setName(Capability.InlineMode.getName());
      inline.setValue(offering.isInline() ? "String_Node_Str" : "String_Node_Str");
      lbCapResponse.add(inline);
      svcRsp.setCapabilities(lbCapResponse);
    }
 else     if (Service.SourceNat == service) {
      List<CapabilityResponse> capabilities=new ArrayList<CapabilityResponse>();
      CapabilityResponse sharedSourceNat=new CapabilityResponse();
      sharedSourceNat.setName(Capability.SupportedSourceNatTypes.getName());
      sharedSourceNat.setValue(offering.getSharedSourceNat() ? "String_Node_Str" : "String_Node_Str");
      capabilities.add(sharedSourceNat);
      CapabilityResponse redundantRouter=new CapabilityResponse();
      redundantRouter.setName(Capability.RedundantRouter.getName());
      redundantRouter.setValue(offering.getRedundantRouter() ? "String_Node_Str" : "String_Node_Str");
      capabilities.add(redundantRouter);
      svcRsp.setCapabilities(capabilities);
    }
 else     if (service == Service.StaticNat) {
      List<CapabilityResponse> staticNatCapResponse=new ArrayList<CapabilityResponse>();
      CapabilityResponse eIp=new CapabilityResponse();
      eIp.setName(Capability.ElasticIp.getName());
      eIp.setValue(offering.getElasticIp() ? "String_Node_Str" : "String_Node_Str");
      staticNatCapResponse.add(eIp);
      CapabilityResponse associatePublicIp=new CapabilityResponse();
      associatePublicIp.setName(Capability.AssociatePublicIP.getName());
      associatePublicIp.setValue(offering.getAssociatePublicIP() ? "String_Node_Str" : "String_Node_Str");
      staticNatCapResponse.add(associatePublicIp);
      svcRsp.setCapabilities(staticNatCapResponse);
    }
    serviceResponses.add(svcRsp);
  }
  response.setForVpc(_configMgr.isOfferingForVpc(offering));
  response.setServices(serviceResponses);
  Map<Detail,String> details=_ntwkModel.getNtwkOffDetails(offering.getId());
  if (details != null && !details.isEmpty()) {
    response.setDetails(details);
  }
  response.setObjectName("String_Node_Str");
  return response;
}

Fixed version (ground truth):
@Override public NetworkOfferingResponse createNetworkOfferingResponse(NetworkOffering offering){
  NetworkOfferingResponse response=new NetworkOfferingResponse();
  response.setId(offering.getUuid());
  response.setName(offering.getName());
  response.setDisplayText(offering.getDisplayText());
  response.setTags(offering.getTags());
  response.setTrafficType(offering.getTrafficType().toString());
  response.setIsDefault(offering.isDefault());
  response.setSpecifyVlan(offering.getSpecifyVlan());
  response.setConserveMode(offering.isConserveMode());
  response.setSpecifyIpRanges(offering.getSpecifyIpRanges());
  response.setAvailability(offering.getAvailability().toString());
  response.setIsPersistent(offering.getIsPersistent());
  response.setNetworkRate(ApiDBUtils.getNetworkRate(offering.getId()));
  response.setEgressDefaultPolicy(offering.getEgressDefaultPolicy());
  response.setConcurrentConnections(offering.getConcurrentConnections());
  response.setSupportsStrechedL2Subnet(offering.getSupportsStrechedL2());
  Long so=null;
  if (offering.getServiceOfferingId() != null) {
    so=offering.getServiceOfferingId();
  }
 else {
    so=ApiDBUtils.findDefaultRouterServiceOffering();
  }
  if (so != null) {
    ServiceOffering soffering=ApiDBUtils.findServiceOfferingById(so);
    if (soffering != null) {
      response.setServiceOfferingId(soffering.getUuid());
    }
  }
  if (offering.getGuestType() != null) {
    response.setGuestIpType(offering.getGuestType().toString());
  }
  response.setState(offering.getState().name());
  Map<Service,Set<Provider>> serviceProviderMap=ApiDBUtils.listNetworkOfferingServices(offering.getId());
  List<ServiceResponse> serviceResponses=new ArrayList<ServiceResponse>();
  for (  Map.Entry<Service,Set<Provider>> entry : serviceProviderMap.entrySet()) {
    Service service=entry.getKey();
    Set<Provider> srvc_providers=entry.getValue();
    ServiceResponse svcRsp=new ServiceResponse();
    if (service == Service.Gateway) {
      continue;
    }
    svcRsp.setName(service.getName());
    List<ProviderResponse> providers=new ArrayList<ProviderResponse>();
    for (    Provider provider : srvc_providers) {
      if (provider != null) {
        ProviderResponse providerRsp=new ProviderResponse();
        providerRsp.setName(provider.getName());
        providers.add(providerRsp);
      }
    }
    svcRsp.setProviders(providers);
    if (Service.Lb == service) {
      List<CapabilityResponse> lbCapResponse=new ArrayList<CapabilityResponse>();
      CapabilityResponse lbIsoaltion=new CapabilityResponse();
      lbIsoaltion.setName(Capability.SupportedLBIsolation.getName());
      lbIsoaltion.setValue(offering.getDedicatedLB() ? "String_Node_Str" : "String_Node_Str");
      lbCapResponse.add(lbIsoaltion);
      CapabilityResponse eLb=new CapabilityResponse();
      eLb.setName(Capability.ElasticLb.getName());
      eLb.setValue(offering.getElasticLb() ? "String_Node_Str" : "String_Node_Str");
      lbCapResponse.add(eLb);
      CapabilityResponse inline=new CapabilityResponse();
      inline.setName(Capability.InlineMode.getName());
      inline.setValue(offering.isInline() ? "String_Node_Str" : "String_Node_Str");
      lbCapResponse.add(inline);
      svcRsp.setCapabilities(lbCapResponse);
    }
 else     if (Service.SourceNat == service) {
      List<CapabilityResponse> capabilities=new ArrayList<CapabilityResponse>();
      CapabilityResponse sharedSourceNat=new CapabilityResponse();
      sharedSourceNat.setName(Capability.SupportedSourceNatTypes.getName());
      sharedSourceNat.setValue(offering.getSharedSourceNat() ? "String_Node_Str" : "String_Node_Str");
      capabilities.add(sharedSourceNat);
      CapabilityResponse redundantRouter=new CapabilityResponse();
      redundantRouter.setName(Capability.RedundantRouter.getName());
      redundantRouter.setValue(offering.getRedundantRouter() ? "String_Node_Str" : "String_Node_Str");
      capabilities.add(redundantRouter);
      svcRsp.setCapabilities(capabilities);
    }
 else     if (service == Service.StaticNat) {
      List<CapabilityResponse> staticNatCapResponse=new ArrayList<CapabilityResponse>();
      CapabilityResponse eIp=new CapabilityResponse();
      eIp.setName(Capability.ElasticIp.getName());
      eIp.setValue(offering.getElasticIp() ? "String_Node_Str" : "String_Node_Str");
      staticNatCapResponse.add(eIp);
      CapabilityResponse associatePublicIp=new CapabilityResponse();
      associatePublicIp.setName(Capability.AssociatePublicIP.getName());
      associatePublicIp.setValue(offering.getAssociatePublicIP() ? "String_Node_Str" : "String_Node_Str");
      staticNatCapResponse.add(associatePublicIp);
      svcRsp.setCapabilities(staticNatCapResponse);
    }
    serviceResponses.add(svcRsp);
  }
  response.setForVpc(_configMgr.isOfferingForVpc(offering));
  response.setServices(serviceResponses);
  Map<Detail,String> details=_ntwkModel.getNtwkOffDetails(offering.getId());
  if (details != null && !details.isEmpty()) {
    response.setDetails(details);
  }
  response.setObjectName("String_Node_Str");
  return response;
}