Program: 40974
Project: 40974
Buggy source:
/** 
 * Adds BPEL code to the given TemplateContext which installs an PhpModule to an Apache HTTP Server
 * @param templateContext the TemplateContext the code should be added to
 * @return true iff appending all BPEL code was successful
 */
public boolean handle(final TemplatePlanContext templateContext){
  if (templateContext.getNodeTemplate() == null) {
    Handler.LOG.warn("String_Node_Str");
    return false;
  }
  final AbstractNodeTemplate nodeTemplate=templateContext.getNodeTemplate();
  final Variable containerPortVar=templateContext.getPropertyVariable(nodeTemplate,"String_Node_Str");
  final Variable portVar=templateContext.getPropertyVariable(nodeTemplate,"String_Node_Str");
  if ((containerPortVar == null) | (portVar == null)) {
    Handler.LOG.error("String_Node_Str");
    return false;
  }
  final String containerPortVal=this.fetchValueFromProperty(nodeTemplate,"String_Node_Str");
  final String portVal=this.fetchValueFromProperty(nodeTemplate,"String_Node_Str");
  final String portMapping=containerPortVal + "String_Node_Str" + portVal;
  final Variable portMappingVar=templateContext.createGlobalStringVariable("String_Node_Str" + System.currentTimeMillis(),portMapping);
  final Variable sshPortVar=templateContext.getPropertyVariable(nodeTemplate,"String_Node_Str");
  final Variable containerIpVar=templateContext.getPropertyVariable(nodeTemplate,"String_Node_Str");
  Variable containerIdVar=templateContext.getPropertyVariable(nodeTemplate,"String_Node_Str");
  final AbstractNodeTemplate dockerEngineNode=this.getDockerEngineNode(nodeTemplate);
  if (dockerEngineNode == null) {
    Handler.LOG.error("String_Node_Str");
    return false;
  }
  final Variable dockerEngineUrlVar=templateContext.getPropertyVariable(dockerEngineNode,"String_Node_Str");
  final Variable containerImageVar=templateContext.getPropertyVariable(nodeTemplate,"String_Node_Str");
  if ((containerImageVar == null) || Utils.isVariableValueEmpty(containerImageVar,templateContext)) {
    final AbstractDeploymentArtifact da=this.fetchFirstDockerContainerDA(nodeTemplate);
    this.handleWithDA(templateContext,dockerEngineNode,da,portMappingVar,dockerEngineUrlVar,sshPortVar,containerIpVar,containerIdVar);
  }
 else {
    return this.handleWithImageId(templateContext,dockerEngineNode,containerImageVar,portMappingVar,dockerEngineUrlVar,sshPortVar,containerIpVar,containerIdVar);
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Adds BPEL code to the given TemplateContext which installs an PhpModule to an Apache HTTP Server
 * @param templateContext the TemplateContext the code should be added to
 * @return true iff appending all BPEL code was successful
 */
public boolean handle(final TemplatePlanContext templateContext){
  if (templateContext.getNodeTemplate() == null) {
    Handler.LOG.warn("String_Node_Str");
    return false;
  }
  final AbstractNodeTemplate nodeTemplate=templateContext.getNodeTemplate();
  final Variable containerPortVar=templateContext.getPropertyVariable(nodeTemplate,"String_Node_Str");
  final Variable portVar=templateContext.getPropertyVariable(nodeTemplate,"String_Node_Str");
  if ((containerPortVar == null) | (portVar == null)) {
    Handler.LOG.error("String_Node_Str");
    return false;
  }
  final Variable portMappingVar=templateContext.createGlobalStringVariable("String_Node_Str" + System.currentTimeMillis(),"String_Node_Str");
  try {
    Node assignContainerPortsNode=this.planBuilderFragments.createAssignXpathQueryToStringVarFragmentAsNode("String_Node_Str","String_Node_Str" + containerPortVar.getName() + "String_Node_Str"+ portVar.getName()+ "String_Node_Str",portMappingVar.getName());
    assignContainerPortsNode=templateContext.importNode(assignContainerPortsNode);
    templateContext.getProvisioningPhaseElement().appendChild(assignContainerPortsNode);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  SAXException e) {
    e.printStackTrace();
  }
  final Variable sshPortVar=templateContext.getPropertyVariable(nodeTemplate,"String_Node_Str");
  final Variable containerIpVar=templateContext.getPropertyVariable(nodeTemplate,"String_Node_Str");
  Variable containerIdVar=templateContext.getPropertyVariable(nodeTemplate,"String_Node_Str");
  final AbstractNodeTemplate dockerEngineNode=this.getDockerEngineNode(nodeTemplate);
  if (dockerEngineNode == null) {
    Handler.LOG.error("String_Node_Str");
    return false;
  }
  final Variable dockerEngineUrlVar=templateContext.getPropertyVariable(dockerEngineNode,"String_Node_Str");
  final Variable containerImageVar=templateContext.getPropertyVariable(nodeTemplate,"String_Node_Str");
  if ((containerImageVar == null) || Utils.isVariableValueEmpty(containerImageVar,templateContext)) {
    final AbstractDeploymentArtifact da=this.fetchFirstDockerContainerDA(nodeTemplate);
    this.handleWithDA(templateContext,dockerEngineNode,da,portMappingVar,dockerEngineUrlVar,sshPortVar,containerIpVar,containerIdVar);
  }
 else {
    return this.handleWithImageId(templateContext,dockerEngineNode,containerImageVar,portMappingVar,dockerEngineUrlVar,sshPortVar,containerIpVar,containerIdVar);
  }
  return true;
}