Program: 41543
Project: 41543
Buggy source:
/** 
 * Adds necessary BPEL logic through the given Context, to deploy the given ArtifactReferences unto the specified InfrastructureNode
 * @param context a TemplateContext
 * @param refs the ArtifactReferences to deploy
 * @param artifactName the name of the artifact, where the references originate from
 * @param nodeTemplate a NodeTemplate which is a InfrastructureNode to deploy the AbstractReferences on
 * @return true iff adding the logic was successful
 */
private boolean handle(TemplatePlanContext templateContext,List<AbstractArtifactReference> refs,String artifactName,AbstractNodeTemplate nodeTemplate){
  Variable serverIpPropWrapper=null;
  for (  String serverIpName : PluginUtils.getSupportedVirtualMachineIPPropertyNames()) {
    serverIpPropWrapper=templateContext.getPropertyVariable(nodeTemplate,serverIpName);
    if (serverIpPropWrapper == null) {
      serverIpPropWrapper=templateContext.getPropertyVariable(serverIpName,true);
      if (serverIpPropWrapper == null) {
        serverIpPropWrapper=templateContext.getPropertyVariable(serverIpName,false);
      }
    }
  }
  if (serverIpPropWrapper == null) {
    Handler.LOG.warn("String_Node_Str");
    return false;
  }
  Variable sshUserVariable=null;
  for (  String vmLoginName : PluginUtils.getSupportedVirtualMachineLoginUserNamePropertyNames()) {
    sshUserVariable=templateContext.getPropertyVariable(nodeTemplate,vmLoginName);
    if (sshUserVariable == null) {
      sshUserVariable=templateContext.getPropertyVariable(vmLoginName,true);
      if (sshUserVariable == null) {
        sshUserVariable=templateContext.getPropertyVariable(vmLoginName,false);
      }
    }
  }
  if (sshUserVariable == null) {
    return false;
  }
 else {
    if (Utils.isVariableValueEmpty(sshUserVariable,templateContext)) {
      sshUserVariable=null;
    }
  }
  Variable sshKeyVariable=null;
  for (  String vmLoginPassword : PluginUtils.getSupportedVirtualMachineLoginPasswordPropertyNames()) {
    sshKeyVariable=templateContext.getPropertyVariable(nodeTemplate,vmLoginPassword);
    if (sshKeyVariable == null) {
      sshKeyVariable=templateContext.getPropertyVariable(vmLoginPassword,true);
      if (sshKeyVariable == null) {
        sshKeyVariable=templateContext.getPropertyVariable(vmLoginPassword,false);
      }
    }
  }
  if (sshKeyVariable == null) {
    return false;
  }
 else {
    if (Utils.isVariableValueEmpty(sshKeyVariable,templateContext)) {
      sshKeyVariable=null;
    }
  }
  if (sshUserVariable == null) {
    String cleanName=serverIpPropWrapper.getName().substring(serverIpPropWrapper.getName().lastIndexOf("String_Node_Str") + 1);
switch (cleanName) {
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_SERVERIP:
      LOG.debug("String_Node_Str");
    templateContext.addStringValueToPlanRequest("String_Node_Str");
  break;
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMIP:
LOG.debug("String_Node_Str");
templateContext.addStringValueToPlanRequest(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMLOGINNAME);
break;
default :
return false;
}
}
if (sshKeyVariable == null) {
LOG.debug("String_Node_Str");
String cleanName=serverIpPropWrapper.getName().substring(serverIpPropWrapper.getName().lastIndexOf("String_Node_Str") + 1);
switch (cleanName) {
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_SERVERIP:
LOG.debug("String_Node_Str");
templateContext.addStringValueToPlanRequest("String_Node_Str");
break;
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMIP:
templateContext.addStringValueToPlanRequest(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMLOGINPASSWORD);
break;
default :
return false;
}
}
String templateId=nodeTemplate.getId();
if (templateId.equals("String_Node_Str")) {
Handler.LOG.warn("String_Node_Str");
return false;
}
LOG.debug("String_Node_Str");
templateContext.addStringValueToPlanRequest("String_Node_Str");
LOG.debug("String_Node_Str");
templateContext.addStringValueToPlanRequest("String_Node_Str");
LOG.debug("String_Node_Str");
for (AbstractArtifactReference ref : refs) {
this.invokerPlugin.handleArtifactReferenceUpload(ref,templateContext,serverIpPropWrapper,sshUserVariable,sshKeyVariable,templateId);
}
return true;
}

