nus-yam/ex-repair huggingface dataset:
Program: 16769
Project: 16769
Buggy source:
/** 
 * Post initialization method. Initialize the HTTP client with the central service. 
 */
public void postInit(){
  logger.debug("String_Node_Str",tokenInformationEndpoint);
  ClientConfig config=new DefaultClientConfig();
  Client client=Client.create(config);
  authorizationService=client.resource(tokenInformationEndpoint);
}

Fixed version (ground truth):
/** 
 * Post initialization method. Initialize the HTTP client with the central service. 
 */
public void postInit(){
  logger.debug("String_Node_Str",tokenInformationEndpoint);
  ClientConfig config=new DefaultClientConfig();
  config.getSingletons().add(new JacksonProvider());
  Client client=Client.create(config);
  authorizationService=client.resource(tokenInformationEndpoint);
}
Program: 16770
Project: 16770
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Token obtainTokenInformation(String accessToken,String password){
  if (password == null || password.compareTo(auhorizationPassword) != 0) {
    throw new WebApplicationException(Status.FORBIDDEN);
  }
  logger.trace("String_Node_Str",accessToken);
  if (accessToken == null) {
    logger.debug("String_Node_Str");
    throw new IllegalArgumentException("String_Node_Str");
  }
  Token token=service.getTokenInformation(accessToken);
  logger.trace("String_Node_Str",token);
  return token;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Token obtainTokenInformation(String accessToken,String password){
  if (password == null || password.compareTo(authorizationPassword) != 0) {
    throw new WebApplicationException(Status.FORBIDDEN);
  }
  logger.trace("String_Node_Str",accessToken);
  if (accessToken == null) {
    logger.debug("String_Node_Str");
    throw new IllegalArgumentException("String_Node_Str");
  }
  Token token=service.getTokenInformation(accessToken);
  logger.trace("String_Node_Str",token);
  return token;
}
Program: 16771
Project: 16771
Buggy source:
@BeforeClass public static void setup() throws IOException {
  System.out.println("String_Node_Str");
  HipiImageBundle hib=createHibAndOpen(HipiImageBundle.FILE_MODE_WRITE,null);
  JpegCodec jpegCodec=JpegCodec.getInstance();
  File[] files=new File("String_Node_Str").listFiles();
  for (  File file : files) {
    String ext=FilenameUtils.getExtension(file.getName());
    if (file.isFile() && (ext.equalsIgnoreCase("String_Node_Str") || ext.equalsIgnoreCase("String_Node_Str"))) {
      String path=file.getPath();
      System.out.println("String_Node_Str" + path);
      HipiImageHeader imageHeader=jpegCodec.decodeHeader(new FileInputStream(path));
      imageHeader.addMetaData("String_Node_Str",path);
      System.out.println(imageHeader);
      hib.addImage(imageHeader,new FileInputStream(path));
    }
  }
  System.out.println("String_Node_Str");
  hib.close();
}

Fixed version (ground truth):
@BeforeClass public static void setup() throws IOException {
  System.out.println("String_Node_Str");
  HipiImageBundle hib=createHibAndOpen(HipiImageBundle.FILE_MODE_WRITE,null);
  JpegCodec jpegCodec=JpegCodec.getInstance();
  File[] files=new File("String_Node_Str").listFiles();
  Arrays.sort(files);
  for (  File file : files) {
    String ext=FilenameUtils.getExtension(file.getName());
    if (file.isFile() && (ext.equalsIgnoreCase("String_Node_Str") || ext.equalsIgnoreCase("String_Node_Str"))) {
      String path=file.getPath();
      System.out.println("String_Node_Str" + path);
      HipiImageHeader imageHeader=jpegCodec.decodeHeader(new FileInputStream(path));
      imageHeader.addMetaData("String_Node_Str",path);
      System.out.println(imageHeader);
      hib.addImage(imageHeader,new FileInputStream(path));
    }
  }
  System.out.println("String_Node_Str");
  hib.close();
}
Program: 16772
Project: 16772
Buggy source:
public int runCovariance(String[] args) throws Exception {
  Job job=HipiJob.getHipiJobInstance(getConf(),"String_Node_Str");
  job.setJarByClass(Covariance.class);
  job.addCacheFile(new URI("String_Node_Str" + args[1] + "String_Node_Str"));
  job.setOutputKeyClass(IntWritable.class);
  job.setOutputValueClass(FloatImage.class);
  job.setMapperClass(CovarianceMap.class);
  job.setCombinerClass(CovarianceReduce.class);
  job.setReducerClass(CovarianceReduce.class);
  String inputFileType=args[2];
  if (inputFileType.equals("String_Node_Str"))   job.setInputFormatClass(ImageBundleInputFormat.class);
 else {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  job.setOutputFormatClass(BinaryOutputFormat.class);
  job.setSpeculativeExecution(true);
  FileInputFormat.setInputPaths(job,new Path(args[0]));
  mkdir(args[1],job.getConfiguration());
  rmdir(args[1] + "String_Node_Str",job.getConfiguration());
  FileOutputFormat.setOutputPath(job,new Path(args[1] + "String_Node_Str"));
  boolean success=job.waitForCompletion(true);
  return success ? 0 : 1;
}

Fixed version (ground truth):
public int runCovariance(String[] args) throws Exception {
  Job job=HipiJob.getHipiJobInstance(getConf(),"String_Node_Str");
  job.setJarByClass(Covariance.class);
  job.addCacheFile(new URI("String_Node_Str" + args[1] + "String_Node_Str"));
  job.setOutputKeyClass(IntWritable.class);
  job.setOutputValueClass(FloatImage.class);
  job.setMapperClass(CovarianceMap.class);
  job.setCombinerClass(CovarianceReduce.class);
  job.setReducerClass(CovarianceReduce.class);
  String inputFileType=args[2];
  if (inputFileType.equals("String_Node_Str"))   job.setInputFormatClass(ImageBundleInputFormat.class);
 else {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  job.setOutputFormatClass(BinaryOutputFormat.class);
  job.getConfiguration().setBoolean("String_Node_Str",true);
  job.setSpeculativeExecution(true);
  FileInputFormat.setInputPaths(job,new Path(args[0]));
  mkdir(args[1],job.getConfiguration());
  rmdir(args[1] + "String_Node_Str",job.getConfiguration());
  FileOutputFormat.setOutputPath(job,new Path(args[1] + "String_Node_Str"));
  boolean success=job.waitForCompletion(true);
  return success ? 0 : 1;
}
Program: 16773
Project: 16773
Buggy source:
public int runMeanCompute(String[] args) throws Exception {
  Job job=HipiJob.getHipiJobInstance(getConf(),"String_Node_Str");
  job.setJarByClass(Covariance.class);
  job.setOutputKeyClass(IntWritable.class);
  job.setOutputValueClass(FloatImage.class);
  job.setMapperClass(MeanMap.class);
  job.setCombinerClass(MeanReduce.class);
  job.setReducerClass(MeanReduce.class);
  String inputFileType=args[2];
  if (inputFileType.equals("String_Node_Str"))   job.setInputFormatClass(ImageBundleInputFormat.class);
 else {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  job.setOutputFormatClass(BinaryOutputFormat.class);
  job.setMapSpeculativeExecution(true);
  job.setReduceSpeculativeExecution(true);
  FileInputFormat.setInputPaths(job,new Path(args[0]));
  mkdir(args[1],job.getConfiguration());
  rmdir(args[1] + "String_Node_Str",job.getConfiguration());
  FileOutputFormat.setOutputPath(job,new Path(args[1] + "String_Node_Str"));
  boolean success=job.waitForCompletion(true);
  return success ? 0 : 1;
}

Fixed version (ground truth):
public int runMeanCompute(String[] args) throws Exception {
  Job job=HipiJob.getHipiJobInstance(getConf(),"String_Node_Str");
  job.setJarByClass(Covariance.class);
  job.setOutputKeyClass(IntWritable.class);
  job.setOutputValueClass(FloatImage.class);
  job.setMapperClass(MeanMap.class);
  job.setCombinerClass(MeanReduce.class);
  job.setReducerClass(MeanReduce.class);
  String inputFileType=args[2];
  if (inputFileType.equals("String_Node_Str"))   job.setInputFormatClass(ImageBundleInputFormat.class);
 else {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  job.setOutputFormatClass(BinaryOutputFormat.class);
  job.getConfiguration().setBoolean("String_Node_Str",true);
  job.setSpeculativeExecution(true);
  FileInputFormat.setInputPaths(job,new Path(args[0]));
  mkdir(args[1],job.getConfiguration());
  rmdir(args[1] + "String_Node_Str",job.getConfiguration());
  FileOutputFormat.setOutputPath(job,new Path(args[1] + "String_Node_Str"));
  boolean success=job.waitForCompletion(true);
  return success ? 0 : 1;
}
Program: 16774
Project: 16774
Buggy source:
public int runCovariance(String[] args) throws Exception {
  Job job=HipiJob.getHipiJobInstance(getConf(),"String_Node_Str");
  job.setJarByClass(Covariance.class);
  job.addCacheFile(new URI("String_Node_Str" + args[1] + "String_Node_Str"));
  job.setOutputKeyClass(IntWritable.class);
  job.setOutputValueClass(FloatImage.class);
  job.setMapperClass(CovarianceMap.class);
  job.setCombinerClass(CovarianceReduce.class);
  job.setReducerClass(CovarianceReduce.class);
  String inputFileType=args[2];
  if (inputFileType.equals("String_Node_Str"))   job.setInputFormatClass(ImageBundleInputFormat.class);
 else {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  job.setOutputFormatClass(BinaryOutputFormat.class);
  job.getConfiguration().setBoolean("String_Node_Str",true);
  job.setSpeculativeExecution(true);
  FileInputFormat.setInputPaths(job,new Path(args[0]));
  mkdir(args[1],job.getConfiguration());
  rmdir(args[1] + "String_Node_Str",job.getConfiguration());
  FileOutputFormat.setOutputPath(job,new Path(args[1] + "String_Node_Str"));
  boolean success=job.waitForCompletion(true);
  return success ? 0 : 1;
}

Fixed version (ground truth):
public int runCovariance(String[] args) throws Exception {
  Job job=Job.getInstance();
  job.setJarByClass(Covariance.class);
  job.addCacheFile(new URI("String_Node_Str" + args[1] + "String_Node_Str"));
  job.setOutputKeyClass(IntWritable.class);
  job.setOutputValueClass(FloatImage.class);
  job.setMapperClass(CovarianceMap.class);
  job.setCombinerClass(CovarianceReduce.class);
  job.setReducerClass(CovarianceReduce.class);
  String inputFileType=args[2];
  if (inputFileType.equals("String_Node_Str"))   job.setInputFormatClass(ImageBundleInputFormat.class);
 else {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  job.setOutputFormatClass(BinaryOutputFormat.class);
  job.getConfiguration().setBoolean("String_Node_Str",true);
  job.setSpeculativeExecution(true);
  FileInputFormat.setInputPaths(job,new Path(args[0]));
  mkdir(args[1],job.getConfiguration());
  rmdir(args[1] + "String_Node_Str",job.getConfiguration());
  FileOutputFormat.setOutputPath(job,new Path(args[1] + "String_Node_Str"));
  boolean success=job.waitForCompletion(true);
  return success ? 0 : 1;
}
Program: 16775
Project: 16775
Buggy source:
@Test public void testGetCurrentImage() throws IOException {
  AbstractImageBundle aib=createImageBundleAndOpen(AbstractImageBundle.FILE_MODE_READ);
  ImageDecoder decoder=JPEGImageUtil.getInstance();
  int count=0;
  while (aib.hasNext()) {
    aib.next();
    FloatImage source=decoder.decodeImage(new FileInputStream("String_Node_Str" + count + "String_Node_Str"));
    FloatImage image=aib.getCurrentImage();
    assertArrayEquals(count + "String_Node_Str",source.getData(),image.getData(),1);
    image=aib.getCurrentImage();
    assertArrayEquals(count + "String_Node_Str",source.getData(),image.getData(),1);
    image=aib.getCurrentImage();
    assertArrayEquals(count + "String_Node_Str",source.getData(),image.getData(),1);
    count++;
  }
  aib.close();
}

Fixed version (ground truth):
@Test public void testGetCurrentImage() throws IOException {
  AbstractImageBundle aib=createImageBundleAndOpen(AbstractImageBundle.FILE_MODE_READ);
  ImageDecoder decoder=JPEGImageUtil.getInstance();
  int count=0;
  while (aib.hasNext()) {
    aib.next();
    FloatImage source=decoder.decodeImage(new FileInputStream("String_Node_Str" + count + "String_Node_Str"));
    FloatImage image=aib.getCurrentImage();
    assertEquals(count + "String_Node_Str",source,image);
    image=aib.getCurrentImage();
    assertEquals(count + "String_Node_Str",source,image);
    image=aib.getCurrentImage();
    assertEquals(count + "String_Node_Str",source,image);
    count++;
  }
  aib.close();
}
Program: 16776
Project: 16776
Buggy source:
@Test public void testNext() throws IOException {
  AbstractImageBundle aib=createImageBundleAndOpen(AbstractImageBundle.FILE_MODE_READ);
  ImageDecoder decoder=JPEGImageUtil.getInstance();
  aib.next();
  aib.next();
  FloatImage source=decoder.decodeImage(new FileInputStream("String_Node_Str"));
  FloatImage image=aib.getCurrentImage();
  assertArrayEquals("String_Node_Str",source.getData(),image.getData(),1);
  aib.close();
}

Fixed version (ground truth):
@Test public void testNext() throws IOException {
  AbstractImageBundle aib=createImageBundleAndOpen(AbstractImageBundle.FILE_MODE_READ);
  ImageDecoder decoder=JPEGImageUtil.getInstance();
  aib.next();
  aib.next();
  FloatImage source=decoder.decodeImage(new FileInputStream("String_Node_Str"));
  FloatImage image=aib.getCurrentImage();
  assertEquals("String_Node_Str",source,image);
  aib.close();
}
Program: 16777
Project: 16777
Buggy source:
@Test public void testHasNext() throws IOException {
  AbstractImageBundle aib=createImageBundleAndOpen(AbstractImageBundle.FILE_MODE_READ);
  FloatImage source, image;
  ImageDecoder decoder=JPEGImageUtil.getInstance();
  assertTrue("String_Node_Str",aib.hasNext());
  assertTrue("String_Node_Str",aib.hasNext());
  assertTrue("String_Node_Str",aib.hasNext());
  aib.next();
  source=decoder.decodeImage(new FileInputStream("String_Node_Str"));
  image=aib.getCurrentImage();
  assertArrayEquals("String_Node_Str",source.getData(),image.getData(),1);
  assertTrue("String_Node_Str",aib.hasNext());
  assertTrue("String_Node_Str",aib.hasNext());
  assertTrue("String_Node_Str",aib.hasNext());
  aib.next();
  source=decoder.decodeImage(new FileInputStream("String_Node_Str"));
  image=aib.getCurrentImage();
  assertArrayEquals("String_Node_Str",source.getData(),image.getData(),1);
  assertFalse("String_Node_Str",aib.hasNext());
  assertFalse("String_Node_Str",aib.hasNext());
  assertFalse("String_Node_Str",aib.hasNext());
  aib.close();
}

Fixed version (ground truth):
@Test public void testHasNext() throws IOException {
  AbstractImageBundle aib=createImageBundleAndOpen(AbstractImageBundle.FILE_MODE_READ);
  FloatImage source, image;
  ImageDecoder decoder=JPEGImageUtil.getInstance();
  assertTrue("String_Node_Str",aib.hasNext());
  assertTrue("String_Node_Str",aib.hasNext());
  assertTrue("String_Node_Str",aib.hasNext());
  aib.next();
  source=decoder.decodeImage(new FileInputStream("String_Node_Str"));
  image=aib.getCurrentImage();
  assertEquals("String_Node_Str",source,image);
  assertTrue("String_Node_Str",aib.hasNext());
  assertTrue("String_Node_Str",aib.hasNext());
  assertTrue("String_Node_Str",aib.hasNext());
  aib.next();
  source=decoder.decodeImage(new FileInputStream("String_Node_Str"));
  image=aib.getCurrentImage();
  assertEquals("String_Node_Str",source,image);
  assertFalse("String_Node_Str",aib.hasNext());
  assertFalse("String_Node_Str",aib.hasNext());
  assertFalse("String_Node_Str",aib.hasNext());
  aib.close();
}
Program: 16778
Project: 16778
Buggy source:
@Test public void testIterator() throws IOException {
  AbstractImageBundle aib=createImageBundleAndOpen(AbstractImageBundle.FILE_MODE_READ);
  ImageDecoder decoder=JPEGImageUtil.getInstance();
  int count=0;
  while (aib.hasNext()) {
    aib.next();
    FloatImage image=aib.getCurrentImage();
    FloatImage source=decoder.decodeImage(new FileInputStream("String_Node_Str" + count + "String_Node_Str"));
    assertArrayEquals(count + "String_Node_Str",source.getData(),image.getData(),1);
    count++;
  }
  aib.close();
}

Fixed version (ground truth):
@Test public void testIterator() throws IOException {
  AbstractImageBundle aib=createImageBundleAndOpen(AbstractImageBundle.FILE_MODE_READ);
  ImageDecoder decoder=JPEGImageUtil.getInstance();
  int count=0;
  while (aib.hasNext()) {
    aib.next();
    FloatImage image=aib.getCurrentImage();
    FloatImage source=decoder.decodeImage(new FileInputStream("String_Node_Str" + count + "String_Node_Str"));
    assertEquals(count + "String_Node_Str",source,image);
    count++;
  }
  aib.close();
}
Program: 16779
Project: 16779
Buggy source:
@Test public void testFloatImageWritable() throws IOException {
  ImageDecoder decoder=PPMImageUtil.getInstance();
  FileInputStream fis;
  String[] fileName={"String_Node_Str","String_Node_Str"};
  for (int i=0; i < fileName.length; i++) {
    fis=new FileInputStream("String_Node_Str" + fileName[i] + "String_Node_Str");
    FloatImage image=decoder.decodeImage(fis);
    ByteArrayOutputStream bos=new ByteArrayOutputStream();
    image.write(new DataOutputStream(bos));
    ByteArrayInputStream bis=new ByteArrayInputStream(bos.toByteArray());
    FloatImage newImage=new FloatImage();
    newImage.readFields(new DataInputStream(bis));
    assertArrayEquals(fileName[i] + "String_Node_Str",image.getData(),newImage.getData(),1);
  }
}

Fixed version (ground truth):
@Test public void testFloatImageWritable() throws IOException {
  ImageDecoder decoder=PPMImageUtil.getInstance();
  FileInputStream fis;
  String[] fileName={"String_Node_Str","String_Node_Str"};
  for (int i=0; i < fileName.length; i++) {
    fis=new FileInputStream("String_Node_Str" + fileName[i] + "String_Node_Str");
    FloatImage image=decoder.decodeImage(fis);
    ByteArrayOutputStream bos=new ByteArrayOutputStream();
    image.write(new DataOutputStream(bos));
    ByteArrayInputStream bis=new ByteArrayInputStream(bos.toByteArray());
    FloatImage newImage=new FloatImage();
    newImage.readFields(new DataInputStream(bis));
    assertEquals(fileName[i] + "String_Node_Str",image,newImage);
  }
}
Program: 16780
Project: 16780
Buggy source:
/** 
 * Test method for   {@link hipi.image.io.JPEGImageUtil#decodeImage(java.io.InputStream)}.
 * @throws IOException 
 */
@Test public void testDecodeImage() throws IOException {
  ImageDecoder jpgDecoder, ppmDecoder;
  jpgDecoder=JPEGImageUtil.getInstance();
  ppmDecoder=PPMImageUtil.getInstance();
  FileInputStream fis;
  FloatImage ppmImage, jpgImage;
  String[] fileName={"String_Node_Str","String_Node_Str"};
  for (int i=0; i < fileName.length; i++) {
    fis=new FileInputStream("String_Node_Str" + fileName[i] + "String_Node_Str");
    ppmImage=ppmDecoder.decodeImage(fis);
    assumeNotNull(ppmImage);
    fis=new FileInputStream("String_Node_Str" + fileName[i] + "String_Node_Str");
    jpgImage=jpgDecoder.decodeImage(fis);
    assumeNotNull(jpgImage);
    assertArrayEquals(fileName[i] + "String_Node_Str",ppmImage.getData(),jpgImage.getData(),1);
  }
}

Fixed version (ground truth):
/** 
 * Test method for   {@link hipi.image.io.JPEGImageUtil#decodeImage(java.io.InputStream)}.
 * @throws IOException 
 */
@Test public void testDecodeImage() throws IOException {
  ImageDecoder jpgDecoder, ppmDecoder;
  jpgDecoder=JPEGImageUtil.getInstance();
  ppmDecoder=PPMImageUtil.getInstance();
  FileInputStream fis;
  FloatImage ppmImage, jpgImage;
  String[] fileName={"String_Node_Str","String_Node_Str"};
  for (int i=0; i < fileName.length; i++) {
    fis=new FileInputStream("String_Node_Str" + fileName[i] + "String_Node_Str");
    ppmImage=ppmDecoder.decodeImage(fis);
    assumeNotNull(ppmImage);
    fis=new FileInputStream("String_Node_Str" + fileName[i] + "String_Node_Str");
    jpgImage=jpgDecoder.decodeImage(fis);
    assumeNotNull(jpgImage);
    assertEquals(fileName[i] + "String_Node_Str",ppmImage,jpgImage);
  }
}
Program: 16781
Project: 16781
Buggy source:
/** 
 * Test method for   {@link hipi.image.io.PNGImageUtil#decodeImage(java.io.InputStream)}.
 * @throws IOException 
 */
@Test public void testDecodeImage() throws IOException {
  ImageDecoder pngDecoder, ppmDecoder;
  pngDecoder=PNGImageUtil.getInstance();
  ppmDecoder=PPMImageUtil.getInstance();
  FileInputStream fis;
  FloatImage ppmImage, pngImage;
  String[] fileName={"String_Node_Str","String_Node_Str"};
  for (int i=0; i < fileName.length; i++) {
    fis=new FileInputStream("String_Node_Str" + fileName[i] + "String_Node_Str");
    ppmImage=ppmDecoder.decodeImage(fis);
    assumeNotNull(ppmImage);
    fis=new FileInputStream("String_Node_Str" + fileName[i] + "String_Node_Str");
    pngImage=pngDecoder.decodeImage(fis);
    assumeNotNull(pngImage);
    assertArrayEquals(fileName[i] + "String_Node_Str" + fileName[i],ppmImage.getData(),pngImage.getData(),0);
  }
}

Fixed version (ground truth):
/** 
 * Test method for   {@link hipi.image.io.PNGImageUtil#decodeImage(java.io.InputStream)}.
 * @throws IOException 
 */
@Test public void testDecodeImage() throws IOException {
  ImageDecoder pngDecoder, ppmDecoder;
  pngDecoder=PNGImageUtil.getInstance();
  ppmDecoder=PPMImageUtil.getInstance();
  FileInputStream fis;
  FloatImage ppmImage, pngImage;
  String[] fileName={"String_Node_Str","String_Node_Str"};
  for (int i=0; i < fileName.length; i++) {
    fis=new FileInputStream("String_Node_Str" + fileName[i] + "String_Node_Str");
    ppmImage=ppmDecoder.decodeImage(fis);
    assumeNotNull(ppmImage);
    fis=new FileInputStream("String_Node_Str" + fileName[i] + "String_Node_Str");
    pngImage=pngDecoder.decodeImage(fis);
    assumeNotNull(pngImage);
    assertEquals(fileName[i] + "String_Node_Str" + fileName[i],ppmImage,pngImage);
  }
}
Program: 16782
Project: 16782
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override protected void openForWrite() throws IOException {
  if (_data_output_stream != null || _reader != null || _index_output_stream != null || _index_input_stream != null) {
    throw new IOException("String_Node_Str" + _file_path.getName() + "String_Node_Str");
  }
  _index_file=_file_path;
  _index_output_stream=new DataOutputStream(FileSystem.get(_conf).create(_index_file));
  _data_file=_file_path.suffix("String_Node_Str");
  _data_output_stream=new DataOutputStream(FileSystem.get(_conf).create(_data_file));
  _countingOffset=0;
  writeBundleHeader();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override protected void openForWrite() throws IOException {
  if (_data_output_stream != null || _reader != null || _index_output_stream != null || _index_input_stream != null) {
    throw new IOException("String_Node_Str" + _file_path.getName() + "String_Node_Str");
  }
  _index_file=_file_path;
  FileSystem fs=FileSystem.get(_conf);
  _index_output_stream=new DataOutputStream(fs.create(_index_file));
  _data_file=_file_path.suffix("String_Node_Str");
  if (_blockSize <= 0)   _blockSize=fs.getDefaultBlockSize();
  if (_replication <= 0)   _replication=fs.getDefaultReplication();
  _data_output_stream=new DataOutputStream(fs.create(_data_file,true,fs.getConf().getInt("String_Node_Str",4096),_replication,_blockSize));
  _countingOffset=0;
  writeBundleHeader();
}
Program: 16783
Project: 16783
Buggy source:
/** 
 * @param file_path The {@link Path} indicating where the image bundle is (or should be written to)
 * @param conf {@link Configuration} that determines the {@link FileSystem} for the image bundle
 */
public HipiImageBundle(Path file_path,Configuration conf){
  super(file_path,conf);
}

Fixed version (ground truth):
public HipiImageBundle(Path file_path,Configuration conf,short replication,long blockSize){
  super(file_path,conf);
  _replication=replication;
  _blockSize=blockSize;
}
Program: 16784
Project: 16784
Buggy source:
public void reduce(NullWritable key,Iterable<FloatImage> values,Context context) throws IOException, InterruptedException {
  FloatImage mean=new FloatImage(2592,1944,1);
  int num_pics=0;
  for (  FloatImage val : values) {
    mean.add(val);
    num_pics++;
  }
  mean.scale(1 / num_pics);
  context.write(new IntWritable(0),mean);
}

Fixed version (ground truth):
public void reduce(NullWritable key,Iterable<FloatImage> values,Context context) throws IOException, InterruptedException {
  FloatImage mean=new FloatImage(2592,1944,1);
  int num_pics=0;
  for (  FloatImage val : values) {
    mean.add(val);
    num_pics++;
  }
  float scale=1.0f / num_pics;
  mean.scale(scale);
  System.out.println("String_Node_Str" + scale);
  context.write(new IntWritable(0),mean);
}
Program: 16785
Project: 16785
Buggy source:
public int run(String[] args) throws Exception {
  if (args.length < 3) {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  Configuration conf=new Configuration();
  String outputPath=args[1];
  String input_file_type=args[2];
  conf.setStrings("String_Node_Str",outputPath);
  conf.setStrings("String_Node_Str",input_file_type);
  Job job=new Job(conf,"String_Node_Str");
  job.setJarByClass(AverageImage.class);
  job.setMapperClass(MyMapper.class);
  job.setReducerClass(MyReducer.class);
  job.setOutputKeyClass(IntWritable.class);
  job.setOutputValueClass(FloatImage.class);
  job.setMapOutputKeyClass(NullWritable.class);
  job.setMapOutputValueClass(FloatImage.class);
  removeDir("String_Node_Str",conf);
  FileOutputFormat.setOutputPath(job,new Path("String_Node_Str"));
  JPEGFileInputFormat.addInputPath(job,new Path(args[0]));
  if (input_file_type.equals("String_Node_Str"))   job.setInputFormatClass(ImageBundleInputFormat.class);
 else   if (input_file_type.equals("String_Node_Str"))   job.setInputFormatClass(JPEGFileInputFormat.class);
 else   if (input_file_type.equals("String_Node_Str"))   job.setInputFormatClass(JPEGFileInputFormat.class);
 else   if (input_file_type.equals("String_Node_Str"))   job.setInputFormatClass(JPEGSequenceFileInputFormat.class);
 else {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  System.exit(job.waitForCompletion(true) ? 0 : 1);
  return 0;
}

Fixed version (ground truth):
public int run(String[] args) throws Exception {
  if (args.length < 3) {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  Configuration conf=new Configuration();
  String outputPath=args[1];
  String input_file_type=args[2];
  conf.setStrings("String_Node_Str",input_file_type);
  Job job=new Job(conf,"String_Node_Str");
  job.setJarByClass(AverageImage.class);
  job.setMapperClass(MyMapper.class);
  job.setReducerClass(MyReducer.class);
  job.setOutputKeyClass(IntWritable.class);
  job.setOutputValueClass(FloatImage.class);
  job.setOutputFormatClass(BinaryOutputFormat.class);
  job.setMapOutputKeyClass(NullWritable.class);
  job.setMapOutputValueClass(FloatImage.class);
  removeDir(outputPath,conf);
  FileOutputFormat.setOutputPath(job,new Path(outputPath));
  JPEGFileInputFormat.addInputPath(job,new Path(args[0]));
  if (input_file_type.equals("String_Node_Str"))   job.setInputFormatClass(ImageBundleInputFormat.class);
 else   if (input_file_type.equals("String_Node_Str"))   job.setInputFormatClass(JPEGFileInputFormat.class);
 else   if (input_file_type.equals("String_Node_Str"))   job.setInputFormatClass(JPEGFileInputFormat.class);
 else   if (input_file_type.equals("String_Node_Str"))   job.setInputFormatClass(JPEGSequenceFileInputFormat.class);
 else {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  System.exit(job.waitForCompletion(true) ? 0 : 1);
  return 0;
}
Program: 16786
Project: 16786
Buggy source:
public void map(ImageHeader key,FloatImage value,Context context) throws IOException, InterruptedException {
  if (value != null) {
    FloatImage gray=value.convert(FloatImage.RGB2GRAY);
    context.write(new BooleanWritable(true),new LongWritable(gray.hashCode()));
  }
 else   context.write(new BooleanWritable(false),new LongWritable(0));
}

Fixed version (ground truth):
public void map(ImageHeader key,FloatImage value,Context context) throws IOException, InterruptedException {
  if (value != null) {
    FloatImage gray=value.convert(FloatImage.RGB2GRAY);
    context.write(new BooleanWritable(true),new LongWritable(gray.hashCode()));
    ImageEncoder encoder=JPEGImageUtil.getInstance();
  }
 else   context.write(new BooleanWritable(false),new LongWritable(0));
}
Program: 16787
Project: 16787
Buggy source:
public void reduce(BooleanWritable key,Iterable<Text> values,Context context) throws IOException, InterruptedException {
  if (key.get()) {
    FileSystem fileSystem=FileSystem.get(conf);
    HipiImageBundle hib=new HipiImageBundle(new Path(conf.get("String_Node_Str")),conf);
    hib.open(HipiImageBundle.FILE_MODE_WRITE,true);
    for (    Text temp_string : values) {
      Path temp_path=new Path(temp_string.toString());
      HipiImageBundle input_bundle=new HipiImageBundle(temp_path,conf);
      hib.append(input_bundle);
      Path index_path=input_bundle.getPath();
      Path data_path=new Path(index_path.toString() + "String_Node_Str");
      System.out.println("String_Node_Str" + data_path.toString());
      fileSystem.delete(index_path,false);
      fileSystem.delete(data_path,false);
      context.write(new BooleanWritable(true),new Text(input_bundle.getPath().toString()));
      context.progress();
    }
  }
}

Fixed version (ground truth):
public void reduce(BooleanWritable key,Iterable<Text> values,Context context) throws IOException, InterruptedException {
  if (key.get()) {
    FileSystem fileSystem=FileSystem.get(conf);
    HipiImageBundle hib=new HipiImageBundle(new Path(conf.get("String_Node_Str")),conf);
    hib.open(HipiImageBundle.FILE_MODE_WRITE,true);
    for (    Text temp_string : values) {
      Path temp_path=new Path(temp_string.toString());
      HipiImageBundle input_bundle=new HipiImageBundle(temp_path,conf);
      hib.append(input_bundle);
      Path index_path=input_bundle.getPath();
      Path data_path=new Path(index_path.toString() + "String_Node_Str");
      System.out.println("String_Node_Str" + data_path.toString());
      fileSystem.delete(index_path,false);
      fileSystem.delete(data_path,false);
      context.write(new BooleanWritable(true),new Text(input_bundle.getPath().toString()));
      context.progress();
    }
    hib.close();
  }
}
Program: 16789
Project: 16789
Buggy source:
public ImageHeader getCurrentKey() throws IOException {
  if (_header != null)   return _header;
  if (_cacheLength > 0) {
    ImageDecoder decoder=CodecManager.getDecoder(ImageType.fromValue(_cacheType));
    if (decoder == null)     return null;
    ByteArrayInputStream _byte_array_input_stream=new ByteArrayInputStream(_byte_array_data);
    try {
      _header=decoder.decodeImageHeader(_byte_array_input_stream);
    }
 catch (    IOException e) {
      _header=null;
    }
    return _header;
  }
  return null;
}

Fixed version (ground truth):
public ImageHeader getCurrentKey() throws IOException {
  if (_header != null)   return _header;
  if (_cacheLength > 0) {
    ImageDecoder decoder=CodecManager.getDecoder(ImageType.fromValue(_cacheType));
    if (decoder == null)     return null;
    ByteArrayInputStream _byte_array_input_stream=new ByteArrayInputStream(_byte_array_data);
    try {
      _header=decoder.decodeImageHeader(_byte_array_input_stream);
    }
 catch (    Exception e) {
      e.printStackTrace();
      _header=null;
    }
    return _header;
  }
  return null;
}
Program: 16790
Project: 16790
Buggy source:
public boolean nextKeyValue(){
  try {
    _countingOffset+=_cacheLength + 8;
    if (_end > 0 && _countingOffset > _end) {
      _cacheLength=_cacheType=0;
      return false;
    }
    int byteRead=_data_input_stream.read(_sig);
    if (byteRead <= 0)     return false;
    _cacheLength=((_sig[0] & 0xff) << 24) | ((_sig[1] & 0xff) << 16) | ((_sig[2] & 0xff) << 8)| (_sig[3] & 0xff);
    _cacheType=((_sig[4] & 0xff) << 24) | ((_sig[5] & 0xff) << 16) | ((_sig[6] & 0xff) << 8)| (_sig[7] & 0xff);
    _image=null;
    _header=null;
    _byte_array_data=new byte[_cacheLength];
    _data_input_stream.read(_byte_array_data);
    return true;
  }
 catch (  IOException e) {
    return false;
  }
}

Fixed version (ground truth):
public boolean nextKeyValue(){
  try {
    if (_end > 0 && _countingOffset > _end) {
      _cacheLength=_cacheType=0;
      return false;
    }
    int readOff=0;
    int byteRead=_data_input_stream.read(_sig);
    while (byteRead < 8 - readOff && byteRead > 0) {
      readOff+=byteRead;
      byteRead=_data_input_stream.read(_sig,readOff,8 - readOff);
    }
    if (byteRead <= 0) {
      _cacheLength=_cacheType=0;
      return false;
    }
    if (byteRead < 8)     System.out.println("String_Node_Str" + byteRead);
    _cacheLength=((_sig[0] & 0xff) << 24) | ((_sig[1] & 0xff) << 16) | ((_sig[2] & 0xff) << 8)| (_sig[3] & 0xff);
    _cacheType=((_sig[4] & 0xff) << 24) | ((_sig[5] & 0xff) << 16) | ((_sig[6] & 0xff) << 8)| (_sig[7] & 0xff);
    _image=null;
    _header=null;
    if (_cacheLength < 0) {
      System.out.println("String_Node_Str" + _countingOffset + "String_Node_Str");
      _cacheLength=_cacheType=0;
      return false;
    }
    _byte_array_data=new byte[_cacheLength];
    readOff=0;
    byteRead=_data_input_stream.read(_byte_array_data);
    while (byteRead < _byte_array_data.length - readOff && byteRead > 0) {
      readOff+=byteRead;
      byteRead=_data_input_stream.read(_byte_array_data,readOff,_byte_array_data.length - readOff);
    }
    if (byteRead <= 0) {
      _cacheLength=_cacheType=0;
      return false;
    }
    _countingOffset+=_cacheLength + 8;
    return true;
  }
 catch (  IOException e) {
    return false;
  }
}
Program: 16791
Project: 16791
Buggy source:
public FloatImage getCurrentValue() throws IOException {
  if (_image != null)   return _image;
  if (_cacheLength > 0) {
    ImageDecoder decoder=CodecManager.getDecoder(ImageType.fromValue(_cacheType));
    if (decoder == null)     return null;
    ByteArrayInputStream _byte_array_input_stream=new ByteArrayInputStream(_byte_array_data);
    try {
      _image=decoder.decodeImage(_byte_array_input_stream);
    }
 catch (    IOException e) {
      _image=null;
    }
    _byte_array_input_stream.close();
    return _image;
  }
  return null;
}

Fixed version (ground truth):
public FloatImage getCurrentValue() throws IOException {
  if (_image != null)   return _image;
  if (_cacheLength > 0) {
    ImageDecoder decoder=CodecManager.getDecoder(ImageType.fromValue(_cacheType));
    if (decoder == null)     return null;
    ByteArrayInputStream _byte_array_input_stream=new ByteArrayInputStream(_byte_array_data);
    try {
      _image=decoder.decodeImage(_byte_array_input_stream);
    }
 catch (    Exception e) {
      e.printStackTrace();
      _image=null;
    }
    return _image;
  }
  return null;
}
Program: 16792
Project: 16792
Buggy source:
public FileReader(FileSystem fs,Path path,Configuration conf,long start,long end) throws IOException {
  _data_input_stream=new DataInputStream(fs.open(path));
  _countingOffset=_start=start;
  while (_countingOffset > 0) {
    long skipped=_data_input_stream.skip((long)_countingOffset);
    if (skipped <= 0)     break;
    _countingOffset-=skipped;
  }
  _countingOffset=_start;
  _end=end;
}

Fixed version (ground truth):
public FileReader(FileSystem fs,Path path,Configuration conf,long start,long end) throws IOException {
  _data_input_stream=new DataInputStream(fs.open(path));
  _start=start;
  while (start > 0) {
    long skipped=_data_input_stream.skip((long)start);
    if (skipped <= 0)     break;
    start-=skipped;
  }
  _countingOffset=_start;
  _end=end;
}
Program: 16793
Project: 16793
Buggy source:
/** 
 * Converts a   {@code String} to a {@code Date} value.
 * @param value Value to convert.
 * @return Date value.
 */
static Date toDate(String value){
  if (dateFormat == null) {
    dateFormat=new SimpleDateFormat[6];
    dateFormat[0]=new SimpleDateFormat("String_Node_Str");
    dateFormat[0].setLenient(true);
    dateFormat[1]=new SimpleDateFormat("String_Node_Str");
    dateFormat[1].setLenient(true);
    dateFormat[2]=new SimpleDateFormat("String_Node_Str");
    dateFormat[2].setLenient(true);
    dateFormat[3]=new SimpleDateFormat("String_Node_Str");
    dateFormat[3].setLenient(true);
    dateFormat[4]=new SimpleDateFormat("String_Node_Str");
    dateFormat[4].setLenient(true);
    dateFormat[5]=new SimpleDateFormat("String_Node_Str");
    dateFormat[5].setLenient(true);
  }
  if (datePattern == null) {
    String pattern="String_Node_Str";
    datePattern=Pattern.compile(pattern);
  }
  for (  SimpleDateFormat simpleDateFormat : dateFormat) {
    try {
      Matcher matcher=datePattern.matcher(value);
      value=matcher.replaceAll("String_Node_Str");
      return simpleDateFormat.parse(value);
    }
 catch (    ParseException e) {
    }
  }
  try {
    return new Date(Long.parseLong(value) * 1000);
  }
 catch (  Exception e) {
    throw new RuntimeException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Converts a   {@code String} to a {@code Date} value.
 * @param value Value to convert.
 * @return Date value.
 */
static synchronized Date toDate(String value){
  if (dateFormat == null) {
    dateFormat=new SimpleDateFormat[6];
    dateFormat[0]=new SimpleDateFormat("String_Node_Str");
    dateFormat[0].setLenient(true);
    dateFormat[1]=new SimpleDateFormat("String_Node_Str");
    dateFormat[1].setLenient(true);
    dateFormat[2]=new SimpleDateFormat("String_Node_Str");
    dateFormat[2].setLenient(true);
    dateFormat[3]=new SimpleDateFormat("String_Node_Str");
    dateFormat[3].setLenient(true);
    dateFormat[4]=new SimpleDateFormat("String_Node_Str");
    dateFormat[4].setLenient(true);
    dateFormat[5]=new SimpleDateFormat("String_Node_Str");
    dateFormat[5].setLenient(true);
  }
  if (datePattern == null) {
    String pattern="String_Node_Str";
    datePattern=Pattern.compile(pattern);
  }
  for (  SimpleDateFormat simpleDateFormat : dateFormat) {
    try {
      Matcher matcher=datePattern.matcher(value);
      value=matcher.replaceAll("String_Node_Str");
      return simpleDateFormat.parse(value);
    }
 catch (    ParseException e) {
    }
  }
  try {
    return new Date(Long.parseLong(value) * 1000);
  }
 catch (  Exception e) {
    throw new RuntimeException(e.getMessage(),e);
  }
}
Program: 16794
Project: 16794
Buggy source:
/** 
 * Converts a   {@code String} to a {@code Date} value.
 * @param value Value to convert.
 * @return Date value.
 */
static Date toDate(String value){
  if (dateFormat == null) {
    dateFormat=new SimpleDateFormat[6];
    dateFormat[0]=new SimpleDateFormat("String_Node_Str");
    dateFormat[0].setLenient(true);
    dateFormat[1]=new SimpleDateFormat("String_Node_Str");
    dateFormat[1].setLenient(true);
    dateFormat[2]=new SimpleDateFormat("String_Node_Str");
    dateFormat[2].setLenient(true);
    dateFormat[3]=new SimpleDateFormat("String_Node_Str");
    dateFormat[3].setLenient(true);
    dateFormat[4]=new SimpleDateFormat("String_Node_Str");
    dateFormat[4].setLenient(true);
    dateFormat[5]=new SimpleDateFormat("String_Node_Str");
    dateFormat[5].setLenient(true);
  }
  if (datePattern == null) {
    String pattern="String_Node_Str";
    datePattern=Pattern.compile(pattern);
  }
  for (  SimpleDateFormat simpleDateFormat : dateFormat) {
    try {
      Matcher matcher=datePattern.matcher(value);
      value=matcher.replaceAll("String_Node_Str");
      return simpleDateFormat.parse(value);
    }
 catch (    ParseException e) {
    }
  }
  try {
    return new Date(Long.parseLong(value) * 1000);
  }
 catch (  Exception e) {
    throw new RuntimeException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Converts a   {@code String} to a {@code Date} value.
 * @param value Value to convert.
 * @return Date value.
 */
static synchronized Date toDate(String value){
  if (dateFormat == null) {
    dateFormat=new SimpleDateFormat[6];
    dateFormat[0]=new SimpleDateFormat("String_Node_Str");
    dateFormat[0].setLenient(true);
    dateFormat[1]=new SimpleDateFormat("String_Node_Str");
    dateFormat[1].setLenient(true);
    dateFormat[2]=new SimpleDateFormat("String_Node_Str");
    dateFormat[2].setLenient(true);
    dateFormat[3]=new SimpleDateFormat("String_Node_Str");
    dateFormat[3].setLenient(true);
    dateFormat[4]=new SimpleDateFormat("String_Node_Str");
    dateFormat[4].setLenient(true);
    dateFormat[5]=new SimpleDateFormat("String_Node_Str");
    dateFormat[5].setLenient(true);
  }
  if (datePattern == null) {
    String pattern="String_Node_Str";
    datePattern=Pattern.compile(pattern);
  }
  for (  SimpleDateFormat simpleDateFormat : dateFormat) {
    try {
      Matcher matcher=datePattern.matcher(value);
      value=matcher.replaceAll("String_Node_Str");
      return simpleDateFormat.parse(value);
    }
 catch (    ParseException e) {
    }
  }
  try {
    return new Date(Long.parseLong(value) * 1000);
  }
 catch (  Exception e) {
    throw new RuntimeException(e.getMessage(),e);
  }
}
Program: 16795
Project: 16795
Buggy source:
private int getResultCountOfIndex(Service s){
  InputStream results=s.oneshotSearch("String_Node_Str" + indexName);
  try {
    ResultsReaderXml resultsReader=new ResultsReaderXml(results);
    int numEvents=0;
    while (resultsReader.getNextEvent() != null) {
      numEvents++;
    }
    return numEvents;
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
private int getResultCountOfIndex(Service s,String indexName){
  InputStream results=s.oneshotSearch("String_Node_Str" + indexName);
  try {
    ResultsReaderXml resultsReader=new ResultsReaderXml(results);
    int numEvents=0;
    while (resultsReader.getNextEvent() != null) {
      numEvents++;
    }
    return numEvents;
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 16797
Project: 16797
Buggy source:
@Test public void testHandleErrorsReturnedAsJson(){
  JobExportArgs exportArgs=new JobExportArgs();
  exportArgs.setOutputMode(JobExportArgs.OutputMode.JSON);
  exportArgs.setSearchMode(JobExportArgs.SearchMode.REALTIME);
  exportArgs.setEarliestTime("String_Node_Str");
  exportArgs.setLatestTime("String_Node_Str");
  try {
    service.export("String_Node_Str",exportArgs);
  }
 catch (  Exception e) {
    Assert.assertEquals("String_Node_Str" + "String_Node_Str",e.getMessage());
    return;
  }
  Assert.fail();
}

Fixed version (ground truth):
@Test public void testHandleErrorsReturnedAsJson(){
  JobExportArgs exportArgs=new JobExportArgs();
  exportArgs.setOutputMode(JobExportArgs.OutputMode.JSON);
  exportArgs.setSearchMode(JobExportArgs.SearchMode.REALTIME);
  exportArgs.setEarliestTime("String_Node_Str");
  exportArgs.setLatestTime("String_Node_Str");
  try {
    service.export("String_Node_Str",exportArgs);
  }
 catch (  Exception e) {
    Assert.assertTrue(e.getMessage().contains("String_Node_Str"));
    return;
  }
  Assert.fail();
}
Program: 16798
Project: 16798
Buggy source:
@Test public void testAddStringFilterAgainstSplunk(){
  DataModel dm=(DataModel)service.getDataModels().get("String_Node_Str");
  DataModelObject dmo=dm.getObject("String_Node_Str");
  PivotSpecification pivotSpec=dmo.createPivotSpecification();
  pivotSpec.addCellValue("String_Node_Str","String_Node_Str",StatsFunction.COUNT);
  pivotSpec.addFilter("String_Node_Str",StringComparison.DOES_NOT_CONTAIN,"String_Node_Str");
  pivotSpec.addFilter("String_Node_Str",StringComparison.CONTAINS,"String_Node_Str");
  Pivot p=pivotSpec.pivot();
  Job j=p.run();
  assertEventuallyTrue(new EventuallyTrueBehavior(){
    @Override public boolean predicate(){
      if (!j.isDone()) {
        j.refresh();
      }
      return j.isDone();
    }
  }
);
}

Fixed version (ground truth):
@Test public void testAddStringFilterAgainstSplunk(){
  DataModel dm=(DataModel)service.getDataModels().get("String_Node_Str");
  DataModelObject dmo=dm.getObject("String_Node_Str");
  PivotSpecification pivotSpec=dmo.createPivotSpecification();
  pivotSpec.addCellValue("String_Node_Str","String_Node_Str",StatsFunction.COUNT);
  pivotSpec.addFilter("String_Node_Str",StringComparison.DOES_NOT_CONTAIN,"String_Node_Str");
  pivotSpec.addFilter("String_Node_Str",StringComparison.CONTAINS,"String_Node_Str");
  Pivot p=pivotSpec.pivot();
  final Job j=p.run();
  assertEventuallyTrue(new EventuallyTrueBehavior(){
    @Override public boolean predicate(){
      if (!j.isDone()) {
        j.refresh();
      }
      return j.isDone();
    }
  }
);
}
Program: 16802
Project: 16802
Buggy source:
/** 
 * Given an   {@code org.w3c.dom.Node} which is an element containing text, returns the text. If thereis anything but text inside the element, throws a  {@code MalformedDataException} with {@code errorMessage} as the reason.
 * @param node The {@code Node} object to pull text out of.
 * @param errorMessage The reason provided if there is something besides text in the element.
 * @return A String of the text in the element.
 * @throws MalformedDataException When there is anything besides text in the element.
 */
static String textInNode(Node node,String errorMessage) throws MalformedDataException {
  Node child=node.getFirstChild();
  if (child.getNodeType() != child.TEXT_NODE) {
    throw new MalformedDataException(errorMessage);
  }
 else {
    return ((Text)child).getData();
  }
}

Fixed version (ground truth):
/** 
 * Given an   {@code org.w3c.dom.Node} which is an element containing text, returns the text. If thereis anything but text inside the element, throws a  {@code MalformedDataException} with {@code errorMessage} as the reason.
 * @param node The {@code Node} object to pull text out of.
 * @param errorMessage The reason provided if there is something besides text in the element.
 * @return A String of the text in the element.
 * @throws MalformedDataException When there is anything besides text in the element.
 */
static String textInNode(Node node,String errorMessage) throws MalformedDataException {
  Node child=node.getFirstChild();
  if (child.getNodeType() != Node.TEXT_NODE) {
    throw new MalformedDataException(errorMessage);
  }
 else {
    return ((Text)child).getData();
  }
}
Program: 16803
Project: 16803
Buggy source:
private Args namespace(AtomEntry entry){
  Args namespace=new Args();
  if (entry.content == null)   return namespace;
  HashMap<String,String> entityMetadata=(HashMap<String,String>)entry.content.get("String_Node_Str");
  if (entityMetadata.containsKey("String_Node_Str"))   namespace.put("String_Node_Str",entityMetadata.get("String_Node_Str"));
  if (entityMetadata.containsKey("String_Node_Str"))   namespace.put("String_Node_Str",entityMetadata.get("String_Node_Str"));
  if (entityMetadata.containsKey("String_Node_Str"))   namespace.put("String_Node_Str",entityMetadata.get("String_Node_Str"));
  return namespace;
}

Fixed version (ground truth):
private Args namespace(AtomEntry entry){
  Args namespace=new Args();
  if (entry.content == null)   return namespace;
  HashMap<String,String> entityMetadata=(HashMap<String,String>)entry.content.get("String_Node_Str");
  if (entityMetadata == null) {
    entityMetadata=new HashMap<String,String>();
  }
  if (entityMetadata.containsKey("String_Node_Str"))   namespace.put("String_Node_Str",entityMetadata.get("String_Node_Str"));
  if (entityMetadata.containsKey("String_Node_Str"))   namespace.put("String_Node_Str",entityMetadata.get("String_Node_Str"));
  if (entityMetadata.containsKey("String_Node_Str"))   namespace.put("String_Node_Str",entityMetadata.get("String_Node_Str"));
  return namespace;
}