Program: 41544
Project: 41544
Buggy source:
public boolean handleArtifactReferenceUpload(AbstractArtifactReference ref,TemplatePlanContext templateContext,Variable serverIp,Variable sshUser,Variable sshKey,String templateId,boolean appendToPrePhase) throws IOException {
  LOG.debug("String_Node_Str" + ref.getReference());
  String ubuntuFilePath="String_Node_Str" + templateContext.getCSARFileName() + "String_Node_Str"+ ref.getReference();
  String ubuntuFilePathVarName="String_Node_Str" + templateContext.getIdForNames();
  Variable ubuntuFilePathVar=templateContext.createGlobalStringVariable(ubuntuFilePathVarName,ubuntuFilePath);
  String ubuntuFolderPathScript="String_Node_Str" + this.fileReferenceToFolder(ubuntuFilePath);
  String containerAPIAbsoluteURIXPathQuery=this.createXPathQueryForURLRemoteFilePath(ref.getReference());
  String containerAPIAbsoluteURIVarName="String_Node_Str" + templateContext.getIdForNames();
  Variable containerAPIAbsoluteURIVar=templateContext.createGlobalStringVariable(containerAPIAbsoluteURIVarName,"String_Node_Str");
  try {
    Node assignNode=this.loadAssignXpathQueryToStringVarFragmentAsNode("String_Node_Str" + templateContext.getIdForNames(),containerAPIAbsoluteURIXPathQuery,containerAPIAbsoluteURIVar.getName());
    assignNode=templateContext.importNode(assignNode);
    if (appendToPrePhase) {
      templateContext.getPrePhaseElement().appendChild(assignNode);
    }
 else {
      templateContext.getProvisioningPhaseElement().appendChild(assignNode);
    }
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
    return false;
  }
catch (  SAXException e) {
    LOG.error("String_Node_Str");
    return false;
  }
  Map<String,Variable> runScriptRequestInputParams=new HashMap<String,Variable>();
  String mkdirScriptVarName="String_Node_Str" + templateContext.getIdForNames();
  Variable mkdirScriptVar=templateContext.createGlobalStringVariable(mkdirScriptVarName,ubuntuFolderPathScript);
  String cleanName=serverIp.getName().substring(serverIp.getName().lastIndexOf("String_Node_Str") + 1);
switch (cleanName) {
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_SERVERIP:
    runScriptRequestInputParams.put("String_Node_Str",serverIp);
  runScriptRequestInputParams.put("String_Node_Str",sshKey);
runScriptRequestInputParams.put("String_Node_Str",sshUser);
runScriptRequestInputParams.put("String_Node_Str",mkdirScriptVar);
this.handle(templateContext,templateId,true,"String_Node_Str","String_Node_Str","String_Node_Str",runScriptRequestInputParams,new HashMap<String,Variable>(),appendToPrePhase);
break;
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMIP:
runScriptRequestInputParams.put("String_Node_Str",serverIp);
runScriptRequestInputParams.put("String_Node_Str",sshUser);
runScriptRequestInputParams.put("String_Node_Str",sshKey);
runScriptRequestInputParams.put("String_Node_Str",mkdirScriptVar);
this.handle(templateContext,templateId,true,"String_Node_Str",Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM,"String_Node_Str",runScriptRequestInputParams,new HashMap<String,Variable>(),appendToPrePhase);
break;
default :
return false;
}
Map<String,Variable> transferFileRequestInputParams=new HashMap<String,Variable>();
String cleanName2=serverIp.getName().substring(serverIp.getName().lastIndexOf("String_Node_Str") + 1);
switch (cleanName2) {
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_SERVERIP:
transferFileRequestInputParams.put("String_Node_Str",serverIp);
transferFileRequestInputParams.put("String_Node_Str",sshUser);
transferFileRequestInputParams.put("String_Node_Str",sshKey);
transferFileRequestInputParams.put("String_Node_Str",ubuntuFilePathVar);
transferFileRequestInputParams.put("String_Node_Str",containerAPIAbsoluteURIVar);
this.handle(templateContext,templateId,true,"String_Node_Str","String_Node_Str","String_Node_Str",transferFileRequestInputParams,new HashMap<String,Variable>(),appendToPrePhase);
break;
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMIP:
transferFileRequestInputParams.put("String_Node_Str",serverIp);
transferFileRequestInputParams.put("String_Node_Str",sshUser);
transferFileRequestInputParams.put("String_Node_Str",sshKey);
transferFileRequestInputParams.put("String_Node_Str",ubuntuFilePathVar);
transferFileRequestInputParams.put("String_Node_Str",containerAPIAbsoluteURIVar);
this.handle(templateContext,templateId,true,"String_Node_Str",Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM,"String_Node_Str",transferFileRequestInputParams,new HashMap<String,Variable>(),appendToPrePhase);
break;
default :
return false;
}
return true;
}

