Program: 40994
Project: 40994
Buggy source:
public boolean handleWithCloudProviderInterface(TemplatePlanContext context,AbstractNodeTemplate nodeTemplate){
  AbstractNodeTemplate ubuntuNodeTemplate=this.findUbuntuNode(nodeTemplate);
  Variable ubuntuAMIIdVar=null;
  if (ubuntuNodeTemplate == null) {
    LOG.error("String_Node_Str");
    return false;
  }
  if (this.isUbuntuNodeTypeWithImplicitImage(ubuntuNodeTemplate.getType().getId())) {
    ubuntuAMIIdVar=context.createGlobalStringVariable("String_Node_Str",this.createUbuntuImageStringFromNodeType(ubuntuNodeTemplate.getType().getId()));
  }
  LOG.debug("String_Node_Str" + ubuntuNodeTemplate.getId() + "String_Node_Str"+ ubuntuNodeTemplate.getType().getId().toString());
  Variable instanceIdPropWrapper=null;
  for (  String instanceIdName : org.opentosca.model.tosca.conventions.Utils.getSupportedVirtualMachineInstanceIdPropertyNames()) {
    instanceIdPropWrapper=context.getPropertyVariable(ubuntuNodeTemplate,instanceIdName);
    if (instanceIdPropWrapper == null) {
      instanceIdPropWrapper=context.getPropertyVariable(instanceIdName,true);
    }
 else {
      break;
    }
  }
  if (instanceIdPropWrapper == null) {
    Handler.LOG.warn("String_Node_Str");
    return false;
  }
  Variable serverIpPropWrapper=null;
  for (  String vmIpName : org.opentosca.model.tosca.conventions.Utils.getSupportedVirtualMachineIPPropertyNames()) {
    serverIpPropWrapper=context.getPropertyVariable(ubuntuNodeTemplate,vmIpName);
    if (serverIpPropWrapper == null) {
      serverIpPropWrapper=context.getPropertyVariable(vmIpName,true);
    }
 else {
      break;
    }
  }
  if (serverIpPropWrapper == null) {
    Handler.LOG.warn("String_Node_Str");
    return false;
  }
  Variable sshUserVariable=null;
  for (  String userName : org.opentosca.model.tosca.conventions.Utils.getSupportedVirtualMachineLoginUserNamePropertyNames()) {
    sshUserVariable=context.getPropertyVariable(ubuntuNodeTemplate,userName);
    if (sshUserVariable == null) {
      sshUserVariable=context.getPropertyVariable(userName,true);
    }
 else {
      break;
    }
  }
  if (sshUserVariable == null) {
    return false;
  }
 else {
    if (Utils.isVariableValueEmpty(sshUserVariable,context)) {
      LOG.debug("String_Node_Str");
      context.addStringValueToPlanRequest(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMLOGINNAME);
      context.addAssignFromInput2VariableToMainAssign(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMLOGINNAME,sshUserVariable);
      sshUserVariable=null;
    }
  }
  Variable sshKeyVariable=null;
  for (  String passwordName : org.opentosca.model.tosca.conventions.Utils.getSupportedVirtualMachineLoginPasswordPropertyNames()) {
    sshKeyVariable=context.getPropertyVariable(ubuntuNodeTemplate,passwordName);
    if (sshKeyVariable == null) {
      sshKeyVariable=context.getPropertyVariable(passwordName,true);
    }
 else {
      break;
    }
  }
  if (sshKeyVariable == null) {
    return false;
  }
 else {
    if (Utils.isVariableValueEmpty(sshKeyVariable,context)) {
      LOG.debug("String_Node_Str");
      context.addStringValueToPlanRequest(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMLOGINPASSWORD);
      context.addAssignFromInput2VariableToMainAssign(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMLOGINPASSWORD,sshKeyVariable);
      sshKeyVariable=null;
    }
  }
  LOG.debug("String_Node_Str");
  context.addStringValueToPlanRequest("String_Node_Str");
  LOG.debug("String_Node_Str");
  context.addStringValueToPlanRequest("String_Node_Str");
  Map<String,Variable> createEC2InternalExternalPropsInput=new HashMap<String,Variable>();
  for (  String externalParameter : Handler.createVMInstanceExternalInputParams) {
    Variable variable=context.getPropertyVariable(ubuntuNodeTemplate,externalParameter);
    if (variable == null) {
      variable=context.getPropertyVariable(externalParameter,true);
    }
    if (externalParameter.equals("String_Node_Str") && ubuntuAMIIdVar != null) {
      createEC2InternalExternalPropsInput.put(externalParameter,ubuntuAMIIdVar);
      continue;
    }
    if (variable == null) {
      Handler.LOG.warn("String_Node_Str" + externalParameter);
      return false;
    }
 else {
      Handler.LOG.debug("String_Node_Str" + externalParameter);
    }
    if (Utils.isVariableValueEmpty(variable,context)) {
      Handler.LOG.debug("String_Node_Str");
      createEC2InternalExternalPropsInput.put(externalParameter,null);
    }
 else {
      createEC2InternalExternalPropsInput.put(externalParameter,variable);
    }
  }
  Map<String,Variable> createEC2InternalExternalPropsOutput=new HashMap<String,Variable>();
  createEC2InternalExternalPropsOutput.put(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMINSTANCEID,instanceIdPropWrapper);
  createEC2InternalExternalPropsOutput.put(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMIP,serverIpPropWrapper);
  context.addStringValueToPlanRequest("String_Node_Str");
  this.invokerOpPlugin.handle(context,Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_CLOUDPROVIDER_CREATEVM,Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_CLOUDPROVIDER,"String_Node_Str",createEC2InternalExternalPropsInput,createEC2InternalExternalPropsOutput);
  Map<String,Variable> startRequestInputParams=new HashMap<String,Variable>();
  Map<String,Variable> startRequestOutputParams=new HashMap<String,Variable>();
  startRequestInputParams.put("String_Node_Str",serverIpPropWrapper);
  startRequestInputParams.put("String_Node_Str",sshUserVariable);
  startRequestInputParams.put("String_Node_Str",sshKeyVariable);
  startRequestOutputParams.put("String_Node_Str",context.createGlobalStringVariable("String_Node_Str","String_Node_Str"));
  this.invokerOpPlugin.handle(context,ubuntuNodeTemplate.getId(),true,Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_WAITFORAVAIL,Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM,"String_Node_Str",startRequestInputParams,startRequestOutputParams,false);
  return true;
}

