Program: 30149
Project: 30149
Buggy source:
public void run(){
  TemplateInstance matchingTemplate=null;
  if (templateRepository != null) {
    if (templateId == null) {
      if (serviceCharacteristics != null) {
        Set<TemplateCondition> andConditions=new HashSet<TemplateCondition>();
        andConditions.add(new org.glassfish.virtualization.util.ServiceType(serviceCharacteristics.getProperty("String_Node_Str")));
        for (        TemplateInstance ti : templateRepository.all()) {
          boolean allConditionsSatisfied=true;
          for (          TemplateCondition condition : andConditions) {
            if (!ti.satisfies(condition)) {
              allConditionsSatisfied=false;
              break;
            }
          }
          if (allConditionsSatisfied) {
            matchingTemplate=ti;
            break;
          }
        }
        if (matchingTemplate != null) {
          templateId=matchingTemplate.getConfig().getName();
        }
      }
    }
 else {
      for (      TemplateInstance ti : templateRepository.all()) {
        if (ti.getConfig().getName().equals(templateId)) {
          matchingTemplate=ti;
          break;
        }
      }
    }
  }
  if (matchingTemplate != null) {
    try {
      VirtualCluster vCluster=virtualClusters.byName(virtualClusterName);
      PhasedFuture<AllocationPhase,VirtualMachine> future=iaas.allocate(new AllocationConstraints(matchingTemplate,vCluster),null);
      VirtualMachine vm=future.get();
      ServiceInfo entry=new ServiceInfo();
      entry.setInstanceId(vm.getName());
      entry.setIpAddress(vm.getAddress());
      entry.setState(ServiceInfo.State.Running.toString());
      entry.setServiceName(serviceName);
      entry.setAppName(appName);
      entry.setServerType("String_Node_Str");
      serviceUtil.registerCloudEntry(entry);
    }
 catch (    Throwable ex) {
      throw new RuntimeException(ex);
    }
    return;
  }
}

Fixed version (ground truth):
public void run(){
  TemplateInstance matchingTemplate=null;
  if (templateRepository != null) {
    if (templateId == null) {
      if (serviceCharacteristics != null) {
        Set<TemplateCondition> andConditions=new HashSet<TemplateCondition>();
        andConditions.add(new org.glassfish.virtualization.util.ServiceType(serviceCharacteristics.getProperty("String_Node_Str")));
        for (        TemplateInstance ti : templateRepository.all()) {
          boolean allConditionsSatisfied=true;
          for (          TemplateCondition condition : andConditions) {
            if (!ti.satisfies(condition)) {
              allConditionsSatisfied=false;
              break;
            }
          }
          if (allConditionsSatisfied) {
            matchingTemplate=ti;
            break;
          }
        }
        if (matchingTemplate != null) {
          templateId=matchingTemplate.getConfig().getName();
        }
      }
    }
 else {
      for (      TemplateInstance ti : templateRepository.all()) {
        if (ti.getConfig().getName().equals(templateId)) {
          matchingTemplate=ti;
          break;
        }
      }
    }
  }
  if (matchingTemplate != null) {
    try {
      VirtualCluster vCluster=virtualClusters.byName(virtualClusterName);
      PhasedFuture<AllocationPhase,VirtualMachine> future=iaas.allocate(new AllocationConstraints(matchingTemplate,vCluster),null);
      VirtualMachine vm=future.get();
      ServiceInfo entry=new ServiceInfo();
      entry.setInstanceId(vm.getName());
      entry.setIpAddress(vm.getAddress().getHostAddress());
      entry.setState(ServiceInfo.State.Running.toString());
      entry.setServiceName(serviceName);
      entry.setAppName(appName);
      entry.setServerType("String_Node_Str");
      serviceUtil.registerCloudEntry(entry);
    }
 catch (    Throwable ex) {
      throw new RuntimeException(ex);
    }
    return;
  }
}