Fixed version (ground truth):
public boolean handleArtifactReferenceUpload(AbstractArtifactReference ref,TemplatePlanContext templateContext,Variable serverIp,Variable sshUser,Variable sshKey,String templateId,boolean appendToPrePhase) throws IOException {
  LOG.debug("String_Node_Str" + ref.getReference());
  String ubuntuFilePath="String_Node_Str" + templateContext.getCSARFileName() + "String_Node_Str"+ ref.getReference();
  String ubuntuFilePathVarName="String_Node_Str" + templateContext.getIdForNames();
  Variable ubuntuFilePathVar=templateContext.createGlobalStringVariable(ubuntuFilePathVarName,ubuntuFilePath);
  String ubuntuFolderPathScript="String_Node_Str" + this.fileReferenceToFolder(ubuntuFilePath);
  String containerAPIAbsoluteURIXPathQuery=this.createXPathQueryForURLRemoteFilePath(ref.getReference());
  String containerAPIAbsoluteURIVarName="String_Node_Str" + templateContext.getIdForNames();
  Variable containerAPIAbsoluteURIVar=templateContext.createGlobalStringVariable(containerAPIAbsoluteURIVarName,"String_Node_Str");
  try {
    Node assignNode=this.loadAssignXpathQueryToStringVarFragmentAsNode("String_Node_Str" + templateContext.getIdForNames(),containerAPIAbsoluteURIXPathQuery,containerAPIAbsoluteURIVar.getName());
    assignNode=templateContext.importNode(assignNode);
    if (appendToPrePhase) {
      templateContext.getPrePhaseElement().appendChild(assignNode);
    }
 else {
      templateContext.getProvisioningPhaseElement().appendChild(assignNode);
    }
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
    return false;
  }
catch (  SAXException e) {
    LOG.error("String_Node_Str");
    return false;
  }
  Map<String,Variable> runScriptRequestInputParams=new HashMap<String,Variable>();
  String mkdirScriptVarName="String_Node_Str" + templateContext.getIdForNames();
  Variable mkdirScriptVar=templateContext.createGlobalStringVariable(mkdirScriptVarName,ubuntuFolderPathScript);
  String cleanName=serverIp.getName().substring(serverIp.getName().lastIndexOf("String_Node_Str") + 1);
switch (cleanName) {
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_SERVERIP:
    runScriptRequestInputParams.put("String_Node_Str",serverIp);
  runScriptRequestInputParams.put("String_Node_Str",sshKey);
runScriptRequestInputParams.put("String_Node_Str",sshUser);
runScriptRequestInputParams.put("String_Node_Str",mkdirScriptVar);
this.handle(templateContext,templateId,true,"String_Node_Str","String_Node_Str","String_Node_Str",runScriptRequestInputParams,new HashMap<String,Variable>(),appendToPrePhase);
break;
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMIP:
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_RASPBIANIP:
runScriptRequestInputParams.put("String_Node_Str",serverIp);
runScriptRequestInputParams.put("String_Node_Str",sshUser);
runScriptRequestInputParams.put("String_Node_Str",sshKey);
runScriptRequestInputParams.put("String_Node_Str",mkdirScriptVar);
this.handle(templateContext,templateId,true,"String_Node_Str",Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM,"String_Node_Str",runScriptRequestInputParams,new HashMap<String,Variable>(),appendToPrePhase);
break;
default :
return false;
}
Map<String,Variable> transferFileRequestInputParams=new HashMap<String,Variable>();
String cleanName2=serverIp.getName().substring(serverIp.getName().lastIndexOf("String_Node_Str") + 1);
switch (cleanName2) {
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_SERVERIP:
transferFileRequestInputParams.put("String_Node_Str",serverIp);
transferFileRequestInputParams.put("String_Node_Str",sshUser);
transferFileRequestInputParams.put("String_Node_Str",sshKey);
transferFileRequestInputParams.put("String_Node_Str",ubuntuFilePathVar);
transferFileRequestInputParams.put("String_Node_Str",containerAPIAbsoluteURIVar);
this.handle(templateContext,templateId,true,"String_Node_Str","String_Node_Str","String_Node_Str",transferFileRequestInputParams,new HashMap<String,Variable>(),appendToPrePhase);
break;
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMIP:
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_RASPBIANIP:
transferFileRequestInputParams.put("String_Node_Str",serverIp);
transferFileRequestInputParams.put("String_Node_Str",sshUser);
transferFileRequestInputParams.put("String_Node_Str",sshKey);
transferFileRequestInputParams.put("String_Node_Str",ubuntuFilePathVar);
transferFileRequestInputParams.put("String_Node_Str",containerAPIAbsoluteURIVar);
this.handle(templateContext,templateId,true,"String_Node_Str",Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM,"String_Node_Str",transferFileRequestInputParams,new HashMap<String,Variable>(),appendToPrePhase);
break;
default :
return false;
}
return true;
}