nus-yam/ex-repair huggingface dataset:
Program: 94477
Project: 94477
Buggy source:
public void beforePaintingTile(final long tileId){
  if (aggregationType == AggregationType.MIN) {
    composite=new MinCompositeDouble();
  }
 else   if (aggregationType == AggregationType.MAX) {
    composite=new MaxCompositeDouble();
  }
 else {
    composite=new AdditiveCompositeDouble();
  }
  raster=RasterUtils.createEmptyRaster(tileSize,tileSize,1,DataBuffer.TYPE_DOUBLE,Double.NaN);
  totalRaster=null;
  totalPainter=null;
  if (aggregationType == AggregationType.AVERAGE) {
    totalRaster=raster.createCompatibleWritableRaster();
    final BufferedImage bi=RasterUtils.makeBufferedImage(totalRaster);
    final Graphics2D gr=bi.createGraphics();
    gr.setComposite(composite);
    gr.setStroke(new BasicStroke(0));
    totalPainter=new GeometryPainter(gr,totalRaster,new Color(1,1,1),new Color(0,0,0));
  }
  final BufferedImage bi=RasterUtils.makeBufferedImage(raster);
  final Graphics2D gr=bi.createGraphics();
  if (aggregationType == AggregationType.MASK) {
    composite.setWeight(0.0);
  }
  gr.setComposite(composite);
  gr.setStroke(new BasicStroke(0));
  rasterPainter=new GeometryPainter(gr,raster,new Color(1,1,1),new Color(0,0,0));
  final Tile tile=TMSUtils.tileid(tileId,zoom);
  final TMSUtils.Bounds tb=TMSUtils.tileBounds(tile.tx,tile.ty,zoom,tileSize);
  b=new Bounds(tb.w,tb.s,tb.e,tb.n);
  rasterPainter.setBounds(b);
}

Fixed version (ground truth):
public void beforePaintingTile(final long tileId){
  if (aggregationType == AggregationType.MIN) {
    composite=new MinCompositeDouble();
  }
 else   if (aggregationType == AggregationType.MAX) {
    composite=new MaxCompositeDouble();
  }
 else   if (aggregationType == AggregationType.MASK) {
    composite=new MaskComposite(1.0,0.0,Double.NaN);
  }
 else {
    composite=new AdditiveCompositeDouble();
  }
  raster=RasterUtils.createEmptyRaster(tileSize,tileSize,1,DataBuffer.TYPE_DOUBLE,Double.NaN);
  totalRaster=null;
  totalPainter=null;
  if (aggregationType == AggregationType.AVERAGE) {
    totalRaster=raster.createCompatibleWritableRaster();
    final BufferedImage bi=RasterUtils.makeBufferedImage(totalRaster);
    final Graphics2D gr=bi.createGraphics();
    gr.setComposite(composite);
    gr.setStroke(new BasicStroke(0));
    totalPainter=new GeometryPainter(gr,totalRaster,new Color(1,1,1),new Color(0,0,0));
  }
  final BufferedImage bi=RasterUtils.makeBufferedImage(raster);
  final Graphics2D gr=bi.createGraphics();
  gr.setComposite(composite);
  gr.setStroke(new BasicStroke(0));
  rasterPainter=new GeometryPainter(gr,raster,new Color(1,1,1),new Color(0,0,0));
  final Tile tile=TMSUtils.tileid(tileId,zoom);
  final TMSUtils.Bounds tb=TMSUtils.tileBounds(tile.tx,tile.ty,zoom,tileSize);
  b=new Bounds(tb.w,tb.s,tb.e,tb.n);
  rasterPainter.setBounds(b);
}
Program: 94478
Project: 94478
Buggy source:
public boolean afterPaintingGeometry(Geometry g){
  if (aggregationType == AggregationType.LAST) {
    return false;
  }
  if (aggregationType == AggregationType.AVERAGE && totalPainter != null) {
    composite.setWeight(1.0);
    totalPainter.setBounds(b);
    totalPainter.paint(g);
  }
  return true;
}

Fixed version (ground truth):
public boolean afterPaintingGeometry(Geometry g){
  if (aggregationType == AggregationType.LAST) {
    return false;
  }
  if (aggregationType == AggregationType.AVERAGE && totalPainter != null) {
    ((WeightedComposite)composite).setWeight(1.0);
    totalPainter.setBounds(b);
    totalPainter.paint(g);
  }
  return true;
}
Program: 94479
Project: 94479
Buggy source:
@Override public void move(final String toResource) throws IOException {
  HadoopFileUtils.move(getConfiguration(),getResourcePath(),determineResourcePath(getConfiguration(),toResource));
}

Fixed version (ground truth):
@Override public void move(final String toResource) throws IOException {
  try {
    HadoopFileUtils.move(getConfiguration(),getResourcePath(),determineResourcePath(getConfiguration(),toResource));
  }
 catch (  URISyntaxException e) {
    throw new IOException(e);
  }
}
Program: 94480
Project: 94480
Buggy source:
public static void delete(final Configuration conf,String name,final Properties providerProperties) throws IOException {
  HadoopFileUtils.delete(determineResourcePath(conf,name));
}

Fixed version (ground truth):
public static void delete(final Configuration conf,String name,final Properties providerProperties) throws IOException {
  try {
    HadoopFileUtils.delete(determineResourcePath(conf,name));
  }
 catch (  URISyntaxException e) {
    throw new IOException(e);
  }
}
Program: 94481
Project: 94481
Buggy source:
public Path getResourcePath() throws IOException {
  if (resourcePath == null) {
    resourcePath=determineResourcePath(getConfiguration(),getResourceName());
  }
  return resourcePath;
}

Fixed version (ground truth):
public Path getResourcePath() throws IOException {
  if (resourcePath == null) {
    try {
      resourcePath=determineResourcePath(getConfiguration(),getResourceName());
    }
 catch (    URISyntaxException e) {
      throw new IOException(e);
    }
  }
  return resourcePath;
}
Program: 94482
Project: 94482
Buggy source:
public static boolean canOpen(final Configuration conf,final String name,final Properties providerProperties) throws IOException {
  Path p=determineResourcePath(conf,name);
  FileSystem fs=HadoopFileUtils.getFileSystem(conf,p);
  return fs.exists(p);
}

Fixed version (ground truth):
public static boolean canOpen(final Configuration conf,final String name,final Properties providerProperties) throws IOException {
  try {
    Path p=determineResourcePath(conf,name);
    FileSystem fs=HadoopFileUtils.getFileSystem(conf,p);
    return fs.exists(p);
  }
 catch (  URISyntaxException e) {
  }
  return false;
}
Program: 94483
Project: 94483
Buggy source:
public static boolean exists(final Configuration conf,String name,final Properties providerProperties) throws IOException {
  return HadoopFileUtils.exists(determineResourcePath(conf,name));
}

