Program: 50412
Project: 50412
Buggy source:
private void parseCurrentLine(){
  Arrays.fill(columnStarts,0);
  Arrays.fill(columnEnds,0);
  Arrays.fill(fieldStarts,0);
  Arrays.fill(fieldEnds,0);
  columnStarts[0]=0;
  int columnIndex=0;
  int fieldIndex=0;
  lineLength=line.length();
  int lineFieldIndexToColumnIndex[]=new int[numberOfFields];
  Arrays.fill(lineFieldIndexToColumnIndex,-1);
  IntArrayList previousColumnFieldIndices=new IntArrayList();
  for (int i=0; i < lineLength; i++) {
    final char c=line.charAt(i);
    if (c == columnSeparatorCharacter) {
      columnEnds[columnIndex]=i;
      if (columnIndex + 1 < numberOfColumns) {
        columnStarts[columnIndex + 1]=i + 1;
      }
    }
    if (c == columnSeparatorCharacter || c == fieldSeparatorCharacter || (columnIndex >= formatColumnIndex && c == formatFieldSeparatorCharacter)) {
      if (TSV) {
        fieldEnds[columnIndex]=columnEnds[columnIndex];
        fieldStarts[columnIndex]=columnStarts[columnIndex];
        fieldIndex=columnIndex;
        lineFieldIndexToColumnIndex[fieldIndex]=columnIndex;
      }
 else {
        fieldEnds[fieldIndex]=i;
        if (fieldIndex + 1 < numberOfFields) {
          fieldStarts[fieldIndex + 1]=i + 1;
        }
        previousColumnFieldIndices.add(fieldIndex);
        fieldIndex++;
      }
    }
    if (c == columnSeparatorCharacter) {
      push(columnIndex,lineFieldIndexToColumnIndex,previousColumnFieldIndices);
      columnIndex++;
    }
  }
  int numberOfFieldsOnLine=fieldIndex;
  int numberOfColumnsOnLine=columnIndex;
  columnStarts[0]=0;
  columnEnds[numberOfColumnsOnLine]=line.length();
  fieldStarts[0]=0;
  fieldEnds[numberOfFieldsOnLine]=line.length();
  previousColumnFieldIndices.add(fieldIndex);
  push(columnIndex,lineFieldIndexToColumnIndex,previousColumnFieldIndices);
  Arrays.fill(fieldPermutation,-1);
  for (  ColumnInfo c : columns) {
    c.formatIndex=0;
  }
  for (int lineFieldIndex=0; lineFieldIndex <= numberOfFieldsOnLine; lineFieldIndex++) {
    int start=fieldStarts[lineFieldIndex];
    int end=fieldEnds[lineFieldIndex];
    final int cIndex=lineFieldIndexToColumnIndex[lineFieldIndex];
    ColumnInfo column=columnList.get(cIndex);
    int colMinGlobalFieldIndex=Integer.MAX_VALUE;
    int colMaxGlobalFieldIndex=Integer.MIN_VALUE;
    for (    ColumnField f : column.fields) {
      colMinGlobalFieldIndex=Math.min(colMinGlobalFieldIndex,f.globalFieldIndex);
      colMaxGlobalFieldIndex=Math.max(colMaxGlobalFieldIndex,f.globalFieldIndex);
    }
    int formatColumnIndex=TSV ? -1 : formatColumn.columnIndex;
    int startFormatColumn=TSV ? 0 : columnStarts[formatColumnIndex];
    int endFormatColumn=TSV ? 0 : columnEnds[formatColumnIndex];
    MutableString formatSpan=line.substring(startFormatColumn,endFormatColumn);
    formatSpan.compact();
    String[] formatTokens=formatSpan.toString().split(Character.toString(formatFieldSeparatorCharacter));
    for (    ColumnField f : column.fields) {
      if (colMaxGlobalFieldIndex == colMinGlobalFieldIndex) {
        fieldPermutation[f.globalFieldIndex]=lineFieldIndex;
      }
 else {
        int j=start;
        final String id=f.id;
        int matchLength=0;
        for (int i=0; i < id.length(); i++) {
          if (j > end) {
            break;
          }
          char linechar=line.charAt(j);
          if (id.charAt(i) != linechar) {
            matchLength=-1;
            break;
          }
          matchLength++;
          j++;
        }
        if (matchLength == id.length() && line.charAt(j) == '=' || (j == end && f.type == ColumnType.Flag)) {
          fieldPermutation[f.globalFieldIndex]=lineFieldIndex;
          if (f.type != ColumnType.Flag) {
            fieldStarts[lineFieldIndex]+=f.id.length() + 1;
          }
        }
 else {
          if (column.useFormat && column.formatIndex < formatTokens.length) {
            if (f.id.equals(formatTokens[column.formatIndex])) {
              fieldPermutation[f.globalFieldIndex]=lineFieldIndex;
              column.formatIndex++;
              break;
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void parseCurrentLine(){
  Arrays.fill(columnStarts,0);
  Arrays.fill(columnEnds,0);
  Arrays.fill(fieldStarts,0);
  Arrays.fill(fieldEnds,0);
  columnStarts[0]=0;
  int columnIndex=0;
  int fieldIndex=0;
  lineLength=line.length();
  int lineFieldIndexToColumnIndex[]=new int[numberOfFields];
  Arrays.fill(lineFieldIndexToColumnIndex,-1);
  IntArrayList previousColumnFieldIndices=new IntArrayList();
  for (int i=0; i < lineLength; i++) {
    final char c=line.charAt(i);
    if (c == columnSeparatorCharacter) {
      columnEnds[columnIndex]=i;
      if (columnIndex + 1 < numberOfColumns) {
        columnStarts[columnIndex + 1]=i + 1;
      }
    }
    if (c == columnSeparatorCharacter || c == fieldSeparatorCharacter || (columnIndex >= formatColumnIndex && c == formatFieldSeparatorCharacter)) {
      if (TSV) {
        fieldEnds[columnIndex]=columnEnds[columnIndex];
        fieldStarts[columnIndex]=columnStarts[columnIndex];
        fieldIndex=columnIndex;
        lineFieldIndexToColumnIndex[fieldIndex]=columnIndex;
      }
 else {
        fieldEnds[fieldIndex]=i;
        if (fieldIndex + 1 < numberOfFields) {
          fieldStarts[fieldIndex + 1]=i + 1;
        }
        previousColumnFieldIndices.add(fieldIndex);
        fieldIndex++;
      }
    }
    if (c == columnSeparatorCharacter) {
      push(columnIndex,lineFieldIndexToColumnIndex,previousColumnFieldIndices);
      columnIndex++;
    }
  }
  int numberOfFieldsOnLine=fieldIndex;
  int numberOfColumnsOnLine=columnIndex;
  columnStarts[0]=0;
  columnEnds[numberOfColumnsOnLine]=line.length();
  fieldStarts[0]=0;
  fieldEnds[numberOfFieldsOnLine]=line.length();
  previousColumnFieldIndices.add(fieldIndex);
  push(columnIndex,lineFieldIndexToColumnIndex,previousColumnFieldIndices);
  Arrays.fill(fieldPermutation,-1);
  for (  ColumnInfo c : columns) {
    c.formatIndex=0;
  }
  for (int lineFieldIndex=0; lineFieldIndex <= numberOfFieldsOnLine; lineFieldIndex++) {
    int start=fieldStarts[lineFieldIndex];
    int end=fieldEnds[lineFieldIndex];
    final int cIndex=lineFieldIndexToColumnIndex[lineFieldIndex];
    ColumnInfo column=columnList.get(cIndex);
    int colMinGlobalFieldIndex=Integer.MAX_VALUE;
    int colMaxGlobalFieldIndex=Integer.MIN_VALUE;
    for (    ColumnField f : column.fields) {
      colMinGlobalFieldIndex=Math.min(colMinGlobalFieldIndex,f.globalFieldIndex);
      colMaxGlobalFieldIndex=Math.max(colMaxGlobalFieldIndex,f.globalFieldIndex);
    }
    int formatColumnIndex=TSV ? -1 : formatColumn.columnIndex;
    int startFormatColumn=TSV ? 0 : columnStarts[formatColumnIndex];
    int endFormatColumn=TSV ? 0 : columnEnds[formatColumnIndex];
    MutableString formatSpan=line.substring(startFormatColumn,endFormatColumn);
    formatSpan.compact();
    String[] formatTokens=formatSpan.toString().split(Character.toString(formatFieldSeparatorCharacter));
    for (    ColumnField f : column.fields) {
      if (colMaxGlobalFieldIndex == colMinGlobalFieldIndex) {
        fieldPermutation[f.globalFieldIndex]=lineFieldIndex;
      }
 else {
        int j=start;
        final String id=f.id;
        int matchLength=0;
        for (int i=0; i < id.length(); i++) {
          if (j >= end) {
            break;
          }
          char linechar=line.charAt(j);
          if (id.charAt(i) != linechar) {
            matchLength=-1;
            break;
          }
          matchLength++;
          j++;
        }
        if (matchLength == id.length() && line.charAt(j) == '=' || (j == end && f.type == ColumnType.Flag)) {
          fieldPermutation[f.globalFieldIndex]=lineFieldIndex;
          if (f.type != ColumnType.Flag) {
            fieldStarts[lineFieldIndex]+=f.id.length() + 1;
          }
        }
 else {
          if (column.useFormat && column.formatIndex < formatTokens.length) {
            if (f.id.equals(formatTokens[column.formatIndex])) {
              fieldPermutation[f.globalFieldIndex]=lineFieldIndex;
              column.formatIndex++;
              break;
            }
          }
        }
      }
    }
  }
}