Program: 40903
Project: 40903
Buggy source:
public List<BPELPlan> buildScalingPlans(final String csarName,final AbstractDefinitions definitions,final QName serviceTemplateId){
  final List<BPELPlan> scalingPlans=new ArrayList<>();
  final AbstractServiceTemplate serviceTemplate=getServiceTemplate(definitions,serviceTemplateId);
  if (serviceTemplate == null) {
    return scalingPlans;
  }
  final Map<String,String> tags=serviceTemplate.getTags();
  if (!tags.containsKey("String_Node_Str")) {
    return scalingPlans;
  }
  final List<ScalingPlanDefinition> scalingPlanDefinitions=fetchScalingPlansDefinitions(serviceTemplate.getTopologyTemplate(),tags);
  for (  final ScalingPlanDefinition scalingPlanDefinition : scalingPlanDefinitions) {
    final String processName=serviceTemplate.getId() + "String_Node_Str" + scalingPlanDefinition.name;
    final String processNamespace=serviceTemplate.getTargetNamespace() + "String_Node_Str";
    final AbstractPlan abstractScaleOutPlan=generateSOG(new QName(processNamespace,processName).toString(),definitions,serviceTemplate,scalingPlanDefinition);
    printGraph(abstractScaleOutPlan);
    final BPELPlan bpelScaleOutProcess=this.planHandler.createEmptyBPELPlan(processNamespace,processName,abstractScaleOutPlan,"String_Node_Str");
    bpelScaleOutProcess.setTOSCAInterfaceName(scalingPlanDefinition.name);
    bpelScaleOutProcess.setTOSCAOperationname("String_Node_Str");
    this.planHandler.initializeBPELSkeleton(bpelScaleOutProcess,csarName);
    final PropertyMap propMap=this.propertyInitializer.initializePropertiesAsVariables(bpelScaleOutProcess);
    this.planHandler.registerExtension("String_Node_Str",true,bpelScaleOutProcess);
    this.serviceInstanceInitializer.addManagementPlanServiceInstanceVarHandlingFromInput(bpelScaleOutProcess);
    this.instanceInitializer.addInstanceURLVarToTemplatePlans(bpelScaleOutProcess);
    this.instanceInitializer.addInstanceIDVarToTemplatePlans(bpelScaleOutProcess);
    this.serviceInstanceInitializer.addCorrellationID(bpelScaleOutProcess);
    final List<BPELScopeActivity> provScopeActivities=new ArrayList<>();
    for (    final BPELScopeActivity act : bpelScaleOutProcess.getAbstract2BPEL().values()) {
      if (act.getNodeTemplate() != null && scalingPlanDefinition.nodeTemplates.contains(act.getNodeTemplate())) {
        provScopeActivities.add(act);
      }
 else       if (act.getRelationshipTemplate() != null && scalingPlanDefinition.relationshipTemplates.contains(act.getRelationshipTemplate())) {
        provScopeActivities.add(act);
      }
    }
    this.emptyPropInit.initializeEmptyPropertiesAsInputParam(provScopeActivities,bpelScaleOutProcess,propMap);
    this.runProvisioningLogicGeneration(bpelScaleOutProcess,propMap,scalingPlanDefinition.nodeTemplates,scalingPlanDefinition.relationshipTemplates);
    for (    final AbstractRelationshipTemplate relationshipTemplate : scalingPlanDefinition.relationshipTemplatesRecursiveSelection) {
      this.addRecursiveInstanceSelection(bpelScaleOutProcess,propMap,relationshipTemplate);
    }
    for (    final AbstractNodeTemplate nodeTemplate : scalingPlanDefinition.nodeTemplatesRecursiveSelection) {
      this.addRecursiveInstanceSelection(bpelScaleOutProcess,propMap,nodeTemplate);
    }
    for (    final AnnotatedAbstractNodeTemplate stratNodeTemplate : scalingPlanDefinition.selectionStrategy2BorderNodes) {
      final IScalingPlanBuilderSelectionPlugin selectionPlugin=findSelectionPlugin(stratNodeTemplate);
      if (selectionPlugin != null) {
        final BPELScopeActivity scope=this.planHandler.getTemplateBuildPlanById(stratNodeTemplate.getId(),bpelScaleOutProcess);
        selectionPlugin.handle(new BPELPlanContext(scope,propMap,serviceTemplate),stratNodeTemplate,new ArrayList<>(stratNodeTemplate.getAnnotations()));
      }
    }
    for (    final AbstractActivity activ : bpelScaleOutProcess.getActivites()) {
      if (activ.getType().equals(ActivityType.PROVISIONING)) {
        addInstanceIdToOutput(bpelScaleOutProcess.getAbstract2BPEL().get(activ));
      }
    }
    this.finalizer.finalize(bpelScaleOutProcess);
    scalingPlans.add(bpelScaleOutProcess);
  }
  return scalingPlans;
}