Fixed version (ground truth):
public static boolean exists(final Configuration conf,String name,final Properties providerProperties) throws IOException {
  try {
    return HadoopFileUtils.exists(determineResourcePath(conf,name));
  }
 catch (  URISyntaxException e) {
  }
  return false;
}
Program: 94484
Project: 94484
Buggy source:
private static Path determineResourcePath(final Configuration conf,final String resourceName) throws IOException {
  return HadoopFileUtils.resolveName(conf,resourceName,false);
}

Fixed version (ground truth):
private static Path determineResourcePath(final Configuration conf,final String resourceName) throws IOException, URISyntaxException {
  return HadoopFileUtils.resolveName(conf,resourceName,false);
}
Program: 94485
Project: 94485
Buggy source:
@Override public void move(final String toResource) throws IOException {
  HadoopFileUtils.move(getConfiguration(),resolveNameToPath(getConfiguration(),getResourceName(),providerProperties,true,true),new Path(toResource));
}

Fixed version (ground truth):
@Override public void move(final String toResource) throws IOException {
  try {
    HadoopFileUtils.move(getConfiguration(),resolveNameToPath(getConfiguration(),getResourceName(),providerProperties,true,true),new Path(toResource));
  }
 catch (  IllegalArgumentException e) {
    throw new IOException(e);
  }
}
Program: 94486
Project: 94486
Buggy source:
public String getResolvedResourceName(final boolean mustExist) throws IOException {
  return resolveNameToPath(conf,getResourceName(),providerProperties,mustExist,true).toUri().toString();
}

Fixed version (ground truth):
public String getResolvedResourceName(final boolean mustExist) throws IOException {
  try {
    return resolveNameToPath(conf,getResourceName(),providerProperties,mustExist,true).toUri().toString();
  }
 catch (  IllegalArgumentException e) {
    throw new IOException(e);
  }
}
Program: 94487
Project: 94487
Buggy source:
public static boolean canWrite(final Configuration conf,String input,final Properties providerProperties) throws IOException {
  Path p=resolveNameToPath(conf,input,providerProperties,true,true);
  return (p == null);
}

Fixed version (ground truth):
public static boolean canWrite(final Configuration conf,String input,final Properties providerProperties) throws IOException {
  try {
    Path p=resolveNameToPath(conf,input,providerProperties,true,true);
    return (p == null);
  }
 catch (  IllegalArgumentException e) {
  }
  return false;
}
Program: 94488
Project: 94488
Buggy source:
public static void delete(final Configuration conf,String input,final Properties providerProperties) throws IOException {
  Path p=resolveNameToPath(conf,input,providerProperties,false,true);
  if (p != null) {
    HadoopFileUtils.delete(conf,p);
  }
}

Fixed version (ground truth):
public static void delete(final Configuration conf,String input,final Properties providerProperties) throws IOException {
  try {
    Path p=resolveNameToPath(conf,input,providerProperties,false,true);
    if (p != null) {
      HadoopFileUtils.delete(conf,p);
    }
  }
 catch (  IllegalArgumentException e) {
    throw new IOException(e);
  }
}
Program: 94489
Project: 94489
Buggy source:
public static boolean exists(final Configuration conf,String input,final Properties providerProperties) throws IOException {
  return resolveNameToPath(conf,input,providerProperties,true,true) != null;
}

Fixed version (ground truth):
public static boolean exists(final Configuration conf,String input,final Properties providerProperties) throws IOException {
  return resolveNameToPath(conf,input,providerProperties,true,false) != null;
}
Program: 94490
Project: 94490
Buggy source:
public static Path resolveName(final Configuration conf,final String input,boolean checkForExistance) throws IOException {
  File f=new File(input);
  if (f.exists()) {
    try {
      return new Path(new URI("String_Node_Str" + input));
    }
 catch (    URISyntaxException e) {
    }
  }
  try {
    Path p=new Path(new URI(input));
    if (!checkForExistance || exists(conf,p)) {
      return p;
    }
  }
 catch (  URISyntaxException e) {
    throw new IOException(e);
  }
  throw new IOException("String_Node_Str" + input);
}

Fixed version (ground truth):
public static Path resolveName(final Configuration conf,final String input,boolean checkForExistance) throws IOException, URISyntaxException {
  File f=new File(input);
  if (f.exists()) {
    try {
      return new Path(new URI("String_Node_Str" + input));
    }
 catch (    URISyntaxException e) {
    }
  }
  Path p=new Path(new URI(input));
  if (!checkForExistance || exists(conf,p)) {
    return p;
  }
  throw new IOException("String_Node_Str" + input);
}
Program: 94491
Project: 94491
Buggy source:
/** 
 * For each subdirectory below srcParent, move that subdirectory below targetParent. If a sub-directory already exists under the targetParent, delete it and then perform the move. This function does not moves files below the parent, just directories.
 * @param fs
 * @param targetParent
 * @throws IOException
 */
