Program: 7644
Project: 7644
Buggy source:
/** 
 * Build the instance of   {@link BasicMapReduceContext}.
 * @param conf runtime configuration
 * @param runId program run id
 * @param logicalStartTime The logical start time of the job.
 * @param workflowBatch Tells whether the batch job is started by workflow.
 * @param tx transaction to use
 * @param classLoader classloader to use
 * @param programLocation program location
 * @param inputDataSetName name of the input dataset if specified for this mapreduce job, null otherwise
 * @param inputSplits input splits if specified for this mapreduce job, null otherwise
 * @param outputDataSetName name of the output dataset if specified for this mapreduce job, null otherwise
 * @return instance of {@link BasicMapReduceContext}
 */
public BasicMapReduceContext build(CConfiguration conf,MapReduceMetrics.TaskType type,String runId,long logicalStartTime,String workflowBatch,Arguments runtimeArguments,Transaction tx,ClassLoader classLoader,URI programLocation,@Nullable String inputDataSetName,@Nullable List<Split> inputSplits,@Nullable String outputDataSetName){
  Injector injector=createInjector();
  LocationFactory locationFactory=injector.getInstance(LocationFactory.class);
  Program program;
  try {
    program=loadProgram(programLocation,locationFactory);
    if (workflowBatch != null) {
      MapReduceSpecification mapReduceSpec=program.getSpecification().getMapReduce().get(workflowBatch);
      Preconditions.checkArgument(mapReduceSpec != null,"String_Node_Str",workflowBatch);
      program=new WorkflowMapReduceProgram(program,mapReduceSpec);
    }
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str" + programLocation);
    throw Throwables.propagate(e);
  }
  DataSetAccessor dataSetAccessor=injector.getInstance(DataSetAccessor.class);
  DataFabric dataFabric=new DataFabric2Impl(locationFactory,dataSetAccessor);
  DataSetInstantiator dataSetContext=new DataSetInstantiator(dataFabric,classLoader);
  dataSetContext.setDataSets(program.getSpecification().getDataSets().values());
  MetricsCollectionService metricsCollectionService=(type == null) ? null : injector.getInstance(MetricsCollectionService.class);
  Map<String,DataSet> dataSets=DataSets.createDataSets(dataSetContext,program.getSpecification().getDataSets().keySet());
  MapReduceSpecification spec=program.getSpecification().getMapReduce().get(program.getName());
  BasicMapReduceContext context=new BasicMapReduceContext(program,type,RunIds.fromString(runId),runtimeArguments,dataSets,spec,dataSetContext.getTransactionAware(),logicalStartTime,workflowBatch,metricsCollectionService);
  if (type == MapReduceMetrics.TaskType.Mapper) {
    dataSetContext.setMetricsCollector(context.getSystemMapperMetrics());
  }
 else   if (type == MapReduceMetrics.TaskType.Reducer) {
    dataSetContext.setMetricsCollector(context.getSystemReducerMetrics());
  }
  for (  TransactionAware txAware : dataSetContext.getTransactionAware()) {
    txAware.startTx(tx);
  }
  if (inputDataSetName != null && inputSplits != null) {
    context.setInput((BatchReadable)context.getDataSet(inputDataSetName),inputSplits);
  }
  if (outputDataSetName != null) {
    context.setOutput((BatchWritable)context.getDataSet(outputDataSetName));
  }
  LogAppenderInitializer logAppenderInitializer=injector.getInstance(LogAppenderInitializer.class);
  logAppenderInitializer.initialize();
  return context;
}

Fixed version (ground truth):
/** 
 * Build the instance of   {@link BasicMapReduceContext}.
 * @param conf runtime configuration
 * @param runId program run id
 * @param logicalStartTime The logical start time of the job.
 * @param workflowBatch Tells whether the batch job is started by workflow.
 * @param tx transaction to use
 * @param classLoader classloader to use
 * @param programLocation program location
 * @param inputDataSetName name of the input dataset if specified for this mapreduce job, null otherwise
 * @param inputSplits input splits if specified for this mapreduce job, null otherwise
 * @param outputDataSetName name of the output dataset if specified for this mapreduce job, null otherwise
 * @return instance of {@link BasicMapReduceContext}
 */
public BasicMapReduceContext build(CConfiguration conf,MapReduceMetrics.TaskType type,String runId,long logicalStartTime,String workflowBatch,Arguments runtimeArguments,Transaction tx,ClassLoader classLoader,URI programLocation,@Nullable String inputDataSetName,@Nullable List<Split> inputSplits,@Nullable String outputDataSetName){
  Injector injector=createInjector();
  LocationFactory locationFactory=injector.getInstance(LocationFactory.class);
  Program program;
  try {
    program=loadProgram(programLocation,locationFactory);
    if (workflowBatch != null) {
      MapReduceSpecification mapReduceSpec=program.getSpecification().getMapReduce().get(workflowBatch);
      Preconditions.checkArgument(mapReduceSpec != null,"String_Node_Str",workflowBatch);
      program=new WorkflowMapReduceProgram(program,mapReduceSpec);
    }
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str" + programLocation);
    throw Throwables.propagate(e);
  }
  DataSetAccessor dataSetAccessor=injector.getInstance(DataSetAccessor.class);
  DataFabric dataFabric=new DataFabric2Impl(locationFactory,dataSetAccessor);
  DataSetInstantiator dataSetContext=new DataSetInstantiator(dataFabric,classLoader);
  dataSetContext.setDataSets(program.getSpecification().getDataSets().values());
  MetricsCollectionService metricsCollectionService=(type == null) ? null : injector.getInstance(MetricsCollectionService.class);
  Map<String,DataSet> dataSets=DataSets.createDataSets(dataSetContext,program.getSpecification().getDataSets().keySet());
  MapReduceSpecification spec=program.getSpecification().getMapReduce().get(program.getName());
  BasicMapReduceContext context=new BasicMapReduceContext(program,type,RunIds.fromString(runId),runtimeArguments,dataSets,spec,dataSetContext.getTransactionAware(),logicalStartTime,workflowBatch,metricsCollectionService);
  if (type == MapReduceMetrics.TaskType.Mapper) {
    dataSetContext.setMetricsCollector(metricsCollectionService,context.getSystemMapperMetrics());
  }
 else   if (type == MapReduceMetrics.TaskType.Reducer) {
    dataSetContext.setMetricsCollector(metricsCollectionService,context.getSystemReducerMetrics());
  }
  for (  TransactionAware txAware : dataSetContext.getTransactionAware()) {
    txAware.startTx(tx);
  }
  if (inputDataSetName != null && inputSplits != null) {
    context.setInput((BatchReadable)context.getDataSet(inputDataSetName),inputSplits);
  }
  if (outputDataSetName != null) {
    context.setOutput((BatchWritable)context.getDataSet(outputDataSetName));
  }
  LogAppenderInitializer logAppenderInitializer=injector.getInstance(LogAppenderInitializer.class);
  logAppenderInitializer.initialize();
  return context;
}