Fixed version (ground truth):
public List<BPELPlan> buildScalingPlans(final String csarName,final AbstractDefinitions definitions,final QName serviceTemplateId){
  final List<BPELPlan> scalingPlans=new ArrayList<>();
  final AbstractServiceTemplate serviceTemplate=getServiceTemplate(definitions,serviceTemplateId);
  if (serviceTemplate == null) {
    return scalingPlans;
  }
  final Map<String,String> tags=serviceTemplate.getTags();
  if (!tags.containsKey("String_Node_Str")) {
    return scalingPlans;
  }
  final List<ScalingPlanDefinition> scalingPlanDefinitions=fetchScalingPlansDefinitions(serviceTemplate.getTopologyTemplate(),tags);
  for (  final ScalingPlanDefinition scalingPlanDefinition : scalingPlanDefinitions) {
    final String processName=ModelUtils.makeValidNCName(serviceTemplate.getId() + "String_Node_Str" + scalingPlanDefinition.name);
    final String processNamespace=serviceTemplate.getTargetNamespace() + "String_Node_Str";
    final AbstractPlan abstractScaleOutPlan=generateSOG(new QName(processNamespace,processName).toString(),definitions,serviceTemplate,scalingPlanDefinition);
    printGraph(abstractScaleOutPlan);
    final BPELPlan bpelScaleOutProcess=this.planHandler.createEmptyBPELPlan(processNamespace,processName,abstractScaleOutPlan,"String_Node_Str");
    bpelScaleOutProcess.setTOSCAInterfaceName(scalingPlanDefinition.name);
    bpelScaleOutProcess.setTOSCAOperationname("String_Node_Str");
    this.planHandler.initializeBPELSkeleton(bpelScaleOutProcess,csarName);
    final PropertyMap propMap=this.propertyInitializer.initializePropertiesAsVariables(bpelScaleOutProcess);
    this.planHandler.registerExtension("String_Node_Str",true,bpelScaleOutProcess);
    this.serviceInstanceInitializer.addManagementPlanServiceInstanceVarHandlingFromInput(bpelScaleOutProcess);
    this.instanceInitializer.addInstanceURLVarToTemplatePlans(bpelScaleOutProcess);
    this.instanceInitializer.addInstanceIDVarToTemplatePlans(bpelScaleOutProcess);
    this.serviceInstanceInitializer.addCorrellationID(bpelScaleOutProcess);
    final List<BPELScopeActivity> provScopeActivities=new ArrayList<>();
    for (    final BPELScopeActivity act : bpelScaleOutProcess.getAbstract2BPEL().values()) {
      if (act.getNodeTemplate() != null && scalingPlanDefinition.nodeTemplates.contains(act.getNodeTemplate())) {
        provScopeActivities.add(act);
      }
 else       if (act.getRelationshipTemplate() != null && scalingPlanDefinition.relationshipTemplates.contains(act.getRelationshipTemplate())) {
        provScopeActivities.add(act);
      }
    }
    this.emptyPropInit.initializeEmptyPropertiesAsInputParam(provScopeActivities,bpelScaleOutProcess,propMap);
    this.runProvisioningLogicGeneration(bpelScaleOutProcess,propMap,scalingPlanDefinition.nodeTemplates,scalingPlanDefinition.relationshipTemplates);
    for (    final AbstractRelationshipTemplate relationshipTemplate : scalingPlanDefinition.relationshipTemplatesRecursiveSelection) {
      this.addRecursiveInstanceSelection(bpelScaleOutProcess,propMap,relationshipTemplate);
    }
    for (    final AbstractNodeTemplate nodeTemplate : scalingPlanDefinition.nodeTemplatesRecursiveSelection) {
      this.addRecursiveInstanceSelection(bpelScaleOutProcess,propMap,nodeTemplate);
    }
    for (    final AnnotatedAbstractNodeTemplate stratNodeTemplate : scalingPlanDefinition.selectionStrategy2BorderNodes) {
      final IScalingPlanBuilderSelectionPlugin selectionPlugin=findSelectionPlugin(stratNodeTemplate);
      if (selectionPlugin != null) {
        final BPELScopeActivity scope=this.planHandler.getTemplateBuildPlanById(stratNodeTemplate.getId(),bpelScaleOutProcess);
        selectionPlugin.handle(new BPELPlanContext(scope,propMap,serviceTemplate),stratNodeTemplate,new ArrayList<>(stratNodeTemplate.getAnnotations()));
      }
    }
    for (    final AbstractActivity activ : bpelScaleOutProcess.getActivites()) {
      if (activ.getType().equals(ActivityType.PROVISIONING)) {
        addInstanceIdToOutput(bpelScaleOutProcess.getAbstract2BPEL().get(activ));
      }
    }
    this.finalizer.finalize(bpelScaleOutProcess);
    scalingPlans.add(bpelScaleOutProcess);
  }
  return scalingPlans;
}