Fixed version (ground truth):
public boolean handleWithCloudProviderInterface(TemplatePlanContext context,AbstractNodeTemplate nodeTemplate){
  AbstractNodeTemplate cloudProviderNodeTemplate=this.findCloudProviderNode(nodeTemplate);
  if (cloudProviderNodeTemplate == null) {
    return false;
  }
  AbstractNodeTemplate ubuntuNodeTemplate=this.findUbuntuNode(nodeTemplate);
  Variable ubuntuAMIIdVar=null;
  if (ubuntuNodeTemplate == null) {
    LOG.error("String_Node_Str");
    return false;
  }
  if (this.isUbuntuNodeTypeWithImplicitImage(ubuntuNodeTemplate.getType().getId())) {
    ubuntuAMIIdVar=context.createGlobalStringVariable("String_Node_Str",this.createUbuntuImageStringFromNodeType(ubuntuNodeTemplate.getType().getId()));
  }
  LOG.debug("String_Node_Str" + ubuntuNodeTemplate.getId() + "String_Node_Str"+ ubuntuNodeTemplate.getType().getId().toString());
  Variable instanceIdPropWrapper=null;
  for (  String instanceIdName : org.opentosca.model.tosca.conventions.Utils.getSupportedVirtualMachineInstanceIdPropertyNames()) {
    instanceIdPropWrapper=context.getPropertyVariable(ubuntuNodeTemplate,instanceIdName);
    if (instanceIdPropWrapper == null) {
      instanceIdPropWrapper=context.getPropertyVariable(instanceIdName,true);
    }
 else {
      break;
    }
  }
  if (instanceIdPropWrapper == null) {
    Handler.LOG.warn("String_Node_Str");
    return false;
  }
  Variable serverIpPropWrapper=null;
  for (  String vmIpName : org.opentosca.model.tosca.conventions.Utils.getSupportedVirtualMachineIPPropertyNames()) {
    serverIpPropWrapper=context.getPropertyVariable(ubuntuNodeTemplate,vmIpName);
    if (serverIpPropWrapper == null) {
      serverIpPropWrapper=context.getPropertyVariable(vmIpName,true);
    }
 else {
      break;
    }
  }
  if (serverIpPropWrapper == null) {
    Handler.LOG.warn("String_Node_Str");
    return false;
  }
  Variable sshUserVariable=null;
  for (  String userName : org.opentosca.model.tosca.conventions.Utils.getSupportedVirtualMachineLoginUserNamePropertyNames()) {
    sshUserVariable=context.getPropertyVariable(ubuntuNodeTemplate,userName);
    if (sshUserVariable == null) {
      sshUserVariable=context.getPropertyVariable(userName,true);
    }
 else {
      break;
    }
  }
  if (sshUserVariable == null) {
    return false;
  }
 else {
    if (Utils.isVariableValueEmpty(sshUserVariable,context)) {
      LOG.debug("String_Node_Str");
      context.addStringValueToPlanRequest(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMLOGINNAME);
      context.addAssignFromInput2VariableToMainAssign(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMLOGINNAME,sshUserVariable);
      sshUserVariable=null;
    }
  }
  Variable sshKeyVariable=null;
  for (  String passwordName : org.opentosca.model.tosca.conventions.Utils.getSupportedVirtualMachineLoginPasswordPropertyNames()) {
    sshKeyVariable=context.getPropertyVariable(ubuntuNodeTemplate,passwordName);
    if (sshKeyVariable == null) {
      sshKeyVariable=context.getPropertyVariable(passwordName,true);
    }
 else {
      break;
    }
  }
  if (sshKeyVariable == null) {
    return false;
  }
 else {
    if (Utils.isVariableValueEmpty(sshKeyVariable,context)) {
      LOG.debug("String_Node_Str");
      context.addStringValueToPlanRequest(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMLOGINPASSWORD);
      context.addAssignFromInput2VariableToMainAssign(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMLOGINPASSWORD,sshKeyVariable);
      sshKeyVariable=null;
    }
  }
  LOG.debug("String_Node_Str");
  context.addStringValueToPlanRequest("String_Node_Str");
  LOG.debug("String_Node_Str");
  context.addStringValueToPlanRequest("String_Node_Str");
  Map<String,Variable> createEC2InternalExternalPropsInput=new HashMap<String,Variable>();
  for (  String externalParameter : Handler.createVMInstanceExternalInputParams) {
    Variable variable=context.getPropertyVariable(ubuntuNodeTemplate,externalParameter);
    if (variable == null) {
      variable=context.getPropertyVariable(externalParameter,true);
    }
    if (externalParameter.equals("String_Node_Str") && ubuntuAMIIdVar != null) {
      createEC2InternalExternalPropsInput.put(externalParameter,ubuntuAMIIdVar);
      continue;
    }
    if (variable == null) {
      Handler.LOG.warn("String_Node_Str" + externalParameter);
      return false;
    }
 else {
      Handler.LOG.debug("String_Node_Str" + externalParameter);
    }
    if (Utils.isVariableValueEmpty(variable,context)) {
      Handler.LOG.debug("String_Node_Str");
      createEC2InternalExternalPropsInput.put(externalParameter,null);
    }
 else {
      createEC2InternalExternalPropsInput.put(externalParameter,variable);
    }
  }
  Map<String,Variable> createEC2InternalExternalPropsOutput=new HashMap<String,Variable>();
  createEC2InternalExternalPropsOutput.put(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMINSTANCEID,instanceIdPropWrapper);
  createEC2InternalExternalPropsOutput.put(Properties.OPENTOSCA_DECLARATIVE_PROPERTYNAME_VMIP,serverIpPropWrapper);
  context.addStringValueToPlanRequest("String_Node_Str");
  this.invokerOpPlugin.handle(context,cloudProviderNodeTemplate.getId(),true,Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_CLOUDPROVIDER_CREATEVM,Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_CLOUDPROVIDER,"String_Node_Str",createEC2InternalExternalPropsInput,createEC2InternalExternalPropsOutput,false);
  Map<String,Variable> startRequestInputParams=new HashMap<String,Variable>();
  Map<String,Variable> startRequestOutputParams=new HashMap<String,Variable>();
  startRequestInputParams.put("String_Node_Str",serverIpPropWrapper);
  startRequestInputParams.put("String_Node_Str",sshUserVariable);
  startRequestInputParams.put("String_Node_Str",sshKeyVariable);
  startRequestOutputParams.put("String_Node_Str",context.createGlobalStringVariable("String_Node_Str","String_Node_Str"));
  this.invokerOpPlugin.handle(context,ubuntuNodeTemplate.getId(),true,Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_WAITFORAVAIL,Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM,"String_Node_Str",startRequestInputParams,startRequestOutputParams,false);
  return true;
}