Program: 31952
Project: 31952
Buggy source:
protected List<List<FileSplit>> getCrossValidationSplits(JobContext job,int count) throws IOException {
  LOG.info("String_Node_Str",count);
  List<FileStatus> files=listCrossValidationStatus(job);
  List<FileSplit> current=new ArrayList<FileSplit>();
  List<List<FileSplit>> validationList=new ArrayList<List<FileSplit>>();
  long lengthSum=0L;
  for (  FileStatus file : files) {
    Path path=file.getPath();
    if (isPigOrHadoopMetaFile(path)) {
      continue;
    }
    lengthSum+=file.getLen();
  }
  long size=lengthSum / count + 1;
  long remaining=0L;
  for (  FileStatus file : files) {
    Path path=file.getPath();
    if (isPigOrHadoopMetaFile(path)) {
      continue;
    }
    FileSystem fs=path.getFileSystem(job.getConfiguration());
    long offset=0L;
    long length=file.getLen();
    if (length + remaining >= size) {
      long cut=(size - remaining) >= length ? length : (size - remaining);
      current.add(getFileSplit(fs,file,offset,cut));
      offset=cut;
      remaining=length - cut;
      validationList.add(current);
      current=new ArrayList<FileSplit>();
      while (remaining >= size) {
        current.add(getFileSplit(fs,file,offset,size));
        validationList.add(current);
        current=new ArrayList<FileSplit>();
        remaining-=size;
        offset+=size;
      }
      if (remaining > 0) {
        current.add(getFileSplit(fs,file,offset,remaining));
      }
    }
 else {
      current.add(getFileSplit(fs,file,0,length));
      remaining+=length;
    }
  }
  if (current.size() > 0) {
    validationList.add(current);
  }
  LOG.info("String_Node_Str",validationList.size());
  return validationList;
}

Fixed version (ground truth):
protected List<List<FileSplit>> getCrossValidationSplits(JobContext job,int count) throws IOException {
  LOG.debug("String_Node_Str",count);
  List<FileStatus> files=listCrossValidationStatus(job);
  List<FileSplit> current=new ArrayList<FileSplit>();
  List<List<FileSplit>> validationList=new ArrayList<List<FileSplit>>();
  long lengthSum=0L;
  for (  FileStatus file : files) {
    Path path=file.getPath();
    if (isPigOrHadoopMetaFile(path)) {
      continue;
    }
    lengthSum+=file.getLen();
  }
  long size=lengthSum / count + 1;
  long remaining=0L;
  for (  FileStatus file : files) {
    Path path=file.getPath();
    if (isPigOrHadoopMetaFile(path)) {
      continue;
    }
    FileSystem fs=path.getFileSystem(job.getConfiguration());
    long offset=0L;
    long length=file.getLen();
    if (length + remaining >= size) {
      long cut=(size - remaining) >= length ? length : (size - remaining);
      current.add(getFileSplit(fs,file,offset,cut));
      offset=cut;
      remaining=length - cut;
      validationList.add(current);
      current=new ArrayList<FileSplit>();
      while (remaining >= size) {
        current.add(getFileSplit(fs,file,offset,size));
        validationList.add(current);
        current=new ArrayList<FileSplit>();
        remaining-=size;
        offset+=size;
      }
      if (remaining > 0) {
        current.add(getFileSplit(fs,file,offset,remaining));
      }
    }
 else {
      current.add(getFileSplit(fs,file,0,length));
      remaining+=length;
    }
  }
  if (current.size() > 0) {
    validationList.add(current);
  }
  LOG.debug("String_Node_Str",validationList.size());
  return validationList;
}