nus-yam/ex-repair huggingface dataset:
Program: 55153
Project: 55153
Buggy source:
public static Configuration getConfigForFile(long bytes) throws IOException {
  final String filePath=createTempFile(bytes);
  final Configuration config=new Configuration();
  config.setString(FileInputFormat.FILE_PARAMETER_KEY,"String_Node_Str" + filePath);
  return config;
}

Fixed version (ground truth):
public static Configuration getConfigForFile(long bytes) throws IOException {
  final String filePath=createTempFile(bytes);
  final Configuration config=new Configuration();
  config.setString(FileInputFormat.FILE_PARAMETER_KEY,filePath);
  return config;
}
Program: 55154
Project: 55154
Buggy source:
public static String createTempFile(String contents) throws IOException {
  File f=File.createTempFile(FILE_PREFIX,FILE_SUFFIX);
  f.deleteOnExit();
  BufferedWriter out=new BufferedWriter(new FileWriter(f));
  try {
    out.write(contents);
  }
  finally {
    out.close();
  }
  return f.getAbsolutePath();
}

Fixed version (ground truth):
public static String createTempFile(String contents) throws IOException {
  File f=File.createTempFile(FILE_PREFIX,FILE_SUFFIX);
  f.deleteOnExit();
  BufferedWriter out=new BufferedWriter(new FileWriter(f));
  try {
    out.write(contents);
  }
  finally {
    out.close();
  }
  return f.toURI().toString();
}
Program: 55155
Project: 55155
Buggy source:
public static Configuration getConfigForDir(long... bytes) throws IOException {
  final String filePath=createTempFileDir(bytes);
  final Configuration config=new Configuration();
  config.setString(FileInputFormat.FILE_PARAMETER_KEY,"String_Node_Str" + filePath);
  return config;
}

