Program: 116540
Project: 116540
Buggy source:
@Override public MemberContext startInstance(MemberContext memberContext) throws UnregisteredCartridgeException, InvalidIaasProviderException {
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  if (memberContext == null) {
    String msg="String_Node_Str";
    log.error(msg);
    throw new IllegalArgumentException(msg);
  }
  String clusterId=memberContext.getClusterId();
  Partition partition=memberContext.getPartition();
  if (log.isDebugEnabled()) {
    log.debug("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" + cartridgeType + "String_Node_Str"+ memberContext.toString();
    log.error(msg);
    throw new UnregisteredCartridgeException(msg);
  }
  memberContext.setCartridgeType(cartridgeType);
  IaasProvider iaasProvider=cartridge.getIaasProviderOfPartition(partitionId);
  if (iaasProvider == null) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + cartridge.hashCode() + "String_Node_Str"+ cartridgeType+ "String_Node_Str"+ partitionId);
    }
    String msg="String_Node_Str" + "String_Node_Str" + partitionId + "String_Node_Str"+ cartridgeType+ "String_Node_Str"+ "String_Node_Str"+ cartridge.getPartitionToIaasProvider().keySet().toString()+ "String_Node_Str"+ memberContext.toString()+ "String_Node_Str";
    log.fatal(msg);
    throw new InvalidIaasProviderException(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);
    if (memberContext.getProperties() != null) {
      org.apache.stratos.cloud.controller.pojo.Properties props1=memberContext.getProperties();
      if (props1 != null) {
        for (        Property prop : props1.getProperties()) {
          addToPayload(payload,prop.getName(),prop.getValue());
        }
      }
    }
    Iaas iaas=iaasProvider.getIaas();
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + payload.toString());
    }
    if (iaas == null) {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + type + "String_Node_Str");
      }
      try {
        iaas=CloudControllerUtil.getIaas(iaasProvider);
      }
 catch (      InvalidIaasProviderException e) {
        String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ type+ "String_Node_Str"+ e.getMessage();
        log.error(msg,e);
        throw new InvalidIaasProviderException(msg,e);
      }
    }
    if (ctxt.isVolumeRequired()) {
      if (ctxt.getVolumes() != null) {
        for (        Volume volume : ctxt.getVolumes()) {
          if (volume.getId() == null) {
            createVolumeAndSetInClusterContext(volume,iaasProvider);
          }
        }
      }
    }
    if (ctxt.isVolumeRequired()) {
      addToPayload(payload,"String_Node_Str",getPersistencePayload(ctxt,iaas).toString());
    }
    iaasProvider.setPayload(payload.toString().getBytes());
    iaas.setDynamicPayload();
    computeService=iaasProvider.getComputeService();
    template=iaasProvider.getTemplate();
    if (template == null) {
      String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ iaasProvider.getType();
      log.error(msg);
      throw new InvalidIaasProviderException(msg);
    }
    ThreadExecutor exec=ThreadExecutor.getInstance();
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    exec.execute(new JcloudsInstanceCreator(memberContext,iaasProvider,cartridgeType));
    log.info("String_Node_Str" + memberContext.toString());
    return memberContext;
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ e.getMessage();
    log.error(msg,e);
    throw new IllegalStateException(msg,e);
  }
}

Fixed version (ground truth):
@Override public MemberContext startInstance(MemberContext memberContext) throws UnregisteredCartridgeException, InvalidIaasProviderException {
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  if (memberContext == null) {
    String msg="String_Node_Str";
    log.error(msg);
    throw new IllegalArgumentException(msg);
  }
  String clusterId=memberContext.getClusterId();
  Partition partition=memberContext.getPartition();
  if (log.isDebugEnabled()) {
    log.debug("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" + cartridgeType + "String_Node_Str"+ memberContext.toString();
    log.error(msg);
    throw new UnregisteredCartridgeException(msg);
  }
  memberContext.setCartridgeType(cartridgeType);
  IaasProvider iaasProvider=cartridge.getIaasProviderOfPartition(partitionId);
  if (iaasProvider == null) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + cartridge.hashCode() + "String_Node_Str"+ cartridgeType+ "String_Node_Str"+ partitionId);
    }
    String msg="String_Node_Str" + "String_Node_Str" + partitionId + "String_Node_Str"+ cartridgeType+ "String_Node_Str"+ "String_Node_Str"+ cartridge.getPartitionToIaasProvider().keySet().toString()+ "String_Node_Str"+ memberContext.toString()+ "String_Node_Str";
    log.fatal(msg);
    throw new InvalidIaasProviderException(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);
    if (memberContext.getProperties() != null) {
      org.apache.stratos.cloud.controller.pojo.Properties props1=memberContext.getProperties();
      if (props1 != null) {
        for (        Property prop : props1.getProperties()) {
          addToPayload(payload,prop.getName(),prop.getValue());
        }
      }
    }
    Iaas iaas=iaasProvider.getIaas();
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + payload.toString());
    }
    if (iaas == null) {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + type + "String_Node_Str");
      }
      try {
        iaas=CloudControllerUtil.getIaas(iaasProvider);
      }
 catch (      InvalidIaasProviderException e) {
        String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ type+ "String_Node_Str"+ e.getMessage();
        log.error(msg,e);
        throw new InvalidIaasProviderException(msg,e);
      }
    }
    if (ctxt.isVolumeRequired()) {
      if (ctxt.getVolumes() != null) {
        for (        Volume volume : ctxt.getVolumes()) {
          if (volume.getId() == null) {
            createVolumeAndSetInClusterContext(volume,iaasProvider);
          }
        }
      }
    }
    if (ctxt.isVolumeRequired()) {
      addToPayload(payload,"String_Node_Str",getPersistencePayload(ctxt,iaas).toString());
    }
    iaasProvider.setPayload(payload.toString().getBytes());
    iaas.setDynamicPayload();
    template=iaasProvider.getTemplate();
    if (template == null) {
      String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ iaasProvider.getType();
      log.error(msg);
      throw new InvalidIaasProviderException(msg);
    }
    ThreadExecutor exec=ThreadExecutor.getInstance();
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    exec.execute(new JcloudsInstanceCreator(memberContext,iaasProvider,cartridgeType));
    log.info("String_Node_Str" + memberContext.toString());
    return memberContext;
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + memberContext.toString() + "String_Node_Str"+ e.getMessage();
    log.error(msg,e);
    throw new IllegalStateException(msg,e);
  }
}