Program: 173237
Project: 173237
Buggy source:
/** 
 * Computes the input splits for the file. By default, one file block is one split. If more splits are requested than blocks are available, then a split may be a fraction of a block and splits may cross block boundaries.
 * @param minNumSplits The minimum desired number of file splits.
 * @return The computed file splits.
 */
@Override public FileInputSplit[] createInputSplits(int minNumSplits) throws IOException {
  if (minNumSplits < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  minNumSplits=Math.max(minNumSplits,this.numSplits);
  final Path path=this.filePath;
  final List<FileInputSplit> inputSplits=new ArrayList<FileInputSplit>(minNumSplits);
  List<FileStatus> files=new ArrayList<FileStatus>();
  long totalLength=0;
  final FileSystem fs=path.getFileSystem();
  final FileStatus pathFile=fs.getFileStatus(path);
  if (pathFile.isDir()) {
    totalLength+=sumFilesInDir(path,files,true);
  }
 else {
    files.add(pathFile);
    totalLength+=pathFile.getLen();
  }
  if (totalLength % this.recordLength != 0)   throw new IllegalStateException("String_Node_Str");
  long numberOfRecords=totalLength / this.recordLength;
  long minRecordsForSplit=Math.floorDiv(numberOfRecords,minNumSplits);
  long oddRecords=numberOfRecords % minNumSplits;
  int splitNum=0;
  for (  final FileStatus file : files) {
    final long len=file.getLen();
    final long blockSize=file.getBlockSize();
    final long minSplitSize=minRecordsForSplit * this.recordLength;
    long currentSplitSize=minSplitSize;
    long halfSplit=currentSplitSize >>> 1;
    if (oddRecords > 0) {
      currentSplitSize=currentSplitSize + this.recordLength;
      oddRecords--;
    }
    if (len > 0) {
      final BlockLocation[] blocks=fs.getFileBlockLocations(file,0,len);
      Arrays.sort(blocks);
      long bytesUnassigned=len;
      long position=0;
      int blockIndex=0;
      while (bytesUnassigned >= currentSplitSize) {
        blockIndex=getBlockIndexForPosition(blocks,position,halfSplit,blockIndex);
        FileInputSplit fis=new FileInputSplit(splitNum++,file.getPath(),position,currentSplitSize,blocks[blockIndex].getHosts());
        inputSplits.add(fis);
        position+=currentSplitSize;
        bytesUnassigned-=currentSplitSize;
      }
    }
 else {
      throw new IllegalStateException("String_Node_Str" + file.getPath() + "String_Node_Str");
    }
  }
  return inputSplits.toArray(new FileInputSplit[inputSplits.size()]);
}

Fixed version (ground truth):
/** 
 * Computes the input splits for the file. By default, one file block is one split. If more splits are requested than blocks are available, then a split may be a fraction of a block and splits may cross block boundaries.
 * @param minNumSplits The minimum desired number of file splits.
 * @return The computed file splits.
 */
@Override public FileInputSplit[] createInputSplits(int minNumSplits) throws IOException {
  if (minNumSplits < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int curminNumSplits=Math.max(minNumSplits,this.numSplits);
  final Path path=this.filePath;
  final List<FileInputSplit> inputSplits=new ArrayList<FileInputSplit>(curminNumSplits);
  List<FileStatus> files=new ArrayList<FileStatus>();
  long totalLength=0;
  final FileSystem fs=path.getFileSystem();
  final FileStatus pathFile=fs.getFileStatus(path);
  if (pathFile.isDir()) {
    totalLength+=sumFilesInDir(path,files,true);
  }
 else {
    files.add(pathFile);
    totalLength+=pathFile.getLen();
  }
  if (totalLength % this.recordLength != 0) {
    throw new IllegalStateException("String_Node_Str");
  }
  long numberOfRecords=totalLength / this.recordLength;
  long minRecordsForSplit=Math.floorDiv(numberOfRecords,minNumSplits);
  long oddRecords=numberOfRecords % minNumSplits;
  int splitNum=0;
  for (  final FileStatus file : files) {
    final long len=file.getLen();
    final long blockSize=file.getBlockSize();
    final long minSplitSize=minRecordsForSplit * this.recordLength;
    long currentSplitSize=minSplitSize;
    long halfSplit=currentSplitSize >>> 1;
    if (oddRecords > 0) {
      currentSplitSize=currentSplitSize + this.recordLength;
      oddRecords--;
    }
    if (len > 0) {
      final BlockLocation[] blocks=fs.getFileBlockLocations(file,0,len);
      Arrays.sort(blocks);
      long bytesUnassigned=len;
      long position=0;
      int blockIndex=0;
      while (bytesUnassigned >= currentSplitSize) {
        blockIndex=getBlockIndexForPosition(blocks,position,halfSplit,blockIndex);
        FileInputSplit fis=new FileInputSplit(splitNum++,file.getPath(),position,currentSplitSize,blocks[blockIndex].getHosts());
        inputSplits.add(fis);
        position+=currentSplitSize;
        bytesUnassigned-=currentSplitSize;
      }
    }
 else {
      throw new IllegalStateException("String_Node_Str" + file.getPath() + "String_Node_Str");
    }
  }
  return inputSplits.toArray(new FileInputSplit[inputSplits.size()]);
}