Program: 4662
Project: 4662
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void run(Context context) throws IOException, InterruptedException {
  MapReduceClassLoader classLoader=MapReduceClassLoader.getFromConfiguration(context.getConfiguration());
  ClassLoader weakReferenceClassLoader=new WeakReferenceDelegatorClassLoader(classLoader);
  BasicMapReduceTaskContext basicMapReduceContext=classLoader.getTaskContextProvider().get(context);
  WrappedReducer.Context flushingContext=createAutoFlushingContext(context,basicMapReduceContext);
  basicMapReduceContext.setHadoopContext(flushingContext);
  String userReducer=context.getConfiguration().get(ATTR_REDUCER_CLASS);
  ClassLoader programClassLoader=classLoader.getProgramClassLoader();
  Reducer delegate=createReducerInstance(programClassLoader,userReducer);
  try {
    Reflections.visit(delegate,delegate.getClass(),new PropertyFieldSetter(basicMapReduceContext.getSpecification().getProperties()),new MetricsFieldSetter(basicMapReduceContext.getMetrics()),new DataSetFieldSetter(basicMapReduceContext));
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str",delegate.getClass(),t);
    throw Throwables.propagate(t);
  }
  ClassLoader oldClassLoader;
  if (delegate instanceof ProgramLifecycle) {
    oldClassLoader=ClassLoaders.setContextClassLoader(weakReferenceClassLoader);
    try {
      ((ProgramLifecycle)delegate).initialize(new MapReduceLifecycleContext(basicMapReduceContext));
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",basicMapReduceContext,e);
      throw Throwables.propagate(e);
    }
 finally {
      ClassLoaders.setContextClassLoader(oldClassLoader);
    }
  }
  oldClassLoader=ClassLoaders.setContextClassLoader(weakReferenceClassLoader);
  try {
    delegate.run(flushingContext);
  }
  finally {
    ClassLoaders.setContextClassLoader(oldClassLoader);
  }
  try {
    basicMapReduceContext.flushOperations();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + basicMapReduceContext,e);
    throw Throwables.propagate(e);
  }
  basicMapReduceContext.closeMultiOutputs();
  if (delegate instanceof ProgramLifecycle) {
    oldClassLoader=ClassLoaders.setContextClassLoader(weakReferenceClassLoader);
    try {
      ((ProgramLifecycle<? extends RuntimeContext>)delegate).destroy();
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",basicMapReduceContext,e);
    }
 finally {
      ClassLoaders.setContextClassLoader(oldClassLoader);
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void run(Context context) throws IOException, InterruptedException {
  MapReduceClassLoader classLoader=MapReduceClassLoader.getFromConfiguration(context.getConfiguration());
  ClassLoader weakReferenceClassLoader=new WeakReferenceDelegatorClassLoader(classLoader);
  BasicMapReduceTaskContext basicMapReduceContext=classLoader.getTaskContextProvider().get(context);
  long metricsReportInterval=basicMapReduceContext.getMetricsReportIntervalMillis();
  final ReduceTaskMetricsWriter reduceTaskMetricsWriter=new ReduceTaskMetricsWriter(basicMapReduceContext.getProgramMetrics(),context);
  WrappedReducer.Context flushingContext=createAutoFlushingContext(context,basicMapReduceContext,reduceTaskMetricsWriter);
  basicMapReduceContext.setHadoopContext(flushingContext);
  String userReducer=context.getConfiguration().get(ATTR_REDUCER_CLASS);
  ClassLoader programClassLoader=classLoader.getProgramClassLoader();
  Reducer delegate=createReducerInstance(programClassLoader,userReducer);
  try {
    Reflections.visit(delegate,delegate.getClass(),new PropertyFieldSetter(basicMapReduceContext.getSpecification().getProperties()),new MetricsFieldSetter(basicMapReduceContext.getMetrics()),new DataSetFieldSetter(basicMapReduceContext));
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str",delegate.getClass(),t);
    throw Throwables.propagate(t);
  }
  ClassLoader oldClassLoader;
  if (delegate instanceof ProgramLifecycle) {
    oldClassLoader=ClassLoaders.setContextClassLoader(weakReferenceClassLoader);
    try {
      ((ProgramLifecycle)delegate).initialize(new MapReduceLifecycleContext(basicMapReduceContext));
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",basicMapReduceContext,e);
      throw Throwables.propagate(e);
    }
 finally {
      ClassLoaders.setContextClassLoader(oldClassLoader);
    }
  }
  oldClassLoader=ClassLoaders.setContextClassLoader(weakReferenceClassLoader);
  try {
    delegate.run(flushingContext);
  }
  finally {
    ClassLoaders.setContextClassLoader(oldClassLoader);
  }
  try {
    basicMapReduceContext.flushOperations();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + basicMapReduceContext,e);
    throw Throwables.propagate(e);
  }
  basicMapReduceContext.closeMultiOutputs();
  if (delegate instanceof ProgramLifecycle) {
    oldClassLoader=ClassLoaders.setContextClassLoader(weakReferenceClassLoader);
    try {
      ((ProgramLifecycle<? extends RuntimeContext>)delegate).destroy();
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str",basicMapReduceContext,e);
    }
 finally {
      ClassLoaders.setContextClassLoader(oldClassLoader);
    }
  }
  reduceTaskMetricsWriter.reportMetrics();
}