Program: 116725
Project: 116725
Buggy source:
@Override public MemberContext startInstance(MemberContext memberContext) throws IllegalArgumentException, UnregisteredCartridgeException {
  if (memberContext == null) {
    String msg="String_Node_Str";
    log.error(msg);
    throw new IllegalArgumentException(msg);
  }
  String clusterId=memberContext.getClusterId();
  Partition partition=memberContext.getPartition();
  log.info("String_Node_Str" + memberContext.toString());
  ComputeService computeService=null;
  Template template=null;
  if (partition == null) {
    String msg="String_Node_Str" + memberContext.toString();
    log.error(msg);
    throw new IllegalArgumentException(msg);
  }
  String partitionId=partition.getId();
  ClusterContext ctxt=dataHolder.getClusterContext(clusterId);
  if (ctxt == null) {
    String msg="String_Node_Str" + memberContext.toString();
    log.error(msg);
    throw new IllegalArgumentException(msg);
  }
  String cartridgeType=ctxt.getCartridgeType();
  Cartridge cartridge=dataHolder.getCartridge(cartridgeType);
  if (cartridge == null) {
    String msg="String_Node_Str" + memberContext.toString();
    log.error(msg);
    throw new UnregisteredCartridgeException(msg);
  }
  memberContext.setCartridgeType(cartridgeType);
  IaasProvider iaasProvider=cartridge.getIaasProviderOfPartition(partitionId);
  if (iaasProvider == null) {
    String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ "String_Node_Str"+ partitionId+ "String_Node_Str"+ cartridgeType;
    log.fatal(msg);
    throw new CloudControllerException(msg);
  }
  String type=iaasProvider.getType();
  try {
    String memberID=generateMemberId(clusterId);
    memberContext.setMemberId(memberID);
    StringBuilder payload=new StringBuilder(ctxt.getPayload());
    addToPayload(payload,"String_Node_Str",memberID);
    addToPayload(payload,"String_Node_Str",memberContext.getLbClusterId());
    addToPayload(payload,"String_Node_Str",memberContext.getNetworkPartitionId());
    addToPayload(payload,"String_Node_Str",partitionId);
    StringBuilder persistancePayload=new StringBuilder();
    if (isPersistanceMappingAvailable(cartridge)) {
      int i=0;
      for (; i < cartridge.getPeristanceMappings().size() - 1; i++) {
        if (log.isDebugEnabled()) {
          log.debug("String_Node_Str" + cartridge.getPeristanceMappings().get(i).toString());
        }
        persistancePayload.append(cartridge.getPeristanceMappings().get(i).getDevice());
        persistancePayload.append("String_Node_Str");
      }
      persistancePayload.append(cartridge.getPeristanceMappings().get(i).getDevice());
    }
    addToPayload(payload,"String_Node_Str",persistancePayload.toString());
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + payload.toString());
    }
    iaasProvider.setPayload(payload.toString().getBytes());
    Iaas iaas=iaasProvider.getIaas();
    if (iaas == null) {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + type + "String_Node_Str");
      }
      try {
        iaas=setIaas(iaasProvider);
      }
 catch (      InvalidIaasProviderException e) {
        String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ type;
        log.error(msg,e);
        throw new CloudControllerException(msg,e);
      }
    }
    iaas.setDynamicPayload(iaasProvider);
    computeService=iaasProvider.getComputeService();
    template=iaasProvider.getTemplate();
    if (isPersistanceMappingAvailable(cartridge)) {
      Iterator<PersistanceMapping> it=cartridge.getPeristanceMappings().iterator();
      while (it.hasNext()) {
        PersistanceMapping maping=it.next();
        template.getOptions().as(EC2TemplateOptions.class).mapEBSSnapshotToDeviceName(maping.getDevice(),maping.getSnapshotId(),maping.getSize(),maping.isRemoveOntermination());
      }
    }
    if (template == null) {
      String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
      log.error(msg);
      throw new CloudControllerException(msg);
    }
    String str=clusterId.substring(0,10);
    String group=str.replaceAll("String_Node_Str","String_Node_Str");
    NodeMetadata node;
    Set<? extends NodeMetadata> nodes=computeService.createNodesInGroup(group,1,template);
    node=nodes.iterator().next();
    ThreadExecutor exec=ThreadExecutor.getInstance();
    exec.execute(new IpAllocator(memberContext,computeService,template,iaasProvider,cartridgeType,node));
    String nodeId=node.getId();
    if (nodeId == null) {
      String msg="String_Node_Str" + memberContext.toString();
      log.fatal(msg);
      throw new CloudControllerException(msg);
    }
    memberContext.setNodeId(nodeId);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + memberContext.toString());
    }
    log.info("String_Node_Str" + memberContext.toString());
    return memberContext;
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + memberContext.toString();
    log.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}