public static void moveChildDirectories(final Configuration conf,final Path srcParent,final Path targetParent) throws IOException {
  final FileSystem fs=getFileSystem(conf,srcParent);
  if (!fs.exists(targetParent)) {
    fs.mkdirs(targetParent);
  }
  final FileStatus[] children=fs.listStatus(srcParent);
  for (  final FileStatus stat : children) {
    if (stat.isDir()) {
      final Path srcPath=stat.getPath();
      final String name=srcPath.getName();
      final Path target=new Path(targetParent,name);
      if (fs.exists(target)) {
        fs.delete(target,true);
      }
      if (fs.rename(srcPath,targetParent) == false) {
        final String msg=MessageFormat.format("String_Node_Str",srcPath.toString(),target.toString());
        throw new IOException(msg);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * For each subdirectory below srcParent, move that subdirectory below targetParent. If a sub-directory already exists under the targetParent, delete it and then perform the move. This function does not moves files below the parent, just directories.
 * @param conf
 * @param targetParent
 * @throws IOException
 */
public static void moveChildDirectories(final Configuration conf,final Path srcParent,final Path targetParent) throws IOException {
  final FileSystem fs=getFileSystem(conf,srcParent);
  if (!fs.exists(targetParent)) {
    fs.mkdirs(targetParent);
  }
  final FileStatus[] children=fs.listStatus(srcParent);
  for (  final FileStatus stat : children) {
    if (stat.isDir()) {
      final Path srcPath=stat.getPath();
      final String name=srcPath.getName();
      final Path target=new Path(targetParent,name);
      if (fs.exists(target)) {
        fs.delete(target,true);
      }
      if (fs.rename(srcPath,targetParent) == false) {
        final String msg=MessageFormat.format("String_Node_Str",srcPath.toString(),target.toString());
        throw new IOException(msg);
      }
    }
  }
}
Program: 94492
Project: 94492
Buggy source:
private MapOp _loadResource(String file) throws ParserException {
  List<ResourceMapOpLoader> loaders=getResourceLoaders();
  for (  ResourceMapOpLoader loader : loaders) {
    try {
      MapOp mapOp=loader.loadMapOpFromResource(file,providerProperties);
      if (mapOp != null) {
        return mapOp;
      }
    }
 catch (    Exception e) {
      log.error("String_Node_Str" + file,e);
      throw new ParserException(e.getMessage());
    }
  }
  try {
    AdHocDataProvider dp=DataProviderFactory.getAdHocDataProvider(file,AccessMode.READ,providerProperties);
    if (dp != null) {
      ResourceMapOp pmo=new ResourceMapOp();
      pmo.setOutputName(file);
      return pmo;
    }
  }
 catch (  IOException e) {
    throw new ParserException(String.format("String_Node_Str",file,e.toString()));
  }
  throw new ParserException(String.format("String_Node_Str",file));
}

Fixed version (ground truth):
private MapOp _loadResource(String file) throws ParserException {
  List<ResourceMapOpLoader> loaders=getResourceLoaders();
  for (  ResourceMapOpLoader loader : loaders) {
    try {
      MapOp mapOp=loader.loadMapOpFromResource(file,providerProperties);
      if (mapOp != null) {
        return mapOp;
      }
    }
 catch (    Exception e) {
      log.error("String_Node_Str" + file,e);
      throw new ParserException(e);
    }
  }
  try {
    AdHocDataProvider dp=DataProviderFactory.getAdHocDataProvider(file,AccessMode.READ,providerProperties);
    if (dp != null) {
      ResourceMapOp pmo=new ResourceMapOp();
      pmo.setOutputName(file);
      return pmo;
    }
  }
 catch (  IOException e) {
    log.error("String_Node_Str" + file,e);
    throw new ParserException(String.format("String_Node_Str",file),e);
  }
  throw new ParserException(String.format("String_Node_Str",file));
}
Program: 94493
Project: 94493
Buggy source:
public ParserException(Exception causedBy){
  super(causedBy);
}

Fixed version (ground truth):
public ParserException(String message,Throwable cause){
  super(message,cause);
}
Program: 94494
Project: 94494
Buggy source:
@Test(expected=IllegalArgumentException.class) @Category(UnitTest.class) public void testExistsBadUri1() throws Exception {
  factory.exists("String_Node_Str",conf);
}

Fixed version (ground truth):
@Test @Category(UnitTest.class) public void testExistsBadUri1() throws Exception {
  Assert.assertFalse(factory.exists("String_Node_Str",conf));
}
Program: 94495
Project: 94495
Buggy source:
@Test(expected=IllegalArgumentException.class) @Category(UnitTest.class) public void testExistsBadUri2() throws Exception {
  factory.exists("String_Node_Str",providerProperties);
}

Fixed version (ground truth):
@Test @Category(UnitTest.class) public void testExistsBadUri2() throws Exception {
  Assert.assertFalse(factory.exists("String_Node_Str",providerProperties));
}
Program: 94496
Project: 94496
Buggy source:
@Test(expected=IllegalArgumentException.class) @Category(UnitTest.class) public void testCanWriteBadUri2() throws Exception {
  factory.canWrite("String_Node_Str",providerProperties);
}

Fixed version (ground truth):
@Test @Category(UnitTest.class) public void testCanWriteBadUri2() throws Exception {
  Assert.assertFalse(factory.canWrite("String_Node_Str",providerProperties));
}
Program: 94497
Project: 94497
Buggy source:
@Test(expected=IllegalArgumentException.class) @Category(UnitTest.class) public void testCanWriteBadUri1() throws Exception {
  factory.canWrite("String_Node_Str",conf);
}

Fixed version (ground truth):
@Test @Category(UnitTest.class) public void testCanWriteBadUri1() throws Exception {
  Assert.assertFalse(factory.canWrite("String_Node_Str",conf));
}
Program: 94498
Project: 94498
Buggy source:
@Test(expected=IllegalArgumentException.class) @Category(UnitTest.class) public void testGetResolvedResourceNameInvalidUri() throws Exception {
  HdfsMrsImageDataProvider badprovider=new HdfsMrsImageDataProvider(conf,"String_Node_Str",null);
  badprovider.getResolvedResourceName(true);
}

Fixed version (ground truth):
@Test(expected=IOException.class) @Category(UnitTest.class) public void testGetResolvedResourceNameInvalidUri() throws Exception {
  HdfsMrsImageDataProvider badprovider=new HdfsMrsImageDataProvider(conf,"String_Node_Str",null);
  badprovider.getResolvedResourceName(true);
}
Program: 94499
Project: 94499
Buggy source:
@Test(expected=IllegalArgumentException.class) @Category(UnitTest.class) public void testExistsBadUri() throws Exception {
  HdfsMrsImageDataProvider.exists(conf,"String_Node_Str",null);
}

Fixed version (ground truth):
@Test @Category(UnitTest.class) public void testExistsBadUri() throws Exception {
  Assert.assertFalse(HdfsMrsImageDataProvider.exists(conf,"String_Node_Str",null));
}
Program: 94500
Project: 94500
Buggy source:
@Test(expected=IllegalArgumentException.class) @Category(UnitTest.class) public void testCanWriteBadUri() throws Exception {
  HdfsMrsImageDataProvider.canWrite(conf,"String_Node_Str",null);
}

Fixed version (ground truth):
@Test @Category(UnitTest.class) public void testCanWriteBadUri() throws Exception {
  Assert.assertFalse(HdfsMrsImageDataProvider.canWrite(conf,"String_Node_Str",null));
}
Program: 94501
Project: 94501
Buggy source:
@Test(expected=IllegalArgumentException.class) @Category(UnitTest.class) public void testDeleteBadUri() throws Exception {
  HdfsMrsImageDataProvider.delete(conf,"String_Node_Str",null);
}

Fixed version (ground truth):
@Test(expected=IOException.class) @Category(UnitTest.class) public void testDeleteBadUri() throws Exception {
  HdfsMrsImageDataProvider.delete(conf,"String_Node_Str",null);
}
Program: 94502
Project: 94502
Buggy source:
@Override public boolean nextKeyValue() throws IOException, InterruptedException {
  boolean result=delegateReader.nextKeyValue();
  while (result) {
    Object value=delegateReader.getCurrentValue();
    boolean matchesFilter=(cqlFilter != null) ? cqlFilter.evaluate(value) : true;
    if (matchesFilter) {
      if (value instanceof SimpleFeature) {
        if (cqlFilter != null) {
          cqlFilter.evaluate(value);
        }
        SimpleFeature feature=(SimpleFeature)value;
        GeoWaveVectorIterator.setKeyFromFeature(currKey,feature);
        currValue=GeoWaveVectorIterator.convertToGeometry(feature);
      }
 else {
        throw new IOException("String_Node_Str" + value.getClass().getName());
      }
      return true;
    }
    result=delegateReader.nextKeyValue();
  }
  if (!result) {
    currKey=null;
    currValue=null;
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean nextKeyValue() throws IOException, InterruptedException {
  boolean result=delegateReader.nextKeyValue();
  while (result) {
    Object value=delegateReader.getCurrentValue();
    boolean matchesFilter=(cqlFilter != null) ? cqlFilter.evaluate(value) : true;
    if (matchesFilter) {
      if (value instanceof SimpleFeature) {
        SimpleFeature feature=(SimpleFeature)value;
        GeoWaveVectorIterator.setKeyFromFeature(currKey,feature);
        currValue=GeoWaveVectorIterator.convertToGeometry(feature);
      }
 else {
        throw new IOException("String_Node_Str" + value.getClass().getName());
      }
      return true;
    }
    result=delegateReader.nextKeyValue();
  }
  if (!result) {
    currKey=null;
    currValue=null;
  }
  return result;
}
Program: 94503
Project: 94503
Buggy source:
public abstract int calculateTileCount();

Fixed version (ground truth):
public abstract long calculateTileCount();
Program: 94504
Project: 94504
Buggy source:
@Override public int calculateTileCount(){
  int count=0;
  try {
    final DataOutputBuffer key=new DataOutputBuffer();
    final SequenceFile.Reader[] indexes=getIndexReaders(imagePath,conf);
    for (    final SequenceFile.Reader index : indexes) {
      while (index.nextRawKey(key) >= 0) {
        count++;
      }
    }
    for (    final SequenceFile.Reader reader : indexes) {
      reader.close();
    }
  }
 catch (  final IOException e) {
    throw new MrsTileException(e);
  }
  return count;
}

Fixed version (ground truth):
@Override public long calculateTileCount(){
  int count=0;
  try {
    final FileSystem fs=imagePath.getFileSystem(conf);
    final Path[] names=FileUtil.stat2Paths(fs.listStatus(imagePath));
    Arrays.sort(names);
    final DataOutputBuffer key=new DataOutputBuffer();
    for (    final Path name : names) {
      final FileStatus[] dirFiles=fs.listStatus(name);
      for (      final FileStatus dirFile : dirFiles) {
        if (dirFile.getPath().getName().equals("String_Node_Str")) {
          SequenceFile.Reader index=new SequenceFile.Reader(fs,dirFile.getPath(),conf);
          try {
            while (index.nextRawKey(key) >= 0) {
              count++;
            }
          }
  finally {
            index.close();
          }
        }
      }
    }
    return count;
  }
 catch (  final IOException e) {
    throw new MrsTileException(e);
  }
}
Program: 94505
Project: 94505
Buggy source:
@Override public int calculateTileCount(){
  int zl=context.getZoomlevel();
  try {
    MrsImagePyramidMetadata meta=provider.getMetadataReader().read();
    LongRectangle lr=meta.getOrCreateTileBounds(zl);
    long count=(lr.getMaxX() - lr.getMinX() + 1) * (lr.getMaxY() - lr.getMinY() + 1);
    return (int)count;
  }
 catch (  IOException ioe) {
    return -1;
  }
}

Fixed version (ground truth):
@Override public long calculateTileCount(){
  int zl=context.getZoomlevel();
  try {
    MrsImagePyramidMetadata meta=provider.getMetadataReader().read();
    LongRectangle lr=meta.getOrCreateTileBounds(zl);
    long count=(lr.getMaxX() - lr.getMinX() + 1) * (lr.getMaxY() - lr.getMinY() + 1);
    return count;
  }
 catch (  IOException ioe) {
    return -1;
  }
}
Program: 94506
Project: 94506
Buggy source:
/** 
 * get the number of tiles in the table - not implemented
 */
@Override public int calculateTileCount(){
  throw new NotImplementedException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * get the number of tiles in the table - not implemented
 */
@Override public long calculateTileCount(){
  throw new NotImplementedException("String_Node_Str");
}
Program: 94511
Project: 94511
Buggy source:
public RegionSplitVisitor(TMSUtils.TileBounds region){
  this.region=region;
}

Fixed version (ground truth):
public RegionSplitVisitor(TMSUtils.TileBounds region){
  this.region=region;
  log.debug("String_Node_Str" + region.toString());
}
Program: 94512
Project: 94512
Buggy source:
@Override public boolean accept(TiledInputSplit split){
  int zoom=split.getZoomLevel();
  return splitOverlapsTileBounds(TMSUtils.tileid(split.getStartTileId(),zoom),TMSUtils.tileid(split.getEndTileId(),zoom),region);
}

Fixed version (ground truth):
@Override public boolean accept(TiledInputSplit split){
  int zoom=split.getZoomLevel();
  TMSUtils.Tile startTile=TMSUtils.tileid(split.getStartTileId(),zoom);
  TMSUtils.Tile endTile=TMSUtils.tileid(split.getEndTileId(),zoom);
  boolean result=splitOverlapsTileBounds(TMSUtils.tileid(split.getStartTileId(),zoom),TMSUtils.tileid(split.getEndTileId(),zoom),region);
  if (!result) {
    log.info("String_Node_Str" + split.getStartTileId());
  }
  return result;
}
Program: 94513
Project: 94513
Buggy source:
private static LongRange getSplitBounds(FileSplit split,TileBounds partFileTileBounds,int zoomLevel,FileSystem fs,Configuration conf) throws IOException {
  long startOffset=split.getStart();
  long endOffset=startOffset + split.getLength();
  Path indexPath=new Path(split.getPath().getParent(),"String_Node_Str");
  SequenceFile.Reader reader=new SequenceFile.Reader(fs,indexPath,conf);
  try {
    TileIdWritable tileId;
    try {
      tileId=(TileIdWritable)reader.getKeyClass().newInstance();
    }
 catch (    InstantiationException e) {
      throw new IOException(e);
    }
catch (    IllegalAccessException e) {
      throw new IOException(e);
    }
    LongWritable tileOffset=new LongWritable();
    long startTileId=-1, endTileId=-1;
    while (reader.next(tileId,tileOffset)) {
      if (tileOffset.get() >= startOffset) {
        startTileId=tileId.get();
        break;
      }
    }
    assert(startTileId != -1);
    while (reader.next(tileId,tileOffset) && tileOffset.get() < endOffset) {
      endTileId=tileId.get();
    }
    return new LongRange(startTileId,endTileId);
  }
  finally {
    reader.close();
  }
}

Fixed version (ground truth):
private static LongRange getSplitBounds(FileSplit split,TileBounds partFileTileBounds,int zoomLevel,FileSystem fs,Configuration conf) throws IOException {
  long startOffset=split.getStart();
  long endOffset=startOffset + split.getLength();
  Path indexPath=new Path(split.getPath().getParent(),"String_Node_Str");
  SequenceFile.Reader reader=new SequenceFile.Reader(fs,indexPath,conf);
  try {
    TileIdWritable tileId;
    try {
      tileId=(TileIdWritable)reader.getKeyClass().newInstance();
    }
 catch (    InstantiationException e) {
      throw new IOException(e);
    }
catch (    IllegalAccessException e) {
      throw new IOException(e);
    }
    LongWritable tileOffset=new LongWritable();
    long startTileId=-1;
    while (reader.next(tileId,tileOffset)) {
      if (tileOffset.get() >= startOffset) {
        startTileId=tileId.get();
        break;
      }
    }
    assert(startTileId != -1);
    long endTileId=startTileId;
    while (reader.next(tileId,tileOffset) && tileOffset.get() < endOffset) {
      endTileId=tileId.get();
    }
    return new LongRange(startTileId,endTileId);
  }
  finally {
    reader.close();
  }
}
Program: 94515
Project: 94515
Buggy source:
public Raster getTile(final long tx,final long ty) throws TileNotFoundException {
  if (tx < getMinTileX() || tx > getMaxTileX() || ty < getMinTileY() || ty > getMaxTileY()) {
    final String msg=String.format("String_Node_Str",tx,ty,getMaxTileX(),getMinTileY(),getMaxTileX(),getMaxTileY());
    throw new TileNotFoundException(msg);
  }
  if (reader == null) {
    openReader();
  }
  return reader.get(new TileIdWritable(TMSUtils.tileid(tx,ty,getZoomlevel())));
}

Fixed version (ground truth):
public Raster getTile(final long tx,final long ty) throws TileNotFoundException {
  if (tx < getMinTileX() || tx > getMaxTileX() || ty < getMinTileY() || ty > getMaxTileY()) {
    final String msg=String.format("String_Node_Str",tx,ty,getMinTileX(),getMinTileY(),getMaxTileX(),getMaxTileY());
    throw new TileNotFoundException(msg);
  }
  if (reader == null) {
    openReader();
  }
  return reader.get(new TileIdWritable(TMSUtils.tileid(tx,ty,getZoomlevel())));
}
Program: 94516
Project: 94516
Buggy source:
public void run(final Path input,final String output,final RasterizeVectorPainter.AggregationType aggregationType,final int zoom,final Bounds bounds,final Progress progress,final JobListener jobListener,final String protectionLevel,final Properties providerProperties) throws IOException, JobFailedException, JobCancelledException {
  final Job job=new Job(HadoopUtils.createConfiguration());
  if (inputFormat == null) {
    inputFormat=AutoFeatureInputFormat.class;
  }
  job.setInputFormatClass(inputFormat);
  FileInputFormat.addInputPath(job,input);
  run(job,output,aggregationType,zoom,bounds,progress,jobListener,protectionLevel,providerProperties);
}

Fixed version (ground truth):
public void run(final Configuration conf,final Path input,final String output,final RasterizeVectorPainter.AggregationType aggregationType,final int zoom,final Bounds bounds,final Progress progress,final JobListener jobListener,final String protectionLevel,final Properties providerProperties) throws IOException, JobFailedException, JobCancelledException {
  final Job job=new Job(conf);
  if (inputFormat == null) {
    inputFormat=AutoFeatureInputFormat.class;
  }
  job.setInputFormatClass(inputFormat);
  FileInputFormat.addInputPath(job,input);
  run(job,output,aggregationType,zoom,bounds,progress,jobListener,protectionLevel,providerProperties);
}
Program: 94517
Project: 94517
Buggy source:
@Override public void build(Progress p) throws IOException, JobFailedException, JobCancelledException {
  if (p != null) {
    p.starting();
  }
  MapOp mo=_inputs.get(0);
  String inputPath=null;
  if (mo instanceof VectorReaderMapOp) {
    VectorReaderMapOp vmo=(VectorReaderMapOp)mo;
    inputPath=vmo.getOutputName();
  }
  PgQueryDriver pgd=new PgQueryDriver();
  pgd.setUsername(_username);
  pgd.setPassword(_password);
  pgd.setDbConnection(_dbconnection);
  pgd.run(new Path(inputPath),new Path(_outputName),p,jobListener);
  _output=new BasicInputFormatDescriptor(_outputName);
  if (p != null) {
    p.complete();
  }
}

Fixed version (ground truth):
@Override public void build(Progress p) throws IOException, JobFailedException, JobCancelledException {
  if (p != null) {
    p.starting();
  }
  MapOp mo=_inputs.get(0);
  String inputPath=null;
  if (mo instanceof VectorReaderMapOp) {
    VectorReaderMapOp vmo=(VectorReaderMapOp)mo;
    inputPath=vmo.getOutputName();
  }
  PgQueryDriver pgd=new PgQueryDriver();
  pgd.setUsername(_username);
  pgd.setPassword(_password);
  pgd.setDbConnection(_dbconnection);
  pgd.run(createConfiguration(),new Path(inputPath),new Path(_outputName),p,jobListener);
  _output=new BasicInputFormatDescriptor(_outputName);
  if (p != null) {
    p.complete();
  }
}
Program: 94518
Project: 94518
Buggy source:
@Override public void build(Progress p) throws IOException, JobFailedException, JobCancelledException {
  ProgressHierarchy ph=new ProgressHierarchy(p);
  ph.createChild(1.0f);
  ph.createChild(1.0f);
  RandomizeVectorDriver rvd=new RandomizeVectorDriver();
  MapOp inputMapOp=_inputs.get(0);
  String inputPath=null;
  if (inputMapOp instanceof VectorMapOp) {
    inputPath=((VectorMapOp)inputMapOp).getOutputName();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  rvd.run(new Path(inputPath),new Path(_outputName),p,jobListener);
  _output=new BasicInputFormatDescriptor(_outputName);
}

Fixed version (ground truth):
@Override public void build(Progress p) throws IOException, JobFailedException, JobCancelledException {
  ProgressHierarchy ph=new ProgressHierarchy(p);
  ph.createChild(1.0f);
  ph.createChild(1.0f);
  RandomizeVectorDriver rvd=new RandomizeVectorDriver();
  MapOp inputMapOp=_inputs.get(0);
  String inputPath=null;
  if (inputMapOp instanceof VectorMapOp) {
    inputPath=((VectorMapOp)inputMapOp).getOutputName();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  rvd.run(createConfiguration(),new Path(inputPath),new Path(_outputName),p,jobListener);
  _output=new BasicInputFormatDescriptor(_outputName);
}
Program: 94519
Project: 94519
Buggy source:
public void run(Path sqlPath,Path outputPath,Progress progress,JobListener jobListener) throws IOException, JobFailedException, JobCancelledException {
  Job job=new Job(HadoopUtils.createConfiguration());
  job.setJobName(String.format("String_Node_Str",sqlPath.toString()));
  HadoopUtils.setJar(job,this.getClass());
  Path tmp=HadoopFileUtils.createJobTmp();
  FileSystem fs=HadoopFileUtils.getFileSystem(tmp);
  if (fs.exists(tmp) == false) {
    fs.mkdirs(tmp);
  }
  try {
    HadoopVectorUtils.setupPgQueryInputFormat(job,_username,_password,_dbconnection);
    job.setInputFormatClass(PgQueryInputFormat.class);
    job.setMapperClass(FeatureFilterMapper.class);
    job.setMapOutputKeyClass(LongWritable.class);
    job.setMapOutputValueClass(GeometryWritable.class);
    FileInputFormat.setInputPaths(job,sqlPath);
    job.setNumReduceTasks(0);
    job.setReducerClass(GeometryWritableToGeometryReducer.class);
    job.setOutputFormatClass(CsvOutputFormat.class);
    FileOutputFormat.setOutputPath(job,outputPath);
    MapReduceUtils.runJob(job,progress,jobListener);
  }
  finally {
    fs.delete(tmp,true);
  }
}

Fixed version (ground truth):
public void run(Configuration conf,Path sqlPath,Path outputPath,Progress progress,JobListener jobListener) throws IOException, JobFailedException, JobCancelledException {
  Job job=new Job(conf);
  job.setJobName(String.format("String_Node_Str",sqlPath.toString()));
  HadoopUtils.setJar(job,this.getClass());
  Path tmp=HadoopFileUtils.createJobTmp();
  FileSystem fs=HadoopFileUtils.getFileSystem(tmp);
  if (fs.exists(tmp) == false) {
    fs.mkdirs(tmp);
  }
  try {
    HadoopVectorUtils.setupPgQueryInputFormat(job,_username,_password,_dbconnection);
    job.setInputFormatClass(PgQueryInputFormat.class);
    job.setMapperClass(FeatureFilterMapper.class);
    job.setMapOutputKeyClass(LongWritable.class);
    job.setMapOutputValueClass(GeometryWritable.class);
    FileInputFormat.setInputPaths(job,sqlPath);
    job.setNumReduceTasks(0);
    job.setReducerClass(GeometryWritableToGeometryReducer.class);
    job.setOutputFormatClass(CsvOutputFormat.class);
    FileOutputFormat.setOutputPath(job,outputPath);
    MapReduceUtils.runJob(job,progress,jobListener);
  }
  finally {
    fs.delete(tmp,true);
  }
}
Program: 94520
Project: 94520
Buggy source:
public void run(final Path input,final Path output,final Progress progress,final JobListener jobListener) throws IOException, JobFailedException, JobCancelledException {
  final Job job=new Job(HadoopUtils.createConfiguration());
  if (inputFormat == null) {
    inputFormat=AutoFeatureInputFormat.class;
  }
  job.setInputFormatClass(inputFormat);
  FileInputFormat.addInputPath(job,input);
  run(job,output,progress,jobListener);
}

Fixed version (ground truth):
public void run(final Configuration conf,final Path input,final Path output,final Progress progress,final JobListener jobListener) throws IOException, JobFailedException, JobCancelledException {
  final Job job=new Job(conf);
  if (inputFormat == null) {
    inputFormat=AutoFeatureInputFormat.class;
  }
  job.setInputFormatClass(inputFormat);
  FileInputFormat.addInputPath(job,input);
  run(job,output,progress,jobListener);
}
Program: 94521
Project: 94521
Buggy source:
@Override public void moveOutput(String toName) throws IOException {
  Path toPath=new Path(toName);
  Path sourcePath=new Path(_outputName);
  Configuration conf=HadoopUtils.createConfiguration();
  FileSystem sourceFs=HadoopFileUtils.getFileSystem(conf,sourcePath);
  FileSystem destFs=HadoopFileUtils.getFileSystem(conf,toPath);
  if (!FileUtil.copy(sourceFs,sourcePath,destFs,toPath,false,false,conf)) {
    throw new IOException("String_Node_Str" + _outputName + "String_Node_Str"+ toName.toString()+ "String_Node_Str");
  }
  Path sourceColumns=new Path(_outputName + "String_Node_Str");
  if (sourceFs.exists(sourceColumns)) {
    Path toColumns=new Path(toName.toString() + "String_Node_Str");
    if (FileUtil.copy(sourceFs,sourceColumns,destFs,toColumns,false,false,conf) == false) {
      throw new IOException("String_Node_Str" + sourceColumns.toString() + "String_Node_Str"+ toColumns.toString());
    }
  }
  _outputName=toName;
  _output=new BasicInputFormatDescriptor(_outputName);
}

Fixed version (ground truth):
@Override public void moveOutput(String toName) throws IOException {
  Path toPath=new Path(toName);
  Path sourcePath=new Path(_outputName);
  Configuration conf=createConfiguration();
  FileSystem sourceFs=HadoopFileUtils.getFileSystem(conf,sourcePath);
  FileSystem destFs=HadoopFileUtils.getFileSystem(conf,toPath);
  if (!FileUtil.copy(sourceFs,sourcePath,destFs,toPath,false,false,conf)) {
    throw new IOException("String_Node_Str" + _outputName + "String_Node_Str"+ toName.toString()+ "String_Node_Str");
  }
  Path sourceColumns=new Path(_outputName + "String_Node_Str");
  if (sourceFs.exists(sourceColumns)) {
    Path toColumns=new Path(toName.toString() + "String_Node_Str");
    if (FileUtil.copy(sourceFs,sourceColumns,destFs,toColumns,false,false,conf) == false) {
      throw new IOException("String_Node_Str" + sourceColumns.toString() + "String_Node_Str"+ toColumns.toString());
    }
  }
  _outputName=toName;
  _output=new BasicInputFormatDescriptor(_outputName);
}
Program: 94522
Project: 94522
Buggy source:
public void run(final Path input,final String output,final RasterizeVectorPainter.AggregationType aggregationType,final int zoom,final Bounds bounds,final Progress progress,final JobListener jobListener,final String protectionLevel,final Properties providerProperties) throws IOException, JobFailedException, JobCancelledException {
  final Job job=new Job(HadoopUtils.createConfiguration());
  if (inputFormat == null) {
    inputFormat=AutoFeatureInputFormat.class;
  }
  job.setInputFormatClass(inputFormat);
  FileInputFormat.addInputPath(job,input);
  run(job,output,aggregationType,zoom,bounds,progress,jobListener,protectionLevel,providerProperties);
}

Fixed version (ground truth):
public void run(final Configuration conf,final Path input,final String output,final RasterizeVectorPainter.AggregationType aggregationType,final int zoom,final Bounds bounds,final Progress progress,final JobListener jobListener,final String protectionLevel,final Properties providerProperties) throws IOException, JobFailedException, JobCancelledException {
  final Job job=new Job(conf);
  if (inputFormat == null) {
    inputFormat=AutoFeatureInputFormat.class;
  }
  job.setInputFormatClass(inputFormat);
  FileInputFormat.addInputPath(job,input);
  run(job,output,aggregationType,zoom,bounds,progress,jobListener,protectionLevel,providerProperties);
}
Program: 94523
Project: 94523
Buggy source:
@Override public void build(Progress p) throws IOException, JobFailedException, JobCancelledException {
  if (p != null) {
    p.starting();
  }
  MapOp mo=_inputs.get(0);
  String inputPath=null;
  if (mo instanceof VectorReaderMapOp) {
    VectorReaderMapOp vmo=(VectorReaderMapOp)mo;
    inputPath=vmo.getOutputName();
  }
  PgQueryDriver pgd=new PgQueryDriver();
  pgd.setUsername(_username);
  pgd.setPassword(_password);
  pgd.setDbConnection(_dbconnection);
  pgd.run(new Path(inputPath),new Path(_outputName),p,jobListener);
  _output=new BasicInputFormatDescriptor(_outputName);
  if (p != null) {
    p.complete();
  }
}

Fixed version (ground truth):
@Override public void build(Progress p) throws IOException, JobFailedException, JobCancelledException {
  if (p != null) {
    p.starting();
  }
  MapOp mo=_inputs.get(0);
  String inputPath=null;
  if (mo instanceof VectorReaderMapOp) {
    VectorReaderMapOp vmo=(VectorReaderMapOp)mo;
    inputPath=vmo.getOutputName();
  }
  PgQueryDriver pgd=new PgQueryDriver();
  pgd.setUsername(_username);
  pgd.setPassword(_password);
  pgd.setDbConnection(_dbconnection);
  pgd.run(createConfiguration(),new Path(inputPath),new Path(_outputName),p,jobListener);
  _output=new BasicInputFormatDescriptor(_outputName);
  if (p != null) {
    p.complete();
  }
}
Program: 94524
Project: 94524
Buggy source:
@Override public void build(Progress p) throws IOException, JobFailedException, JobCancelledException {
  ProgressHierarchy ph=new ProgressHierarchy(p);
  ph.createChild(1.0f);
  ph.createChild(1.0f);
  RandomizeVectorDriver rvd=new RandomizeVectorDriver();
  MapOp inputMapOp=_inputs.get(0);
  String inputPath=null;
  if (inputMapOp instanceof VectorMapOp) {
    inputPath=((VectorMapOp)inputMapOp).getOutputName();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  rvd.run(new Path(inputPath),new Path(_outputName),p,jobListener);
  _output=new BasicInputFormatDescriptor(_outputName);
}

Fixed version (ground truth):
@Override public void build(Progress p) throws IOException, JobFailedException, JobCancelledException {
  ProgressHierarchy ph=new ProgressHierarchy(p);
  ph.createChild(1.0f);
  ph.createChild(1.0f);
  RandomizeVectorDriver rvd=new RandomizeVectorDriver();
  MapOp inputMapOp=_inputs.get(0);
  String inputPath=null;
  if (inputMapOp instanceof VectorMapOp) {
    inputPath=((VectorMapOp)inputMapOp).getOutputName();
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  rvd.run(createConfiguration(),new Path(inputPath),new Path(_outputName),p,jobListener);
  _output=new BasicInputFormatDescriptor(_outputName);
}
Program: 94525
Project: 94525
Buggy source:
public void run(Path sqlPath,Path outputPath,Progress progress,JobListener jobListener) throws IOException, JobFailedException, JobCancelledException {
  Job job=new Job(HadoopUtils.createConfiguration());
  job.setJobName(String.format("String_Node_Str",sqlPath.toString()));
  HadoopUtils.setJar(job,this.getClass());
  Path tmp=HadoopFileUtils.createJobTmp();
  FileSystem fs=HadoopFileUtils.getFileSystem(tmp);
  if (fs.exists(tmp) == false) {
    fs.mkdirs(tmp);
  }
  try {
    HadoopVectorUtils.setupPgQueryInputFormat(job,_username,_password,_dbconnection);
    job.setInputFormatClass(PgQueryInputFormat.class);
    job.setMapperClass(FeatureFilterMapper.class);
    job.setMapOutputKeyClass(LongWritable.class);
    job.setMapOutputValueClass(GeometryWritable.class);
    FileInputFormat.setInputPaths(job,sqlPath);
    job.setNumReduceTasks(0);
    job.setReducerClass(GeometryWritableToGeometryReducer.class);
    job.setOutputFormatClass(CsvOutputFormat.class);
    FileOutputFormat.setOutputPath(job,outputPath);
    MapReduceUtils.runJob(job,progress,jobListener);
  }
  finally {
    fs.delete(tmp,true);
  }
}

Fixed version (ground truth):
public void run(Configuration conf,Path sqlPath,Path outputPath,Progress progress,JobListener jobListener) throws IOException, JobFailedException, JobCancelledException {
  Job job=new Job(conf);
  job.setJobName(String.format("String_Node_Str",sqlPath.toString()));
  HadoopUtils.setJar(job,this.getClass());
  Path tmp=HadoopFileUtils.createJobTmp();
  FileSystem fs=HadoopFileUtils.getFileSystem(tmp);
  if (fs.exists(tmp) == false) {
    fs.mkdirs(tmp);
  }
  try {
    HadoopVectorUtils.setupPgQueryInputFormat(job,_username,_password,_dbconnection);
    job.setInputFormatClass(PgQueryInputFormat.class);
    job.setMapperClass(FeatureFilterMapper.class);
    job.setMapOutputKeyClass(LongWritable.class);
    job.setMapOutputValueClass(GeometryWritable.class);
    FileInputFormat.setInputPaths(job,sqlPath);
    job.setNumReduceTasks(0);
    job.setReducerClass(GeometryWritableToGeometryReducer.class);
    job.setOutputFormatClass(CsvOutputFormat.class);
    FileOutputFormat.setOutputPath(job,outputPath);
    MapReduceUtils.runJob(job,progress,jobListener);
  }
  finally {
    fs.delete(tmp,true);
  }
}
Program: 94526
Project: 94526
Buggy source:
public void run(final Path input,final Path output,final Progress progress,final JobListener jobListener) throws IOException, JobFailedException, JobCancelledException {
  final Job job=new Job(HadoopUtils.createConfiguration());
  if (inputFormat == null) {
    inputFormat=AutoFeatureInputFormat.class;
  }
  job.setInputFormatClass(inputFormat);
  FileInputFormat.addInputPath(job,input);
  run(job,output,progress,jobListener);
}

Fixed version (ground truth):
public void run(final Configuration conf,final Path input,final Path output,final Progress progress,final JobListener jobListener) throws IOException, JobFailedException, JobCancelledException {
  final Job job=new Job(conf);
  if (inputFormat == null) {
    inputFormat=AutoFeatureInputFormat.class;
  }
  job.setInputFormatClass(inputFormat);
  FileInputFormat.addInputPath(job,input);
  run(job,output,progress,jobListener);
}
Program: 94527
Project: 94527
Buggy source:
@Override public void moveOutput(String toName) throws IOException {
  Path toPath=new Path(toName);
  Path sourcePath=new Path(_outputName);
  Configuration conf=HadoopUtils.createConfiguration();
  FileSystem sourceFs=HadoopFileUtils.getFileSystem(conf,sourcePath);
  FileSystem destFs=HadoopFileUtils.getFileSystem(conf,toPath);
  if (!FileUtil.copy(sourceFs,sourcePath,destFs,toPath,false,false,conf)) {
    throw new IOException("String_Node_Str" + _outputName + "String_Node_Str"+ toName.toString()+ "String_Node_Str");
  }
  Path sourceColumns=new Path(_outputName + "String_Node_Str");
  if (sourceFs.exists(sourceColumns)) {
    Path toColumns=new Path(toName.toString() + "String_Node_Str");
    if (FileUtil.copy(sourceFs,sourceColumns,destFs,toColumns,false,false,conf) == false) {
      throw new IOException("String_Node_Str" + sourceColumns.toString() + "String_Node_Str"+ toColumns.toString());
    }
  }
  _outputName=toName;
  _output=new BasicInputFormatDescriptor(_outputName);
}

Fixed version (ground truth):
@Override public void moveOutput(String toName) throws IOException {
  Path toPath=new Path(toName);
  Path sourcePath=new Path(_outputName);
  Configuration conf=createConfiguration();
  FileSystem sourceFs=HadoopFileUtils.getFileSystem(conf,sourcePath);
  FileSystem destFs=HadoopFileUtils.getFileSystem(conf,toPath);
  if (!FileUtil.copy(sourceFs,sourcePath,destFs,toPath,false,false,conf)) {
    throw new IOException("String_Node_Str" + _outputName + "String_Node_Str"+ toName.toString()+ "String_Node_Str");
  }
  Path sourceColumns=new Path(_outputName + "String_Node_Str");
  if (sourceFs.exists(sourceColumns)) {
    Path toColumns=new Path(toName.toString() + "String_Node_Str");
    if (FileUtil.copy(sourceFs,sourceColumns,destFs,toColumns,false,false,conf) == false) {
      throw new IOException("String_Node_Str" + sourceColumns.toString() + "String_Node_Str"+ toColumns.toString());
    }
  }
  _outputName=toName;
  _output=new BasicInputFormatDescriptor(_outputName);
}
Program: 94528
Project: 94528
Buggy source:
public void setImageMetadata(final ImageMetadata[] metadata){
  imageData=metadata;
}

Fixed version (ground truth):
public void setImageMetadata(final ImageMetadata[] metadata){
  imageData=metadata;
  if (imageData == null) {
    for (int i=0; i <= maxZoomLevel; i++) {
      imageData=(ImageMetadata[])ArrayUtils.add(imageData,new ImageMetadata());
    }
  }
 else   if (maxZoomLevel < imageData.length) {
    imageData=(ImageMetadata[])ArrayUtils.subarray(imageData,0,maxZoomLevel + 1);
  }
 else   if (maxZoomLevel > imageData.length) {
    for (int i=imageData.length; i <= maxZoomLevel; i++) {
      imageData=(ImageMetadata[])ArrayUtils.add(imageData,new ImageMetadata());
    }
  }
}
Program: 94529
Project: 94529
Buggy source:
public void setImageMetadata(final ImageMetadata[] metadata){
  imageData=metadata;
  if (imageData == null) {
    for (int i=0; i <= maxZoomLevel; i++) {
      imageData=(ImageMetadata[])ArrayUtils.add(imageData,new ImageMetadata());
    }
  }
 else   if (maxZoomLevel < imageData.length) {
    imageData=(ImageMetadata[])ArrayUtils.subarray(imageData,0,maxZoomLevel + 1);
  }
 else   if (maxZoomLevel > imageData.length) {
    for (int i=imageData.length; i <= maxZoomLevel; i++) {
      imageData=(ImageMetadata[])ArrayUtils.add(imageData,new ImageMetadata());
    }
  }
}

Fixed version (ground truth):
public void setImageMetadata(final ImageMetadata[] metadata){
  imageData=metadata;
  if (imageData == null) {
    for (int i=0; i <= maxZoomLevel; i++) {
      imageData=(ImageMetadata[])ArrayUtils.add(imageData,new ImageMetadata());
    }
  }
 else   if ((maxZoomLevel + 1) < imageData.length) {
    imageData=(ImageMetadata[])ArrayUtils.subarray(imageData,0,maxZoomLevel + 1);
  }
 else   if (maxZoomLevel > imageData.length) {
    for (int i=imageData.length; i <= maxZoomLevel; i++) {
      imageData=(ImageMetadata[])ArrayUtils.add(imageData,new ImageMetadata());
    }
  }
}