Program: 116537
Project: 116537
Buggy source:
public void buildTemplate(){
  IaasProvider iaasInfo=getIaasProvider();
  if (iaasInfo.getComputeService() == null) {
    throw new CloudControllerException("String_Node_Str" + iaasInfo.getName());
  }
  TemplateBuilder templateBuilder=iaasInfo.getComputeService().templateBuilder();
  templateBuilder.imageId(iaasInfo.getImage());
  if (!(iaasInfo instanceof IaasProvider)) {
    templateBuilder.locationId(iaasInfo.getType());
  }
  String instanceType;
  if (((instanceType=iaasInfo.getProperty(CloudControllerConstants.INSTANCE_TYPE)) != null)) {
    templateBuilder.hardwareId(instanceType);
  }
  Template template=templateBuilder.build();
  boolean blockUntilRunning=true;
  if (iaasInfo.getProperty(CloudControllerConstants.BLOCK_UNTIL_RUNNING) != null) {
    blockUntilRunning=Boolean.parseBoolean(iaasInfo.getProperty(CloudControllerConstants.BLOCK_UNTIL_RUNNING));
  }
  template.getOptions().as(TemplateOptions.class).blockUntilRunning(blockUntilRunning);
  template.getOptions().as(TemplateOptions.class).inboundPorts(new int[]{});
  if (iaasInfo.getProperty(CloudControllerConstants.SECURITY_GROUPS) != null) {
    template.getOptions().as(NovaTemplateOptions.class).securityGroupNames(iaasInfo.getProperty(CloudControllerConstants.SECURITY_GROUPS).split(CloudControllerConstants.ENTRY_SEPARATOR));
  }
  if (iaasInfo.getProperty(CloudControllerConstants.KEY_PAIR) != null) {
    template.getOptions().as(NovaTemplateOptions.class).keyPairName(iaasInfo.getProperty(CloudControllerConstants.KEY_PAIR));
  }
  if (iaasInfo.getNetworkInterfaces() != null) {
    Set<Network> novaNetworksSet=new LinkedHashSet<Network>(iaasInfo.getNetworkInterfaces().length);
    for (    NetworkInterface ni : iaasInfo.getNetworkInterfaces()) {
      novaNetworksSet.add(Network.builder().networkUuid(ni.getNetworkUuid()).fixedIp(ni.getFixedIp()).portUuid(ni.getPortUuid()).build());
    }
    template.getOptions().as(NovaTemplateOptions.class).novaNetworks(novaNetworksSet);
  }
  if (iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE) != null) {
    template.getOptions().as(NovaTemplateOptions.class).availabilityZone(iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE));
  }
  iaasInfo.setTemplate(template);
}

Fixed version (ground truth):
public void buildTemplate(){
  IaasProvider iaasInfo=getIaasProvider();
  if (iaasInfo.getComputeService() == null) {
    throw new CloudControllerException("String_Node_Str" + iaasInfo.getName());
  }
  TemplateBuilder templateBuilder=iaasInfo.getComputeService().templateBuilder();
  templateBuilder.imageId(iaasInfo.getImage());
  String instanceType;
  if (((instanceType=iaasInfo.getProperty(CloudControllerConstants.INSTANCE_TYPE)) != null)) {
    templateBuilder.hardwareId(instanceType);
  }
  Template template=templateBuilder.build();
  boolean blockUntilRunning=true;
  if (iaasInfo.getProperty(CloudControllerConstants.BLOCK_UNTIL_RUNNING) != null) {
    blockUntilRunning=Boolean.parseBoolean(iaasInfo.getProperty(CloudControllerConstants.BLOCK_UNTIL_RUNNING));
  }
  template.getOptions().as(TemplateOptions.class).blockUntilRunning(blockUntilRunning);
  template.getOptions().as(TemplateOptions.class).inboundPorts(new int[]{});
  if (iaasInfo.getProperty(CloudControllerConstants.SECURITY_GROUPS) != null) {
    template.getOptions().as(NovaTemplateOptions.class).securityGroupNames(iaasInfo.getProperty(CloudControllerConstants.SECURITY_GROUPS).split(CloudControllerConstants.ENTRY_SEPARATOR));
  }
  if (iaasInfo.getProperty(CloudControllerConstants.KEY_PAIR) != null) {
    template.getOptions().as(NovaTemplateOptions.class).keyPairName(iaasInfo.getProperty(CloudControllerConstants.KEY_PAIR));
  }
  if (iaasInfo.getNetworkInterfaces() != null) {
    Set<Network> novaNetworksSet=new LinkedHashSet<Network>(iaasInfo.getNetworkInterfaces().length);
    for (    NetworkInterface ni : iaasInfo.getNetworkInterfaces()) {
      novaNetworksSet.add(Network.builder().networkUuid(ni.getNetworkUuid()).fixedIp(ni.getFixedIp()).portUuid(ni.getPortUuid()).build());
    }
    template.getOptions().as(NovaTemplateOptions.class).novaNetworks(novaNetworksSet);
  }
  if (iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE) != null) {
    template.getOptions().as(NovaTemplateOptions.class).availabilityZone(iaasInfo.getProperty(CloudControllerConstants.AVAILABILITY_ZONE));
  }
  iaasInfo.setTemplate(template);
}