Fixed version (ground truth):
@Override public MemberContext startInstance(MemberContext memberContext) throws IllegalArgumentException, UnregisteredCartridgeException {
  if (memberContext == null) {
    String msg="String_Node_Str";
    log.error(msg);
    throw new IllegalArgumentException(msg);
  }
  String clusterId=memberContext.getClusterId();
  Partition partition=memberContext.getPartition();
  log.info("String_Node_Str" + memberContext.toString());
  ComputeService computeService=null;
  Template template=null;
  if (partition == null) {
    String msg="String_Node_Str" + memberContext.toString();
    log.error(msg);
    throw new IllegalArgumentException(msg);
  }
  String partitionId=partition.getId();
  ClusterContext ctxt=dataHolder.getClusterContext(clusterId);
  if (ctxt == null) {
    String msg="String_Node_Str" + memberContext.toString();
    log.error(msg);
    throw new IllegalArgumentException(msg);
  }
  String cartridgeType=ctxt.getCartridgeType();
  Cartridge cartridge=dataHolder.getCartridge(cartridgeType);
  if (cartridge == null) {
    String msg="String_Node_Str" + memberContext.toString();
    log.error(msg);
    throw new UnregisteredCartridgeException(msg);
  }
  memberContext.setCartridgeType(cartridgeType);
  IaasProvider iaasProvider=cartridge.getIaasProviderOfPartition(partitionId);
  if (iaasProvider == null) {
    String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ "String_Node_Str"+ partitionId+ "String_Node_Str"+ cartridgeType+ "String_Node_Str"+ "String_Node_Str"+ cartridge.getPartitionToIaasProvider().keySet().toString();
    log.fatal(msg);
    throw new CloudControllerException(msg);
  }
  String type=iaasProvider.getType();
  try {
    String memberID=generateMemberId(clusterId);
    memberContext.setMemberId(memberID);
    StringBuilder payload=new StringBuilder(ctxt.getPayload());
    addToPayload(payload,"String_Node_Str",memberID);
    addToPayload(payload,"String_Node_Str",memberContext.getLbClusterId());
    addToPayload(payload,"String_Node_Str",memberContext.getNetworkPartitionId());
    addToPayload(payload,"String_Node_Str",partitionId);
    StringBuilder persistancePayload=new StringBuilder();
    if (isPersistanceMappingAvailable(cartridge)) {
      int i=0;
      for (; i < cartridge.getPeristanceMappings().size() - 1; i++) {
        if (log.isDebugEnabled()) {
          log.debug("String_Node_Str" + cartridge.getPeristanceMappings().get(i).toString());
        }
        persistancePayload.append(cartridge.getPeristanceMappings().get(i).getDevice());
        persistancePayload.append("String_Node_Str");
      }
      persistancePayload.append(cartridge.getPeristanceMappings().get(i).getDevice());
    }
    addToPayload(payload,"String_Node_Str",persistancePayload.toString());
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + payload.toString());
    }
    iaasProvider.setPayload(payload.toString().getBytes());
    Iaas iaas=iaasProvider.getIaas();
    if (iaas == null) {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + type + "String_Node_Str");
      }
      try {
        iaas=setIaas(iaasProvider);
      }
 catch (      InvalidIaasProviderException e) {
        String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ type;
        log.error(msg,e);
        throw new CloudControllerException(msg,e);
      }
    }
    iaas.setDynamicPayload(iaasProvider);
    computeService=iaasProvider.getComputeService();
    template=iaasProvider.getTemplate();
    if (isPersistanceMappingAvailable(cartridge)) {
      Iterator<PersistanceMapping> it=cartridge.getPeristanceMappings().iterator();
      while (it.hasNext()) {
        PersistanceMapping maping=it.next();
        template.getOptions().as(EC2TemplateOptions.class).mapEBSSnapshotToDeviceName(maping.getDevice(),maping.getSnapshotId(),maping.getSize(),maping.isRemoveOntermination());
      }
    }
    if (template == null) {
      String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
      log.error(msg);
      throw new CloudControllerException(msg);
    }
    String str=clusterId.length() > 10 ? clusterId.substring(0,10) : clusterId.substring(0,clusterId.length());
    String group=str.replaceAll("String_Node_Str","String_Node_Str");
    NodeMetadata node;
    Set<? extends NodeMetadata> nodes=computeService.createNodesInGroup(group,1,template);
    node=nodes.iterator().next();
    ThreadExecutor exec=ThreadExecutor.getInstance();
    exec.execute(new IpAllocator(memberContext,iaasProvider,cartridgeType,node));
    String nodeId=node.getId();
    if (nodeId == null) {
      String msg="String_Node_Str" + memberContext.toString();
      log.fatal(msg);
      throw new CloudControllerException(msg);
    }
    memberContext.setNodeId(nodeId);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + memberContext.toString());
    }
    log.info("String_Node_Str" + memberContext.toString());
    return memberContext;
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + memberContext.toString();
    log.error(msg,e);
    throw new CloudControllerException(msg,e);
  }
}