Program: 94514
Project: 94514
Buggy source:
@Override public List<InputSplit> getSplits(JobContext context) throws IOException {
  Configuration conf=context.getConfiguration();
  SplitFile sf=new SplitFile(conf);
  TiledInputFormatContext ifContext=TiledInputFormatContext.load(conf);
  HdfsMrsImageDataProvider dp=new HdfsMrsImageDataProvider(context.getConfiguration(),input,null);
  Path inputWithZoom=new Path(dp.getResourcePath(true),"String_Node_Str" + ifContext.getZoomLevel());
  Path splitPath=new Path(inputWithZoom,SplitFile.SPLIT_FILE);
  FileSystem fs=splitPath.getFileSystem(conf);
  if (!fs.exists(splitPath)) {
    splitPath=new Path(inputWithZoom,SplitFile.OLD_SPLIT_FILE);
  }
  List<Long> splitFileSplits=sf.readSplits(fs.makeQualified(splitPath).toString());
  MrsImagePyramidMetadataReader metadataReader=dp.getMetadataReader();
  MrsImagePyramidMetadata metadata=metadataReader.read();
  LongRectangle tileBounds=metadata.getTileBounds(ifContext.getZoomLevel());
  List<InputSplit> actualSplits=super.getSplits(context);
  List<InputSplit> result=new ArrayList<InputSplit>(actualSplits.size());
  for (  InputSplit actualSplit : actualSplits) {
    if (!(actualSplit instanceof FileSplit)) {
      throw new IOException("String_Node_Str" + actualSplit.getClass().getCanonicalName());
    }
    FileSplit fileSplit=(FileSplit)actualSplit;
    String partFile=fileSplit.getPath().getParent().getName();
    if (!partFile.startsWith("String_Node_Str")) {
      throw new IOException("String_Node_Str" + partFile);
    }
    String indexStr=partFile.substring(partFile.lastIndexOf('-') + 1,partFile.length());
    int index=Integer.valueOf(indexStr);
    if (index < 0 || index > splitFileSplits.size()) {
      throw new IOException("String_Node_Str" + index + "String_Node_Str"+ partFile+ "String_Node_Str"+ (splitFileSplits.size() - 1));
    }
    long endTileId=-1;
    if (index < splitFileSplits.size()) {
      endTileId=splitFileSplits.get(index);
    }
 else {
      endTileId=TMSUtils.tileid(tileBounds.getMaxX(),tileBounds.getMaxY(),ifContext.getZoomLevel());
    }
    TMSUtils.Tile endTile=TMSUtils.tileid(endTileId,ifContext.getZoomLevel());
    Path indexPath=new Path(fileSplit.getPath().getParent(),"String_Node_Str");
    SequenceFile.Reader reader=new SequenceFile.Reader(fs,indexPath,conf);
    TileIdWritable key;
    try {
      key=(TileIdWritable)reader.getKeyClass().newInstance();
      reader.next(key);
    }
 catch (    InstantiationException e) {
      throw new IOException(e);
    }
catch (    IllegalAccessException e) {
      throw new IOException(e);
    }
 finally {
      if (reader != null) {
        reader.close();
      }
    }
    long startTileId=key.get();
    TMSUtils.Tile startTile=TMSUtils.tileid(startTileId,ifContext.getZoomLevel());
    TileBounds partFileTileBounds=new TileBounds(startTile.tx,startTile.ty,endTile.tx,endTile.ty);
    Bounds partFileBounds=TMSUtils.tileToBounds(partFileTileBounds,ifContext.getZoomLevel(),metadata.getTilesize());
    org.mrgeo.utils.Bounds requestedBounds=ifContext.getBounds();
    if (requestedBounds != null) {
      Bounds userBounds=TMSUtils.Bounds.convertOldToNewBounds(requestedBounds);
      if (userBounds.intersect(partFileBounds,false)) {
        LongRange splitTileIdRange=getSplitBounds(fileSplit,partFileTileBounds,ifContext.getZoomLevel(),fs,conf);
        TileBounds userTileBounds=TMSUtils.boundsToTile(userBounds,ifContext.getZoomLevel(),metadata.getTilesize());
        TMSUtils.Tile partStartTile=TMSUtils.tileid(splitTileIdRange.getMinimumLong(),ifContext.getZoomLevel());
        TMSUtils.Tile partEndTile=TMSUtils.tileid(splitTileIdRange.getMaximumLong(),ifContext.getZoomLevel());
        TileBounds splitTileBounds=new TileBounds(partStartTile.tx,partStartTile.ty,partEndTile.tx,partEndTile.ty);
        Bounds splitBounds=TMSUtils.tileToBounds(splitTileBounds,ifContext.getZoomLevel(),metadata.getTilesize());
        if (userBounds.intersect(splitBounds,false)) {
          LOG.info(String.format("String_Node_Str",fileSplit,splitBounds,splitTileIdRange,userBounds,userTileBounds));
          result.add(new TiledInputSplit(actualSplit,splitTileIdRange.getMinimumLong(),splitTileIdRange.getMaximumLong(),ifContext.getZoomLevel(),metadata.getTilesize()));
        }
 else {
        }
      }
 else {
      }
    }
 else {
      result.add(new TiledInputSplit(actualSplit,startTileId,endTileId,ifContext.getZoomLevel(),metadata.getTilesize()));
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public List<InputSplit> getSplits(JobContext context) throws IOException {
  Configuration conf=context.getConfiguration();
  SplitFile sf=new SplitFile(conf);
  TiledInputFormatContext ifContext=TiledInputFormatContext.load(conf);
  HdfsMrsImageDataProvider dp=new HdfsMrsImageDataProvider(context.getConfiguration(),input,null);
  Path inputWithZoom=new Path(dp.getResourcePath(true),"String_Node_Str" + ifContext.getZoomLevel());
  Path splitPath=new Path(inputWithZoom,SplitFile.SPLIT_FILE);
  FileSystem fs=splitPath.getFileSystem(conf);
  if (!fs.exists(splitPath)) {
    splitPath=new Path(inputWithZoom,SplitFile.OLD_SPLIT_FILE);
  }
  List<Long> splitFileSplits=sf.readSplits(fs.makeQualified(splitPath).toString());
  MrsImagePyramidMetadataReader metadataReader=dp.getMetadataReader();
  MrsImagePyramidMetadata metadata=metadataReader.read();
  LongRectangle tileBounds=metadata.getTileBounds(ifContext.getZoomLevel());
  List<InputSplit> actualSplits=super.getSplits(context);
  List<InputSplit> result=new ArrayList<InputSplit>(actualSplits.size());
  for (  InputSplit actualSplit : actualSplits) {
    if (!(actualSplit instanceof FileSplit)) {
      throw new IOException("String_Node_Str" + actualSplit.getClass().getCanonicalName());
    }
    FileSplit fileSplit=(FileSplit)actualSplit;
    String partFile=fileSplit.getPath().getParent().getName();
    if (!partFile.startsWith("String_Node_Str")) {
      throw new IOException("String_Node_Str" + partFile);
    }
    String indexStr=partFile.substring(partFile.lastIndexOf('-') + 1,partFile.length());
    int index=Integer.valueOf(indexStr);
    if (index < 0 || index > splitFileSplits.size()) {
      throw new IOException("String_Node_Str" + index + "String_Node_Str"+ partFile+ "String_Node_Str"+ (splitFileSplits.size() - 1));
    }
    long endTileId=-1;
    if (index < splitFileSplits.size()) {
      endTileId=splitFileSplits.get(index);
    }
 else {
      endTileId=TMSUtils.tileid(tileBounds.getMaxX(),tileBounds.getMaxY(),ifContext.getZoomLevel());
    }
    TMSUtils.Tile endTile=TMSUtils.tileid(endTileId,ifContext.getZoomLevel());
    Path indexPath=new Path(fileSplit.getPath().getParent(),"String_Node_Str");
    SequenceFile.Reader reader=new SequenceFile.Reader(fs,indexPath,conf);
    TileIdWritable key;
    try {
      key=(TileIdWritable)reader.getKeyClass().newInstance();
      reader.next(key);
    }
 catch (    InstantiationException e) {
      throw new IOException(e);
    }
catch (    IllegalAccessException e) {
      throw new IOException(e);
    }
 finally {
      if (reader != null) {
        reader.close();
      }
    }
    long startTileId=key.get();
    TMSUtils.Tile startTile=TMSUtils.tileid(startTileId,ifContext.getZoomLevel());
    TileBounds partFileTileBounds=new TileBounds(startTile.tx,startTile.ty,endTile.tx,endTile.ty);
    Bounds partFileBounds=TMSUtils.tileToBounds(partFileTileBounds,ifContext.getZoomLevel(),metadata.getTilesize());
    org.mrgeo.utils.Bounds requestedBounds=ifContext.getBounds();
    if (requestedBounds != null) {
      Bounds userBounds=TMSUtils.Bounds.convertOldToNewBounds(requestedBounds);
      if (userBounds.intersect(partFileBounds,false)) {
        LongRange splitTileIdRange=getSplitBounds(fileSplit,partFileTileBounds,ifContext.getZoomLevel(),fs,conf);
        if (tileRangeIntersects(splitTileIdRange,ifContext.getZoomLevel(),ifContext.getTileSize(),tileBounds.getMinX(),tileBounds.getMaxX(),userBounds)) {
          result.add(new TiledInputSplit(actualSplit,splitTileIdRange.getMinimumLong(),splitTileIdRange.getMaximumLong(),ifContext.getZoomLevel(),metadata.getTilesize()));
        }
 else {
        }
      }
 else {
      }
    }
 else {
      result.add(new TiledInputSplit(actualSplit,startTileId,endTileId,ifContext.getZoomLevel(),metadata.getTilesize()));
    }
  }
  return result;
}