Program: 115639
Project: 115639
Buggy source:
public static void extractIaaSProvidersFromCartridge(Cartridge config){
  if (config == null) {
    return;
  }
  List<IaasProvider> iaases=CloudControllerConfig.getInstance().getIaasProviders();
  IaasConfig[] iaasConfigs=config.getIaasConfigs();
  if (iaasConfigs != null) {
    for (    IaasConfig iaasConfig : iaasConfigs) {
      if (iaasConfig != null) {
        IaasProvider iaasProvider=null;
        if (iaases != null) {
          for (          IaasProvider iaas : iaases) {
            if (iaas.getType().equals(iaasConfig.getType())) {
              iaasProvider=new IaasProvider(iaas);
              break;
            }
          }
        }
        if (iaasProvider == null) {
          iaasProvider=new IaasProvider();
          iaasProvider.setType(iaasConfig.getType());
        }
        String className=iaasConfig.getClassName();
        if (className != null) {
          iaasProvider.setClassName(className);
        }
        String name=iaasConfig.getName();
        if (name != null) {
          iaasProvider.setName(name);
        }
        String identity=iaasConfig.getIdentity();
        if (identity != null) {
          iaasProvider.setIdentity(identity);
        }
        String credential=iaasConfig.getCredential();
        if (credential != null) {
          iaasProvider.setCredential(credential);
        }
        String provider=iaasConfig.getProvider();
        if (provider != null) {
          iaasProvider.setProvider(provider);
        }
        String imageId=iaasConfig.getImageId();
        if (imageId != null) {
          iaasProvider.setImage(imageId);
        }
        byte[] payload=iaasConfig.getPayload();
        if (payload != null) {
          iaasProvider.setPayload(payload);
        }
        org.apache.stratos.common.Properties props1=iaasConfig.getProperties();
        if (props1 != null) {
          for (          Property prop : props1.getProperties()) {
            iaasProvider.addProperty(prop.getName(),String.valueOf(prop.getValue()));
          }
        }
        NetworkInterfaces networkInterfaces=iaasConfig.getNetworkInterfaces();
        if (networkInterfaces != null && networkInterfaces.getNetworkInterfaces() != null) {
          iaasProvider.setNetworkInterfaces(networkInterfaces.getNetworkInterfaces());
        }
        CloudControllerContext.getInstance().addIaasProvider(config.getType(),iaasProvider);
      }
    }
  }
  config.setLoadBalancingIPType(getLoadBalancingIPTypeStringFromEnum(LoadBalancingIPType.Private));
  if (StringUtils.isNotBlank(config.getLoadBalancingIPType())) {
    if (config.getLoadBalancingIPType().equals("String_Node_Str")) {
      config.setLoadBalancingIPType(getLoadBalancingIPTypeStringFromEnum(LoadBalancingIPType.Public));
    }
  }
}

Fixed version (ground truth):
public static void extractIaaSProvidersFromCartridge(Cartridge cartridge){
  if (cartridge == null) {
    return;
  }
  List<IaasProvider> iaases=CloudControllerConfig.getInstance().getIaasProviders();
  IaasConfig[] iaasConfigs=cartridge.getIaasConfigs();
  if (iaasConfigs != null) {
    for (    IaasConfig iaasConfig : iaasConfigs) {
      if (iaasConfig != null) {
        IaasProvider iaasProvider=null;
        if (iaases != null) {
          for (          IaasProvider iaas : iaases) {
            if (iaas.getType().equals(iaasConfig.getType())) {
              iaasProvider=new IaasProvider(iaas);
              break;
            }
          }
        }
        if (iaasProvider == null) {
          iaasProvider=new IaasProvider();
          iaasProvider.setType(iaasConfig.getType());
        }
        String className=iaasConfig.getClassName();
        if (className != null) {
          iaasProvider.setClassName(className);
        }
        String name=iaasConfig.getName();
        if (name != null) {
          iaasProvider.setName(name);
        }
        String identity=iaasConfig.getIdentity();
        if (identity != null) {
          iaasProvider.setIdentity(identity);
        }
        String credential=iaasConfig.getCredential();
        if (credential != null) {
          iaasProvider.setCredential(credential);
        }
        String provider=iaasConfig.getProvider();
        if (provider != null) {
          iaasProvider.setProvider(provider);
        }
        String imageId=iaasConfig.getImageId();
        if (imageId != null) {
          iaasProvider.setImage(imageId);
        }
        byte[] payload=iaasConfig.getPayload();
        if (payload != null) {
          iaasProvider.setPayload(payload);
        }
        org.apache.stratos.common.Properties props1=iaasConfig.getProperties();
        if (props1 != null) {
          for (          Property prop : props1.getProperties()) {
            iaasProvider.addProperty(prop.getName(),String.valueOf(prop.getValue()));
          }
        }
        NetworkInterfaces networkInterfaces=iaasConfig.getNetworkInterfaces();
        if (networkInterfaces != null && networkInterfaces.getNetworkInterfaces() != null) {
          iaasProvider.setNetworkInterfaces(networkInterfaces.getNetworkInterfaces());
        }
        CloudControllerContext.getInstance().addIaasProvider(cartridge.getType(),iaasProvider);
      }
    }
  }
}