Fixed version (ground truth):
/** 
 * Adds necessary BPEL logic through the given Context, to deploy the given ArtifactReferences unto the specified InfrastructureNode
 * @param context a TemplateContext
 * @param refs the ArtifactReferences to deploy
 * @param artifactName the name of the artifact, where the references originate from
 * @param nodeTemplate a NodeTemplate which is a InfrastructureNode to deploy the AbstractReferences on
 * @return true iff adding the logic was successful
 */
private boolean handle(TemplatePlanContext templateContext,List<AbstractArtifactReference> refs,String artifactName,AbstractNodeTemplate nodeTemplate){
  Variable serverIpPropWrapper=null;
  for (  String serverIpName : PluginUtils.getSupportedVirtualMachineIPPropertyNames()) {
    serverIpPropWrapper=templateContext.getPropertyVariable(nodeTemplate,serverIpName);
    if (serverIpPropWrapper == null) {
      serverIpPropWrapper=templateContext.getPropertyVariable(serverIpName,true);
      if (serverIpPropWrapper == null) {
        serverIpPropWrapper=templateContext.getPropertyVariable(serverIpName,false);
      }
 else {
        break;
      }
    }
 else {
      break;
    }
  }
  if (serverIpPropWrapper == null) {
    Handler.LOG.warn("String_Node_Str");
    return false;
  }
  Variable sshUserVariable=null;
  for (  String vmLoginName : PluginUtils.getSupportedVirtualMachineLoginUserNamePropertyNames()) {
    sshUserVariable=templateContext.getPropertyVariable(nodeTemplate,vmLoginName);
    if (sshUserVariable == null) {
      sshUserVariable=templateContext.getPropertyVariable(vmLoginName,true);
      if (sshUserVariable == null) {
        sshUserVariable=templateContext.getPropertyVariable(vmLoginName,false);
      }
 else {
        break;
      }
    }
 else {
      break;
    }
  }
  if (sshUserVariable == null) {
    return false;
  }
 else {
    if (Utils.isVariableValueEmpty(sshUserVariable,templateContext)) {
      sshUserVariable=null;
    }
  }
  Variable sshKeyVariable=null;
  for (  String vmLoginPassword : PluginUtils.getSupportedVirtualMachineLoginPasswordPropertyNames()) {
    sshKeyVariable=templateContext.getPropertyVariable(nodeTemplate,vmLoginPassword);
    if (sshKeyVariable == null) {
      sshKeyVariable=templateContext.getPropertyVariable(vmLoginPassword,true);
      if (sshKeyVariable == null) {
        sshKeyVariable=templateContext.getPropertyVariable(vmLoginPassword,false);
      }
 else {
        break;
      }
    }
 else {
      break;
    }
  }
  if (sshKeyVariable == null) {
    return false;
  }
 else {
    if (Utils.isVariableValueEmpty(sshKeyVariable,templateContext)) {
      sshKeyVariable=null;
    }
  }
  if (sshUserVariable == null) {
    String cleanName=serverIpPropWrapper.getName().substring(serverIpPropWrapper.getName().lastIndexOf("String_Node_Str") + 1);
switch (cleanName) {
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_SERVERIP:
      LOG.debug("String_Node_Str");
    templateContext.addStringValueToPlanRequest("String_Node_Str");
  break;
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMIP:
LOG.debug("String_Node_Str");
templateContext.addStringValueToPlanRequest(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMLOGINNAME);
break;
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_RASPBIANIP:
templateContext.addStringValueToPlanRequest(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_RASPBIANUSER);
break;
default :
return false;
}
}
if (sshKeyVariable == null) {
LOG.debug("String_Node_Str");
String cleanName=serverIpPropWrapper.getName().substring(serverIpPropWrapper.getName().lastIndexOf("String_Node_Str") + 1);
switch (cleanName) {
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_SERVERIP:
LOG.debug("String_Node_Str");
templateContext.addStringValueToPlanRequest("String_Node_Str");
break;
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMIP:
templateContext.addStringValueToPlanRequest(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMLOGINPASSWORD);
break;
case Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_RASPBIANIP:
templateContext.addStringValueToPlanRequest(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_RASPBIANPASSWD);
break;
default :
return false;
}
}
String templateId=nodeTemplate.getId();
if (templateId.equals("String_Node_Str")) {
Handler.LOG.warn("String_Node_Str");
return false;
}
LOG.debug("String_Node_Str");
templateContext.addStringValueToPlanRequest("String_Node_Str");
LOG.debug("String_Node_Str");
templateContext.addStringValueToPlanRequest("String_Node_Str");
LOG.debug("String_Node_Str");
for (AbstractArtifactReference ref : refs) {
this.invokerPlugin.handleArtifactReferenceUpload(ref,templateContext,serverIpPropWrapper,sshUserVariable,sshKeyVariable,templateId);
}
return true;
}