Program: 50292
Project: 50292
Buggy source:
/** 
 * Read the header of this alignment.
 * @throws java.io.IOException If an error occurs.
 */
@Override public final void readHeader() throws IOException {
  if (!isHeaderLoaded()) {
    final IntSet targetNumbers=new IntArraySet();
    int readerIndex=0;
    ObjectList<String> alignerNames=new ObjectArrayList<String>();
    ObjectList<String> alignerVersions=new ObjectArrayList<String>();
    numberOfQueries=0;
    smallestQueryIndex=Integer.MAX_VALUE;
    largestQueryIndex=adjustQueryIndices ? Integer.MIN_VALUE : 0;
    readOriginPermutations=new int[readers.length][];
    for (    final AlignmentReader reader : readers) {
      reader.readHeader();
      String alignerName=reader.getAlignerName();
      String alignerVersion=reader.getAlignerVersion();
      if (!(alignerNames.contains(alignerName) && alignerVersions.contains(alignerVersion))) {
        alignerNames.add(alignerName);
        alignerVersions.add(alignerVersion);
      }
      smallestQueryIndex=Math.min(reader.getSmallestSplitQueryIndex(),smallestQueryIndex);
      largestQueryIndex=adjustQueryIndices ? Math.max(largestQueryIndex,0) + 1 + reader.getLargestSplitQueryIndex() : Math.max(reader.getLargestSplitQueryIndex(),largestQueryIndex);
      targetNumbers.add(reader.getNumberOfTargets());
      final int numQueriesForReader=reader.getNumberOfQueries();
      numQueriesPerReader[readerIndex]=numQueriesForReader;
      numberOfQueries+=numQueriesForReader;
      numberOfAlignedReads+=reader.getNumberOfAlignedReads();
      mergeReadOrigins(readerIndex,reader.getReadOriginInfo().getPbList());
      readerIndex++;
    }
    alignerName=alignerNames.toString();
    alignerVersion=alignerVersions.toString();
    if (targetNumbers.size() != 1) {
      throw new IllegalArgumentException("String_Node_Str" + targetNumbers.toString());
    }
 else {
      this.numberOfTargets=targetNumbers.iterator().nextInt();
    }
    targetIdentifiers=new IndexedIdentifier();
    boolean error=false;
    for (    final AlignmentReader reader : readers) {
      IndexedIdentifier targetIds=reader.getTargetIdentifiers();
      for (      MutableString key : targetIds.keySet()) {
        if (!targetIdentifiers.containsKey(key)) {
          targetIdentifiers.put(key,targetIds.getInt(key));
        }
 else {
          final int globalValue=targetIdentifiers.getInt(key);
          final int localValue=targetIds.getInt(key);
          if (globalValue != localValue) {
            error=true;
            LOG.error(String.format("String_Node_Str",key,globalValue,localValue,reader.basename()));
          }
        }
      }
    }
    if (error) {
      throw new RuntimeException("String_Node_Str");
    }
    targetLengths=new int[targetIdentifiers.size()];
    for (int targetIndex=0; targetIndex < targetIdentifiers.size(); targetIndex++) {
      int maxLength=-1;
      for (      final AlignmentReader reader : readers) {
        final int[] readerLengths=reader.getTargetLength();
        if (readerLengths != null && readerLengths.length > targetIndex) {
          maxLength=Math.max(readerLengths[targetIndex],maxLength);
          targetLengths[targetIndex]=maxLength;
        }
      }
    }
    for (int i=0; i < queryIndexOffset.length; i++) {
      queryIndexOffset[i]=adjustQueryIndices ? i == 0 ? 0 : readers[i - 1].getLargestSplitQueryIndex() + 1 : 0;
    }
  }
  setHeaderLoaded(true);
}

Fixed version (ground truth):
/** 
 * Read the header of this alignment.
 * @throws java.io.IOException If an error occurs.
 */
@Override public final void readHeader() throws IOException {
  if (!isHeaderLoaded()) {
    final IntSet targetNumbers=new IntArraySet();
    int readerIndex=0;
    ObjectList<String> alignerNames=new ObjectArrayList<String>();
    ObjectList<String> alignerVersions=new ObjectArrayList<String>();
    numberOfQueries=0;
    smallestQueryIndex=Integer.MAX_VALUE;
    largestQueryIndex=adjustQueryIndices ? Integer.MIN_VALUE : 0;
    readOriginPermutations=new int[readers.length][];
    for (    final AlignmentReader reader : readers) {
      reader.readHeader();
      String alignerName=reader.getAlignerName();
      String alignerVersion=reader.getAlignerVersion();
      if (!(alignerNames.contains(alignerName) && alignerVersions.contains(alignerVersion))) {
        alignerNames.add(alignerName);
        alignerVersions.add(alignerVersion);
      }
      smallestQueryIndex=Math.min(reader.getSmallestSplitQueryIndex(),smallestQueryIndex);
      largestQueryIndex=adjustQueryIndices ? Math.max(largestQueryIndex,0) + 1 + reader.getLargestSplitQueryIndex() : Math.max(reader.getLargestSplitQueryIndex(),largestQueryIndex);
      targetNumbers.add(reader.getNumberOfTargets());
      final int numQueriesForReader=reader.getNumberOfQueries();
      numQueriesPerReader[readerIndex]=numQueriesForReader;
      numberOfQueries+=numQueriesForReader;
      numberOfAlignedReads+=reader.getNumberOfAlignedReads();
      mergeReadOrigins(readerIndex,reader.getReadOriginInfo().getPbList(),readers.length);
      readerIndex++;
    }
    alignerName=alignerNames.toString();
    alignerVersion=alignerVersions.toString();
    if (targetNumbers.size() != 1) {
      throw new IllegalArgumentException("String_Node_Str" + targetNumbers.toString());
    }
 else {
      this.numberOfTargets=targetNumbers.iterator().nextInt();
    }
    targetIdentifiers=new IndexedIdentifier();
    boolean error=false;
    for (    final AlignmentReader reader : readers) {
      IndexedIdentifier targetIds=reader.getTargetIdentifiers();
      for (      MutableString key : targetIds.keySet()) {
        if (!targetIdentifiers.containsKey(key)) {
          targetIdentifiers.put(key,targetIds.getInt(key));
        }
 else {
          final int globalValue=targetIdentifiers.getInt(key);
          final int localValue=targetIds.getInt(key);
          if (globalValue != localValue) {
            error=true;
            LOG.error(String.format("String_Node_Str",key,globalValue,localValue,reader.basename()));
          }
        }
      }
    }
    if (error) {
      throw new RuntimeException("String_Node_Str");
    }
    targetLengths=new int[targetIdentifiers.size()];
    for (int targetIndex=0; targetIndex < targetIdentifiers.size(); targetIndex++) {
      int maxLength=-1;
      for (      final AlignmentReader reader : readers) {
        final int[] readerLengths=reader.getTargetLength();
        if (readerLengths != null && readerLengths.length > targetIndex) {
          maxLength=Math.max(readerLengths[targetIndex],maxLength);
          targetLengths[targetIndex]=maxLength;
        }
      }
    }
    for (int i=0; i < queryIndexOffset.length; i++) {
      queryIndexOffset[i]=adjustQueryIndices ? i == 0 ? 0 : readers[i - 1].getLargestSplitQueryIndex() + 1 : 0;
    }
  }
  setHeaderLoaded(true);
}