Fixed version (ground truth):
public static Configuration getConfigForDir(long... bytes) throws IOException {
  final String filePath=createTempFileDir(bytes);
  final Configuration config=new Configuration();
  config.setString(FileInputFormat.FILE_PARAMETER_KEY,filePath);
  return config;
}
Program: 55156
Project: 55156
Buggy source:
@Test public void testNumSamplesOneFile(){
  try {
    final String tempFile=TestFileUtils.createTempFile(TEST_DATA1);
    final Configuration conf=new Configuration();
    conf.setString(FileInputFormat.FILE_PARAMETER_KEY,"String_Node_Str" + tempFile);
    final TestDelimitedInputFormat format=new TestDelimitedInputFormat();
    format.configure(conf);
    TestFileSystem.resetStreamOpenCounter();
    format.getStatistics(null);
    Assert.assertEquals("String_Node_Str",DEFAULT_NUM_SAMPLES,TestFileSystem.getNumtimeStreamOpened());
    conf.setString(TestDelimitedInputFormat.NUM_STATISTICS_SAMPLES,"String_Node_Str");
    final TestDelimitedInputFormat format2=new TestDelimitedInputFormat();
    format2.configure(conf);
    TestFileSystem.resetStreamOpenCounter();
    format2.getStatistics(null);
    Assert.assertEquals("String_Node_Str",8,TestFileSystem.getNumtimeStreamOpened());
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testNumSamplesOneFile(){
  try {
    final String tempFile=TestFileUtils.createTempFile(TEST_DATA1);
    final Configuration conf=new Configuration();
    conf.setString(FileInputFormat.FILE_PARAMETER_KEY,tempFile.replace("String_Node_Str","String_Node_Str"));
    final TestDelimitedInputFormat format=new TestDelimitedInputFormat();
    format.configure(conf);
    TestFileSystem.resetStreamOpenCounter();
    format.getStatistics(null);
    Assert.assertEquals("String_Node_Str",DEFAULT_NUM_SAMPLES,TestFileSystem.getNumtimeStreamOpened());
    conf.setString(TestDelimitedInputFormat.NUM_STATISTICS_SAMPLES,"String_Node_Str");
    final TestDelimitedInputFormat format2=new TestDelimitedInputFormat();
    format2.configure(conf);
    TestFileSystem.resetStreamOpenCounter();
    format2.getStatistics(null);
    Assert.assertEquals("String_Node_Str",8,TestFileSystem.getNumtimeStreamOpened());
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
}
Program: 55157
Project: 55157
Buggy source:
@Test public void testSamplingDirectory(){
  try {
    final String tempFile=TestFileUtils.createTempFileDir(TEST_DATA1,TEST_DATA2);
    final Configuration conf=new Configuration();
    conf.setString(FileInputFormat.FILE_PARAMETER_KEY,"String_Node_Str" + tempFile);
    final TestDelimitedInputFormat format=new TestDelimitedInputFormat();
    format.configure(conf);
    BaseStatistics stats=format.getStatistics(null);
    final int maxNumLines=(int)Math.ceil(TOTAL_SIZE / ((double)Math.min(TEST_DATA_1_LINEWIDTH,TEST_DATA_2_LINEWIDTH)));
    final int minNumLines=(int)(TOTAL_SIZE / ((double)Math.max(TEST_DATA_1_LINEWIDTH,TEST_DATA_2_LINEWIDTH)));
    final float maxAvgWidth=((float)(TOTAL_SIZE)) / minNumLines;
    final float minAvgWidth=((float)(TOTAL_SIZE)) / maxNumLines;
    if (!(stats.getNumberOfRecords() <= maxNumLines & stats.getNumberOfRecords() >= minNumLines)) {
      System.err.println("String_Node_Str" + stats.getNumberOfRecords() + "String_Node_Str"+ minNumLines+ "String_Node_Str"+ maxNumLines+ "String_Node_Str");
      Assert.fail("String_Node_Str");
    }
    if (!(stats.getAverageRecordWidth() <= maxAvgWidth & stats.getAverageRecordWidth() >= minAvgWidth)) {
      Assert.fail("String_Node_Str");
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testSamplingDirectory(){
  try {
    final String tempFile=TestFileUtils.createTempFileDir(TEST_DATA1,TEST_DATA2);
    final Configuration conf=new Configuration();
    conf.setString(FileInputFormat.FILE_PARAMETER_KEY,tempFile);
    final TestDelimitedInputFormat format=new TestDelimitedInputFormat();
    format.configure(conf);
    BaseStatistics stats=format.getStatistics(null);
    final int maxNumLines=(int)Math.ceil(TOTAL_SIZE / ((double)Math.min(TEST_DATA_1_LINEWIDTH,TEST_DATA_2_LINEWIDTH)));
    final int minNumLines=(int)(TOTAL_SIZE / ((double)Math.max(TEST_DATA_1_LINEWIDTH,TEST_DATA_2_LINEWIDTH)));
    final float maxAvgWidth=((float)(TOTAL_SIZE)) / minNumLines;
    final float minAvgWidth=((float)(TOTAL_SIZE)) / maxNumLines;
    if (!(stats.getNumberOfRecords() <= maxNumLines & stats.getNumberOfRecords() >= minNumLines)) {
      System.err.println("String_Node_Str" + stats.getNumberOfRecords() + "String_Node_Str"+ minNumLines+ "String_Node_Str"+ maxNumLines+ "String_Node_Str");
      Assert.fail("String_Node_Str");
    }
    if (!(stats.getAverageRecordWidth() <= maxAvgWidth & stats.getAverageRecordWidth() >= minAvgWidth)) {
      Assert.fail("String_Node_Str");
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
}
Program: 55158
Project: 55158
Buggy source:
@Test public void testNumSamplesMultipleFiles(){
  try {
    final String tempFile=TestFileUtils.createTempFileDir(TEST_DATA1,TEST_DATA1,TEST_DATA1,TEST_DATA1);
    final Configuration conf=new Configuration();
    conf.setString(FileInputFormat.FILE_PARAMETER_KEY,"String_Node_Str" + tempFile);
    final TestDelimitedInputFormat format=new TestDelimitedInputFormat();
    format.configure(conf);
    TestFileSystem.resetStreamOpenCounter();
    format.getStatistics(null);
    Assert.assertEquals("String_Node_Str",DEFAULT_NUM_SAMPLES,TestFileSystem.getNumtimeStreamOpened());
    conf.setString(TestDelimitedInputFormat.NUM_STATISTICS_SAMPLES,"String_Node_Str");
    final TestDelimitedInputFormat format2=new TestDelimitedInputFormat();
    format2.configure(conf);
    TestFileSystem.resetStreamOpenCounter();
    format2.getStatistics(null);
    Assert.assertEquals("String_Node_Str",8,TestFileSystem.getNumtimeStreamOpened());
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testNumSamplesMultipleFiles(){
  try {
    final String tempFile=TestFileUtils.createTempFileDir(TEST_DATA1,TEST_DATA1,TEST_DATA1,TEST_DATA1);
    final Configuration conf=new Configuration();
    conf.setString(FileInputFormat.FILE_PARAMETER_KEY,tempFile.replace("String_Node_Str","String_Node_Str"));
    final TestDelimitedInputFormat format=new TestDelimitedInputFormat();
    format.configure(conf);
    TestFileSystem.resetStreamOpenCounter();
    format.getStatistics(null);
    Assert.assertEquals("String_Node_Str",DEFAULT_NUM_SAMPLES,TestFileSystem.getNumtimeStreamOpened());
    conf.setString(TestDelimitedInputFormat.NUM_STATISTICS_SAMPLES,"String_Node_Str");
    final TestDelimitedInputFormat format2=new TestDelimitedInputFormat();
    format2.configure(conf);
    TestFileSystem.resetStreamOpenCounter();
    format2.getStatistics(null);
    Assert.assertEquals("String_Node_Str",8,TestFileSystem.getNumtimeStreamOpened());
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
}
Program: 55159
Project: 55159
Buggy source:
@Test public void testSamplingOverlyLongRecord(){
  try {
    final String tempFile=TestFileUtils.createTempFile(2 * PactConfigConstants.DEFAULT_DELIMITED_FORMAT_MAX_SAMPLE_LEN);
    final Configuration conf=new Configuration();
    conf.setString(FileInputFormat.FILE_PARAMETER_KEY,"String_Node_Str" + tempFile);
    final TestDelimitedInputFormat format=new TestDelimitedInputFormat();
    format.configure(conf);
    Assert.assertNull("String_Node_Str",format.getStatistics(null));
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testSamplingOverlyLongRecord(){
  try {
    final String tempFile=TestFileUtils.createTempFile(2 * PactConfigConstants.DEFAULT_DELIMITED_FORMAT_MAX_SAMPLE_LEN);
    final Configuration conf=new Configuration();
    conf.setString(FileInputFormat.FILE_PARAMETER_KEY,tempFile);
    final TestDelimitedInputFormat format=new TestDelimitedInputFormat();
    format.configure(conf);
    Assert.assertNull("String_Node_Str",format.getStatistics(null));
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
}
Program: 55160
Project: 55160
Buggy source:
@Test public void testSamplingOneFile(){
  try {
    final String tempFile=TestFileUtils.createTempFile(TEST_DATA1);
    final Configuration conf=new Configuration();
    conf.setString(FileInputFormat.FILE_PARAMETER_KEY,"String_Node_Str" + tempFile);
    final TestDelimitedInputFormat format=new TestDelimitedInputFormat();
    format.configure(conf);
    BaseStatistics stats=format.getStatistics(null);
    final int numLines=TEST_DATA_1_LINES;
    final float avgWidth=((float)TEST_DATA1.length()) / TEST_DATA_1_LINES;
    Assert.assertTrue("String_Node_Str",stats.getNumberOfRecords() < numLines + 1 & stats.getNumberOfRecords() > numLines - 1);
    Assert.assertTrue("String_Node_Str",stats.getAverageRecordWidth() < avgWidth + 1 & stats.getAverageRecordWidth() > avgWidth - 1);
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testSamplingOneFile(){
  try {
    final String tempFile=TestFileUtils.createTempFile(TEST_DATA1);
    final Configuration conf=new Configuration();
    conf.setString(FileInputFormat.FILE_PARAMETER_KEY,tempFile);
    final TestDelimitedInputFormat format=new TestDelimitedInputFormat();
    format.configure(conf);
    BaseStatistics stats=format.getStatistics(null);
    final int numLines=TEST_DATA_1_LINES;
    final float avgWidth=((float)TEST_DATA1.length()) / TEST_DATA_1_LINES;
    Assert.assertTrue("String_Node_Str",stats.getNumberOfRecords() < numLines + 1 & stats.getNumberOfRecords() > numLines - 1);
    Assert.assertTrue("String_Node_Str",stats.getAverageRecordWidth() < avgWidth + 1 & stats.getAverageRecordWidth() > avgWidth - 1);
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
}
Program: 55161
Project: 55161
Buggy source:
@Test public void testDifferentDelimiter(){
  try {
    final String DELIMITER="String_Node_Str";
    String testData=TEST_DATA1.replace("String_Node_Str",DELIMITER);
    final String tempFile=TestFileUtils.createTempFile(testData);
    final Configuration conf=new Configuration();
    conf.setString(FileInputFormat.FILE_PARAMETER_KEY,"String_Node_Str" + tempFile);
    conf.setString(TestDelimitedInputFormat.RECORD_DELIMITER,DELIMITER);
    final TestDelimitedInputFormat format=new TestDelimitedInputFormat();
    format.configure(conf);
    BaseStatistics stats=format.getStatistics(null);
    final int numLines=TEST_DATA_1_LINES;
    final float avgWidth=((float)testData.length()) / TEST_DATA_1_LINES;
    Assert.assertTrue("String_Node_Str",stats.getNumberOfRecords() < numLines + 1 & stats.getNumberOfRecords() > numLines - 1);
    Assert.assertTrue("String_Node_Str",stats.getAverageRecordWidth() < avgWidth + 1 & stats.getAverageRecordWidth() > avgWidth - 1);
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testDifferentDelimiter(){
  try {
    final String DELIMITER="String_Node_Str";
    String testData=TEST_DATA1.replace("String_Node_Str",DELIMITER);
    final String tempFile=TestFileUtils.createTempFile(testData);
    final Configuration conf=new Configuration();
    conf.setString(FileInputFormat.FILE_PARAMETER_KEY,tempFile);
    conf.setString(TestDelimitedInputFormat.RECORD_DELIMITER,DELIMITER);
    final TestDelimitedInputFormat format=new TestDelimitedInputFormat();
    format.configure(conf);
    BaseStatistics stats=format.getStatistics(null);
    final int numLines=TEST_DATA_1_LINES;
    final float avgWidth=((float)testData.length()) / TEST_DATA_1_LINES;
    Assert.assertTrue("String_Node_Str",stats.getNumberOfRecords() < numLines + 1 & stats.getNumberOfRecords() > numLines - 1);
    Assert.assertTrue("String_Node_Str",stats.getAverageRecordWidth() < avgWidth + 1 & stats.getAverageRecordWidth() > avgWidth - 1);
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
  }
}
Program: 55162
Project: 55162
Buggy source:
private FileInputSplit createTempFile(String contents) throws IOException {
  this.tempFile=File.createTempFile("String_Node_Str","String_Node_Str");
  OutputStreamWriter wrt=new OutputStreamWriter(new FileOutputStream(this.tempFile));
  wrt.write(contents);
  wrt.close();
  return new FileInputSplit(0,new Path("String_Node_Str" + this.tempFile.getAbsolutePath()),0,this.tempFile.length(),new String[]{"String_Node_Str"});
}

Fixed version (ground truth):
private FileInputSplit createTempFile(String contents) throws IOException {
  this.tempFile=File.createTempFile("String_Node_Str","String_Node_Str");
  OutputStreamWriter wrt=new OutputStreamWriter(new FileOutputStream(this.tempFile));
  wrt.write(contents);
  wrt.close();
  return new FileInputSplit(0,new Path(this.tempFile.toURI().toString()),0,this.tempFile.length(),new String[]{"String_Node_Str"});
}
Program: 55163
Project: 55163
Buggy source:
/** 
 * Write out the tuples in a temporary file and return it.
 */
@Before public void writeTuples() throws IOException {
  this.tempFile=File.createTempFile("String_Node_Str",null);
  this.tempFile.deleteOnExit();
  Configuration configuration=new Configuration();
  configuration.setLong(BinaryOutputFormat.BLOCK_SIZE_PARAMETER_KEY,this.blockSize);
  if (this.degreeOfParallelism == 1) {
    SequentialOutputFormat output=FormatUtil.openOutput(SequentialOutputFormat.class,"String_Node_Str" + this.tempFile.getAbsolutePath(),configuration);
    for (int index=0; index < this.numberOfTuples; index++)     output.writeRecord(this.getRecord(index));
    output.close();
  }
 else {
    this.tempFile.delete();
    this.tempFile.mkdir();
    int recordIndex=0;
    for (int fileIndex=0; fileIndex < this.degreeOfParallelism; fileIndex++) {
      SequentialOutputFormat output=FormatUtil.openOutput(SequentialOutputFormat.class,"String_Node_Str" + this.tempFile.getAbsolutePath() + "String_Node_Str"+ (fileIndex + 1),configuration);
      for (int fileCount=0; fileCount < this.getNumberOfTuplesPerFile(fileIndex); fileCount++, recordIndex++)       output.writeRecord(this.getRecord(recordIndex));
      output.close();
    }
  }
}

Fixed version (ground truth):
/** 
 * Write out the tuples in a temporary file and return it.
 */
@Before public void writeTuples() throws IOException {
  this.tempFile=File.createTempFile("String_Node_Str",null);
  this.tempFile.deleteOnExit();
  Configuration configuration=new Configuration();
  configuration.setLong(BinaryOutputFormat.BLOCK_SIZE_PARAMETER_KEY,this.blockSize);
  if (this.degreeOfParallelism == 1) {
    SequentialOutputFormat output=FormatUtil.openOutput(SequentialOutputFormat.class,this.tempFile.toURI().toString(),configuration);
    for (int index=0; index < this.numberOfTuples; index++)     output.writeRecord(this.getRecord(index));
    output.close();
  }
 else {
    this.tempFile.delete();
    this.tempFile.mkdir();
    int recordIndex=0;
    for (int fileIndex=0; fileIndex < this.degreeOfParallelism; fileIndex++) {
      SequentialOutputFormat output=FormatUtil.openOutput(SequentialOutputFormat.class,this.tempFile.toURI() + "String_Node_Str" + (fileIndex + 1),configuration);
      for (int fileCount=0; fileCount < this.getNumberOfTuplesPerFile(fileIndex); fileCount++, recordIndex++)       output.writeRecord(this.getRecord(recordIndex));
      output.close();
    }
  }
}
Program: 55164
Project: 55164
Buggy source:
protected SequentialInputFormat<PactRecord> createInputFormat(){
  Configuration configuration=new Configuration();
  configuration.setString(FileInputFormat.FILE_PARAMETER_KEY,"String_Node_Str" + this.tempFile.getAbsolutePath());
  configuration.setLong(BinaryInputFormat.BLOCK_SIZE_PARAMETER_KEY,this.blockSize);
  final SequentialInputFormat<PactRecord> inputFormat=new SequentialInputFormat<PactRecord>();
  inputFormat.configure(configuration);
  return inputFormat;
}

Fixed version (ground truth):
protected SequentialInputFormat<PactRecord> createInputFormat(){
  Configuration configuration=new Configuration();
  configuration.setString(FileInputFormat.FILE_PARAMETER_KEY,this.tempFile.toURI().toString());
  configuration.setLong(BinaryInputFormat.BLOCK_SIZE_PARAMETER_KEY,this.blockSize);
  final SequentialInputFormat<PactRecord> inputFormat=new SequentialInputFormat<PactRecord>();
  inputFormat.configure(configuration);
  return inputFormat;
}
Program: 55166
Project: 55166
Buggy source:
public static Object readObjectFormConfig(Configuration config,String key) throws IOException, ClassNotFoundException {
  byte[] bytes=config.getBytes(key,null);
  if (bytes == null) {
    return null;
  }
  ObjectInputStream oois=null;
  try {
    oois=new ObjectInputStream(new ByteArrayInputStream(bytes));
    return oois.readObject();
  }
  finally {
    if (oois != null) {
      oois.close();
    }
  }
}

Fixed version (ground truth):
public static Object readObjectFormConfig(Configuration config,String key,ClassLoader cl) throws IOException, ClassNotFoundException {
  byte[] bytes=config.getBytes(key,null);
  if (bytes == null) {
    return null;
  }
  ObjectInputStream oois=null;
  try {
    oois=new ClassLoaderObjectInputStream(new ByteArrayInputStream(bytes),cl);
    return oois.readObject();
  }
  finally {
    if (oois != null) {
      oois.close();
    }
  }
}
Program: 55167
Project: 55167
Buggy source:
/** 
 * Initializes the OutputFormat implementation and configuration.
 * @throws RuntimeException Throws if instance of OutputFormat implementation can not be obtained.
 */
@SuppressWarnings("String_Node_Str") private void initOutputFormat(){
  if (this.userCodeClassLoader == null) {
    try {
      this.userCodeClassLoader=LibraryCacheManager.getClassLoader(getEnvironment().getJobID());
    }
 catch (    IOException ioe) {
      throw new RuntimeException("String_Node_Str",ioe);
    }
  }
  Configuration taskConf=getTaskConfiguration();
  taskConf.setClassLoader(this.userCodeClassLoader);
  this.config=new TaskConfig(taskConf);
  try {
    this.format=(OutputFormat<IT>)this.config.getStubWrapper().getUserCodeObject();
    if (!OutputFormat.class.isAssignableFrom(this.format.getClass())) {
      throw new RuntimeException("String_Node_Str" + this.format.getClass().getName() + "String_Node_Str"+ OutputFormat.class.getName()+ "String_Node_Str");
    }
  }
 catch (  ClassCastException ccex) {
    throw new RuntimeException("String_Node_Str" + OutputFormat.class.getName(),ccex);
  }
  try {
    this.format.configure(this.config.getStubParameters());
  }
 catch (  Throwable t) {
    throw new RuntimeException("String_Node_Str" + t.getMessage(),t);
  }
}

Fixed version (ground truth):
/** 
 * Initializes the OutputFormat implementation and configuration.
 * @throws RuntimeException Throws if instance of OutputFormat implementation can not be obtained.
 */
private void initOutputFormat(){
  if (this.userCodeClassLoader == null) {
    try {
      this.userCodeClassLoader=LibraryCacheManager.getClassLoader(getEnvironment().getJobID());
    }
 catch (    IOException ioe) {
      throw new RuntimeException("String_Node_Str",ioe);
    }
  }
  Configuration taskConf=getTaskConfiguration();
  taskConf.setClassLoader(this.userCodeClassLoader);
  this.config=new TaskConfig(taskConf);
  try {
    this.format=config.<OutputFormat<IT>>getStubWrapper(this.userCodeClassLoader).getUserCodeObject(OutputFormat.class,this.userCodeClassLoader);
    if (!OutputFormat.class.isAssignableFrom(this.format.getClass())) {
      throw new RuntimeException("String_Node_Str" + this.format.getClass().getName() + "String_Node_Str"+ OutputFormat.class.getName()+ "String_Node_Str");
    }
  }
 catch (  ClassCastException ccex) {
    throw new RuntimeException("String_Node_Str" + OutputFormat.class.getName(),ccex);
  }
  try {
    this.format.configure(this.config.getStubParameters());
  }
 catch (  Throwable t) {
    throw new RuntimeException("String_Node_Str" + t.getMessage(),t);
  }
}
Program: 55168
Project: 55168
Buggy source:
/** 
 * Initializes the Stub class implementation and configuration.
 * @throws RuntimeException Thrown, if the stub class could not be loaded, instantiated,or caused an exception while being configured.
 */
@SuppressWarnings("String_Node_Str") protected <T>T initStub(Class<? super T> stubSuperClass) throws Exception {
  try {
    T stub=(T)((UserCodeWrapper<T>)config.getStubWrapper()).getUserCodeObject(stubSuperClass,this.userCodeClassLoader);
    if (stubSuperClass != null && !stubSuperClass.isAssignableFrom(stub.getClass())) {
      throw new RuntimeException("String_Node_Str" + stub.getClass().getName() + "String_Node_Str"+ stubSuperClass.getName()+ "String_Node_Str");
    }
    return stub;
  }
 catch (  ClassCastException ccex) {
    throw new Exception("String_Node_Str" + stubSuperClass.getName(),ccex);
  }
}

Fixed version (ground truth):
/** 
 * Initializes the Stub class implementation and configuration.
 * @throws RuntimeException Thrown, if the stub class could not be loaded, instantiated,or caused an exception while being configured.
 */
protected S initStub(Class<? super S> stubSuperClass) throws Exception {
  try {
    S stub=config.<S>getStubWrapper(this.userCodeClassLoader).getUserCodeObject(stubSuperClass,this.userCodeClassLoader);
    if (stubSuperClass != null && !stubSuperClass.isAssignableFrom(stub.getClass())) {
      throw new RuntimeException("String_Node_Str" + stub.getClass().getName() + "String_Node_Str"+ stubSuperClass.getName()+ "String_Node_Str");
    }
    return stub;
  }
 catch (  ClassCastException ccex) {
    throw new Exception("String_Node_Str" + stubSuperClass.getName(),ccex);
  }
}
Program: 55169
Project: 55169
Buggy source:
/** 
 * Instantiates a user code class from is definition in the task configuration. The class is instantiated without arguments using the null-ary constructor. Instantiation will fail if this constructor does not exist or is not public.
 * @param < T > The generic type of the user code class.
 * @param config The task configuration containing the class description.
 * @param cl The class loader to be used to load the class.
 * @param superClass The super class that the user code class extends or implements, for type checking.
 * @return An instance of the user code class.
 */
@SuppressWarnings("String_Node_Str") public static <T>T instantiateUserCode(TaskConfig config,ClassLoader cl,Class<? super T> superClass){
  try {
    T stub=(T)((UserCodeWrapper<T>)config.getStubWrapper()).getUserCodeObject(superClass,cl);
    if (superClass != null && !superClass.isAssignableFrom(stub.getClass())) {
      throw new RuntimeException("String_Node_Str" + stub.getClass().getName() + "String_Node_Str"+ superClass.getName()+ "String_Node_Str");
    }
    return stub;
  }
 catch (  ClassCastException ccex) {
    throw new RuntimeException("String_Node_Str" + superClass.getName(),ccex);
  }
}

Fixed version (ground truth):
/** 
 * Instantiates a user code class from is definition in the task configuration. The class is instantiated without arguments using the null-ary constructor. Instantiation will fail if this constructor does not exist or is not public.
 * @param < T > The generic type of the user code class.
 * @param config The task configuration containing the class description.
 * @param cl The class loader to be used to load the class.
 * @param superClass The super class that the user code class extends or implements, for type checking.
 * @return An instance of the user code class.
 */
public static <T>T instantiateUserCode(TaskConfig config,ClassLoader cl,Class<? super T> superClass){
  try {
    T stub=config.<T>getStubWrapper(cl).getUserCodeObject(superClass,cl);
    if (superClass != null && !superClass.isAssignableFrom(stub.getClass())) {
      throw new RuntimeException("String_Node_Str" + stub.getClass().getName() + "String_Node_Str"+ superClass.getName()+ "String_Node_Str");
    }
    return stub;
  }
 catch (  ClassCastException ccex) {
    throw new RuntimeException("String_Node_Str" + superClass.getName(),ccex);
  }
}
Program: 55170
Project: 55170
Buggy source:
@SuppressWarnings("String_Node_Str") public <T>UserCodeWrapper<T> getStubWrapper(){
  try {
    return (UserCodeWrapper<T>)InstantiationUtil.readObjectFormConfig(this.config,STUB_OBJECT);
  }
 catch (  ClassNotFoundException e) {
    throw new CorruptConfigurationException("String_Node_Str" + e);
  }
catch (  IOException e) {
    throw new CorruptConfigurationException("String_Node_Str" + e);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public <T>UserCodeWrapper<T> getStubWrapper(ClassLoader cl){
  try {
    return (UserCodeWrapper<T>)InstantiationUtil.readObjectFormConfig(this.config,STUB_OBJECT,cl);
  }
 catch (  ClassNotFoundException e) {
    throw new CorruptConfigurationException("String_Node_Str" + e);
  }
catch (  IOException e) {
    throw new CorruptConfigurationException("String_Node_Str" + e);
  }
}
Program: 55171
Project: 55171
Buggy source:
public TaskConfig getHeadConfig(){
  return headConfig;
}

Fixed version (ground truth):
public TaskConfig getHeadConfig(){
  if (this.headConfig == null) {
    this.headConfig=new TaskConfig(new Configuration());
  }
  return headConfig;
}
Program: 55174
Project: 55174
Buggy source:
public void setHeadTask(JobTaskVertex headTask,TaskConfig headConfig){
  this.headTask=headTask;
  this.headFinalResultConfig=new TaskConfig(new Configuration());
  this.headConfig=headConfig;
}

Fixed version (ground truth):
public void setHeadTask(JobTaskVertex headTask,TaskConfig headConfig){
  this.headTask=headTask;
  this.headFinalResultConfig=new TaskConfig(new Configuration());
  if (this.headConfig != null) {
    headConfig.getConfiguration().addAll(this.headConfig.getConfiguration());
  }
  this.headConfig=headConfig;
}
Program: 55175
Project: 55175
Buggy source:
public static Object readObjectFormConfig(Configuration config,String key) throws IOException, ClassNotFoundException {
  byte[] bytes=config.getBytes(key,null);
  if (bytes == null) {
    return null;
  }
  ObjectInputStream oois=null;
  try {
    oois=new ObjectInputStream(new ByteArrayInputStream(bytes));
    return oois.readObject();
  }
  finally {
    if (oois != null) {
      oois.close();
    }
  }
}

Fixed version (ground truth):
public static Object readObjectFormConfig(Configuration config,String key,ClassLoader cl) throws IOException, ClassNotFoundException {
  byte[] bytes=config.getBytes(key,null);
  if (bytes == null) {
    return null;
  }
  ObjectInputStream oois=null;
  try {
    oois=new ClassLoaderObjectInputStream(new ByteArrayInputStream(bytes),cl);
    return oois.readObject();
  }
  finally {
    if (oois != null) {
      oois.close();
    }
  }
}
Program: 55176
Project: 55176
Buggy source:
/** 
 * Initializes the OutputFormat implementation and configuration.
 * @throws RuntimeException Throws if instance of OutputFormat implementation can not be obtained.
 */
@SuppressWarnings("String_Node_Str") private void initOutputFormat(){
  if (this.userCodeClassLoader == null) {
    try {
      this.userCodeClassLoader=LibraryCacheManager.getClassLoader(getEnvironment().getJobID());
    }
 catch (    IOException ioe) {
      throw new RuntimeException("String_Node_Str",ioe);
    }
  }
  Configuration taskConf=getTaskConfiguration();
  taskConf.setClassLoader(this.userCodeClassLoader);
  this.config=new TaskConfig(taskConf);
  try {
    this.format=(OutputFormat<IT>)this.config.getStubWrapper().getUserCodeObject();
    if (!OutputFormat.class.isAssignableFrom(this.format.getClass())) {
      throw new RuntimeException("String_Node_Str" + this.format.getClass().getName() + "String_Node_Str"+ OutputFormat.class.getName()+ "String_Node_Str");
    }
  }
 catch (  ClassCastException ccex) {
    throw new RuntimeException("String_Node_Str" + OutputFormat.class.getName(),ccex);
  }
  try {
    this.format.configure(this.config.getStubParameters());
  }
 catch (  Throwable t) {
    throw new RuntimeException("String_Node_Str" + t.getMessage(),t);
  }
}

Fixed version (ground truth):
/** 
 * Initializes the OutputFormat implementation and configuration.
 * @throws RuntimeException Throws if instance of OutputFormat implementation can not be obtained.
 */
private void initOutputFormat(){
  if (this.userCodeClassLoader == null) {
    try {
      this.userCodeClassLoader=LibraryCacheManager.getClassLoader(getEnvironment().getJobID());
    }
 catch (    IOException ioe) {
      throw new RuntimeException("String_Node_Str",ioe);
    }
  }
  Configuration taskConf=getTaskConfiguration();
  taskConf.setClassLoader(this.userCodeClassLoader);
  this.config=new TaskConfig(taskConf);
  try {
    this.format=config.<OutputFormat<IT>>getStubWrapper(this.userCodeClassLoader).getUserCodeObject(OutputFormat.class,this.userCodeClassLoader);
    if (!OutputFormat.class.isAssignableFrom(this.format.getClass())) {
      throw new RuntimeException("String_Node_Str" + this.format.getClass().getName() + "String_Node_Str"+ OutputFormat.class.getName()+ "String_Node_Str");
    }
  }
 catch (  ClassCastException ccex) {
    throw new RuntimeException("String_Node_Str" + OutputFormat.class.getName(),ccex);
  }
  try {
    this.format.configure(this.config.getStubParameters());
  }
 catch (  Throwable t) {
    throw new RuntimeException("String_Node_Str" + t.getMessage(),t);
  }
}
Program: 55177
Project: 55177
Buggy source:
/** 
 * Initializes the Stub class implementation and configuration.
 * @throws RuntimeException Thrown, if the stub class could not be loaded, instantiated,or caused an exception while being configured.
 */
@SuppressWarnings("String_Node_Str") protected <T>T initStub(Class<? super T> stubSuperClass) throws Exception {
  try {
    T stub=(T)((UserCodeWrapper<T>)config.getStubWrapper()).getUserCodeObject(stubSuperClass,this.userCodeClassLoader);
    if (stubSuperClass != null && !stubSuperClass.isAssignableFrom(stub.getClass())) {
      throw new RuntimeException("String_Node_Str" + stub.getClass().getName() + "String_Node_Str"+ stubSuperClass.getName()+ "String_Node_Str");
    }
    return stub;
  }
 catch (  ClassCastException ccex) {
    throw new Exception("String_Node_Str" + stubSuperClass.getName(),ccex);
  }
}

Fixed version (ground truth):
/** 
 * Initializes the Stub class implementation and configuration.
 * @throws RuntimeException Thrown, if the stub class could not be loaded, instantiated,or caused an exception while being configured.
 */
protected S initStub(Class<? super S> stubSuperClass) throws Exception {
  try {
    S stub=config.<S>getStubWrapper(this.userCodeClassLoader).getUserCodeObject(stubSuperClass,this.userCodeClassLoader);
    if (stubSuperClass != null && !stubSuperClass.isAssignableFrom(stub.getClass())) {
      throw new RuntimeException("String_Node_Str" + stub.getClass().getName() + "String_Node_Str"+ stubSuperClass.getName()+ "String_Node_Str");
    }
    return stub;
  }
 catch (  ClassCastException ccex) {
    throw new Exception("String_Node_Str" + stubSuperClass.getName(),ccex);
  }
}
Program: 55178
Project: 55178
Buggy source:
/** 
 * Instantiates a user code class from is definition in the task configuration. The class is instantiated without arguments using the null-ary constructor. Instantiation will fail if this constructor does not exist or is not public.
 * @param < T > The generic type of the user code class.
 * @param config The task configuration containing the class description.
 * @param cl The class loader to be used to load the class.
 * @param superClass The super class that the user code class extends or implements, for type checking.
 * @return An instance of the user code class.
 */
@SuppressWarnings("String_Node_Str") public static <T>T instantiateUserCode(TaskConfig config,ClassLoader cl,Class<? super T> superClass){
  try {
    T stub=(T)((UserCodeWrapper<T>)config.getStubWrapper()).getUserCodeObject(superClass,cl);
    if (superClass != null && !superClass.isAssignableFrom(stub.getClass())) {
      throw new RuntimeException("String_Node_Str" + stub.getClass().getName() + "String_Node_Str"+ superClass.getName()+ "String_Node_Str");
    }
    return stub;
  }
 catch (  ClassCastException ccex) {
    throw new RuntimeException("String_Node_Str" + superClass.getName(),ccex);
  }
}

Fixed version (ground truth):
/** 
 * Instantiates a user code class from is definition in the task configuration. The class is instantiated without arguments using the null-ary constructor. Instantiation will fail if this constructor does not exist or is not public.
 * @param < T > The generic type of the user code class.
 * @param config The task configuration containing the class description.
 * @param cl The class loader to be used to load the class.
 * @param superClass The super class that the user code class extends or implements, for type checking.
 * @return An instance of the user code class.
 */
public static <T>T instantiateUserCode(TaskConfig config,ClassLoader cl,Class<? super T> superClass){
  try {
    T stub=config.<T>getStubWrapper(cl).getUserCodeObject(superClass,cl);
    if (superClass != null && !superClass.isAssignableFrom(stub.getClass())) {
      throw new RuntimeException("String_Node_Str" + stub.getClass().getName() + "String_Node_Str"+ superClass.getName()+ "String_Node_Str");
    }
    return stub;
  }
 catch (  ClassCastException ccex) {
    throw new RuntimeException("String_Node_Str" + superClass.getName(),ccex);
  }
}
Program: 55179
Project: 55179
Buggy source:
@SuppressWarnings("String_Node_Str") public <T>UserCodeWrapper<T> getStubWrapper(){
  try {
    return (UserCodeWrapper<T>)InstantiationUtil.readObjectFormConfig(this.config,STUB_OBJECT);
  }
 catch (  ClassNotFoundException e) {
    throw new CorruptConfigurationException("String_Node_Str" + e);
  }
catch (  IOException e) {
    throw new CorruptConfigurationException("String_Node_Str" + e);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public <T>UserCodeWrapper<T> getStubWrapper(ClassLoader cl){
  try {
    return (UserCodeWrapper<T>)InstantiationUtil.readObjectFormConfig(this.config,STUB_OBJECT,cl);
  }
 catch (  ClassNotFoundException e) {
    throw new CorruptConfigurationException("String_Node_Str" + e);
  }
catch (  IOException e) {
    throw new CorruptConfigurationException("String_Node_Str" + e);
  }
}
Program: 55181
Project: 55181
Buggy source:
/** 
 * Opens the given stub using its   {@link Stub#open(Configuration)} method. If the open call producesan exception, a new exception with a standard error message is created, using the encountered exception as its cause.
 * @param stub The user code instance to be opened.
 * @param parameters The parameters supplied to the user code.
 * @throws Exception Thrown, if the user code's open method produces an exception.
 */
public static void openUserCode(Stub stub,Configuration parameters) throws Exception {
  try {
    stub.open(parameters);
  }
 catch (  Throwable t) {
    throw new Exception("String_Node_Str" + t.getMessage(),t);
  }
}

Fixed version (ground truth):
/** 
 * Opens the given stub using its   {@link Stub#open(Configuration)} method. If the open call producesan exception, a new exception with a standard error message is created, using the encountered exception as its cause.
 * @param stub The user code instance to be opened.
 * @param parameters The parameters supplied to the user code.
 * @throws Exception Thrown, if the user code's open method produces an exception.
 */
public static void openUserCode(Stub stub,Configuration parameters) throws Exception {
  try {
    stub.open(parameters);
  }
 catch (  Throwable t) {
    throw new Exception("String_Node_Str" + stub.getClass().toString() + "String_Node_Str"+ t.getMessage(),t);
  }
}
Program: 55182
Project: 55182
Buggy source:
/** 
 * Creates a new channel selector that uses the given strategy (broadcasting, partitioning, ...) and uses the supplied comparator to hash / compare records for partitioning them deterministically.
 * @param strategy The distribution strategy to be used.
 * @param comparator The comparator used to hash / compare the records.
 * @param distr The distribution pattern used in the case of a range partitioning.
 */
public PactRecordOutputEmitter(ShipStrategyType strategy,PactRecordComparator comparator,DataDistribution distr){
  if (strategy == null) {
    throw new NullPointerException();
  }
  this.strategy=strategy;
  this.comparator=comparator;
  this.distribution=distr;
switch (strategy) {
case FORWARD:
case PARTITION_HASH:
case PARTITION_LOCAL_HASH:
case PARTITION_RANGE:
    this.channels=new int[1];
  break;
case BROADCAST:
break;
default :
throw new IllegalArgumentException("String_Node_Str" + strategy.name());
}
if ((strategy == ShipStrategyType.PARTITION_RANGE) && distr == null) throw new NullPointerException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates a new channel selector that uses the given strategy (broadcasting, partitioning, ...) and uses the supplied comparator to hash / compare records for partitioning them deterministically.
 * @param strategy The distribution strategy to be used.
 * @param comparator The comparator used to hash / compare the records.
 * @param distr The distribution pattern used in the case of a range partitioning.
 */
public PactRecordOutputEmitter(ShipStrategyType strategy,PactRecordComparator comparator,DataDistribution distr){
  if (strategy == null) {
    throw new NullPointerException();
  }
  this.strategy=strategy;
  this.comparator=comparator;
  this.distribution=distr;
switch (strategy) {
case FORWARD:
case PARTITION_HASH:
case PARTITION_LOCAL_HASH:
case PARTITION_RANGE:
case PARTITION_RANDOM:
    this.channels=new int[1];
  break;
case BROADCAST:
break;
default :
throw new IllegalArgumentException("String_Node_Str" + strategy.name());
}
if ((strategy == ShipStrategyType.PARTITION_RANGE) && distr == null) throw new NullPointerException("String_Node_Str");
}
Program: 55183
Project: 55183
Buggy source:
public String getTempFilePath(String fileName) throws IOException {
  File baseDir=new File(System.getProperty("String_Node_Str"));
  File f=new File(baseDir,fileName);
  return "String_Node_Str" + f.getAbsolutePath();
}

Fixed version (ground truth):
public String getTempFilePath(String fileName) throws IOException {
  File f=createAndRegisterTempFile(fileName);
  return "String_Node_Str" + f.getAbsolutePath();
}
Program: 55184
Project: 55184
Buggy source:
public String createTempFile(String fileName,String contents) throws IOException {
  File baseDir=new File(System.getProperty("String_Node_Str"));
  File f=new File(baseDir,fileName);
  if (f.exists()) {
    deleteRecursively(f);
  }
  File parentToDelete=f;
  while (true) {
    File parent=parentToDelete.getParentFile();
    if (parent == null) {
      throw new IOException("String_Node_Str");
    }
    if (parent.equals(baseDir)) {
      break;
    }
    parentToDelete=parent;
  }
  Files.createParentDirs(f);
  Files.write(contents,f,Charsets.UTF_8);
  this.tempFiles.add(parentToDelete);
  return "String_Node_Str" + f.getAbsolutePath();
}

Fixed version (ground truth):
public String createTempFile(String fileName,String contents) throws IOException {
  File f=createAndRegisterTempFile(fileName);
  Files.write(contents,f,Charsets.UTF_8);
  return "String_Node_Str" + f.getAbsolutePath();
}
Program: 55185
Project: 55185
Buggy source:
public String getTempDirPath(String dirName) throws IOException {
  File baseDir=new File(System.getProperty("String_Node_Str"));
  File f=new File(baseDir,dirName);
  return "String_Node_Str" + f.getAbsolutePath();
}

Fixed version (ground truth):
public String getTempDirPath(String dirName) throws IOException {
  File f=createAndRegisterTempFile(dirName);
  return "String_Node_Str" + f.getAbsolutePath();
}
Program: 55187
Project: 55187
Buggy source:
@Override public void run() throws Exception {
  while (this.running && !terminationRequested()) {
    if (log.isInfoEnabled()) {
      log.info(formatLogString("String_Node_Str" + currentIteration() + "String_Node_Str"));
    }
    System.out.println(formatLogString("String_Node_Str" + currentIteration() + "String_Node_Str"));
    super.run();
    System.out.println(formatLogString("String_Node_Str" + currentIteration() + "String_Node_Str"));
    if (log.isInfoEnabled()) {
      log.info(formatLogString("String_Node_Str" + currentIteration() + "String_Node_Str"));
    }
    if (!terminationRequested()) {
      propagateEvent(EndOfSuperstepEvent.INSTANCE);
      incrementIterationCounter();
    }
 else {
      propagateEvent(TerminationEvent.INSTANCE);
    }
  }
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  while (this.running && !terminationRequested()) {
    if (log.isInfoEnabled()) {
      log.info(formatLogString("String_Node_Str" + currentIteration() + "String_Node_Str"));
    }
    super.run();
    if (log.isInfoEnabled()) {
      log.info(formatLogString("String_Node_Str" + currentIteration() + "String_Node_Str"));
    }
    if (!terminationRequested()) {
      propagateEvent(EndOfSuperstepEvent.INSTANCE);
      incrementIterationCounter();
    }
 else {
      propagateEvent(TerminationEvent.INSTANCE);
    }
  }
}
Program: 55189
Project: 55189
Buggy source:
private void compilePlanToJSON(List<DumpableNode<?>> nodes,PrintWriter writer){
  this.nodeIds=new HashMap<DumpableNode<?>,Integer>();
  this.nodeCnt=0;
  writer.print("String_Node_Str");
  for (int i=0; i < nodes.size(); i++) {
    visit(nodes.get(i),writer,i == 0);
  }
  writer.println("String_Node_Str");
}

Fixed version (ground truth):
private void compilePlanToJSON(List<DumpableNode<?>> nodes,PrintWriter writer){
  this.nodeIds=new HashMap<DumpableNode<?>,Integer>();
  this.nodeCnt=0;
  writer.print("String_Node_Str");
  for (int i=0; i < nodes.size(); i++) {
    visit(nodes.get(i),writer);
  }
  writer.println("String_Node_Str");
}
Program: 55191
Project: 55191
Buggy source:
@Before public void setup(){
  InetSocketAddress dummyAddr=new InetSocketAddress("String_Node_Str",12345);
  DataStatistics dataStats=new DataStatistics();
  dataStats.cacheBaseStatistics(new FileInputFormat.FileBaseStatistics(1000,128 * 1024 * 1024,8.0f),CACHE_KEY);
  this.compiler=new PactCompiler(dataStats,new DefaultCostEstimator(),dummyAddr);
  InstanceType iType=InstanceTypeFactory.construct("String_Node_Str",6,2,4096,100,0);
  HardwareDescription hDesc=HardwareDescriptionFactory.construct(2,4096 * 1024 * 1024,2000 * 1024 * 1024);
  this.instanceType=InstanceTypeDescriptionFactory.construct(iType,hDesc,defaultParallelism * 2);
}

Fixed version (ground truth):
@Before public void setup(){
  InetSocketAddress dummyAddr=new InetSocketAddress("String_Node_Str",12345);
  DataStatistics dataStats=new DataStatistics();
  dataStats.cacheBaseStatistics(new FileInputFormat.FileBaseStatistics(1000,128 * 1024 * 1024,8.0f),CACHE_KEY);
  this.compiler=new PactCompiler(dataStats,new DefaultCostEstimator(),dummyAddr);
  InstanceType iType=InstanceTypeFactory.construct("String_Node_Str",6,2,4096,100,0);
  HardwareDescription hDesc=HardwareDescriptionFactory.construct(2,4096 * 1024 * 1024,2000 * 1024 * 1024);
  this.instanceType=InstanceTypeDescriptionFactory.construct(iType,hDesc,DEFAULT_PARALLELISM * 2);
}
Program: 55196
Project: 55196
Buggy source:
/** 
 * This method tests the simple word count.
 */
@Test public void testWordCount(){
  WordCount wc=new WordCount();
  Plan p=wc.getPlan(String.valueOf(defaultParallelism),IN_FILE_1,OUT_FILE_1);
  OptimizedPlan plan=compile(p);
  SinkPlanNode sink=plan.getDataSinks().iterator().next();
  SingleInputPlanNode reducer=(SingleInputPlanNode)sink.getPredecessor();
  SingleInputPlanNode mapper=(SingleInputPlanNode)reducer.getPredecessor();
  Assert.assertEquals(ShipStrategyType.FORWARD,mapper.getInput().getShipStrategy());
  Assert.assertEquals(ShipStrategyType.PARTITION_HASH,reducer.getInput().getShipStrategy());
  Assert.assertEquals(ShipStrategyType.FORWARD,sink.getInput().getShipStrategy());
  Channel c=reducer.getInput();
  Assert.assertEquals(LocalStrategy.COMBININGSORT,c.getLocalStrategy());
  FieldList l=new FieldList(0);
  Assert.assertEquals(l,c.getShipStrategyKeys());
  Assert.assertEquals(l,c.getLocalStrategyKeys());
  Assert.assertTrue(Arrays.equals(c.getLocalStrategySortOrder(),reducer.getSortOrders()));
}

Fixed version (ground truth):
/** 
 * This method tests the simple word count.
 */
@Test public void testWordCount(){
  WordCount wc=new WordCount();
  Plan p=wc.getPlan(String.valueOf(DEFAULT_PARALLELISM),IN_FILE_1,OUT_FILE_1);
  OptimizedPlan plan=compile(p);
  SinkPlanNode sink=plan.getDataSinks().iterator().next();
  SingleInputPlanNode reducer=(SingleInputPlanNode)sink.getPredecessor();
  SingleInputPlanNode mapper=(SingleInputPlanNode)reducer.getPredecessor();
  Assert.assertEquals(ShipStrategyType.FORWARD,mapper.getInput().getShipStrategy());
  Assert.assertEquals(ShipStrategyType.PARTITION_HASH,reducer.getInput().getShipStrategy());
  Assert.assertEquals(ShipStrategyType.FORWARD,sink.getInput().getShipStrategy());
  Channel c=reducer.getInput();
  Assert.assertEquals(LocalStrategy.COMBININGSORT,c.getLocalStrategy());
  FieldList l=new FieldList(0);
  Assert.assertEquals(l,c.getShipStrategyKeys());
  Assert.assertEquals(l,c.getLocalStrategyKeys());
  Assert.assertTrue(Arrays.equals(c.getLocalStrategySortOrder(),reducer.getSortOrders()));
}