Program: 50333
Project: 50333
Buggy source:
private void findSequenceVariations(){
  char refChar, queryChar;
  int readIndex, refPosition;
  int genomicLength=ref.length();
  int paddedLength=numLeftClipped + genomicLength + numRightClipped;
  boolean tooBig=false;
  int tooBigReadIndex=0, tooBigRefPosition=0;
  refPositions.size(10);
  readIndexes.size(paddedLength);
  refPositions.size(paddedLength);
  refPosition=0;
  readIndex=0;
  for (int i=0; i < paddedLength; i++) {
    if (i < numLeftClipped) {
      readIndex++;
    }
 else     if (i >= (genomicLength + numLeftClipped)) {
      readIndex++;
    }
 else {
      refChar=Character.toUpperCase(ref.charAt(i - numLeftClipped));
      if (refChar != '-') {
        refPosition++;
      }
      if (reverseStrand) {
        final int index=genomicLength - (i - numLeftClipped) - 1;
        if (index >= query.length()) {
          System.out.printf("String_Node_Str",index,query);
        }
 else {
          queryChar=Character.toUpperCase(query.charAt(index));
          if (queryChar != '-') {
            readIndex++;
          }
        }
      }
 else {
        final int index=i - numLeftClipped;
        if (index >= query.length()) {
          System.out.printf("String_Node_Str",index,query);
        }
 else {
          queryChar=Character.toUpperCase(query.charAt(index));
          if (queryChar != '-') {
            readIndex++;
          }
        }
      }
    }
    refPositions.set(i,refPosition);
    if (reverseStrand) {
      readIndexes.set(paddedLength - i - 1,readIndex);
    }
 else {
      readIndexes.set(i,readIndex);
    }
  }
  if (debug && LOG.isDebugEnabled()) {
    debugSequences();
    logval.setLength(0);
    logval.append("String_Node_Str");
    for (int i=0; i < paddedLength; i++) {
      logval.append(String.format("String_Node_Str",refPositions.get(i) % 10));
    }
    LOG.debug(logval.toString());
    logval.setLength(0);
    logval.append("String_Node_Str");
    for (int i=0; i < paddedLength; i++) {
      logval.append(String.format("String_Node_Str",readIndexes.get(i) % 10));
    }
    LOG.debug(logval.toString());
    LOG.debug("String_Node_Str");
    logval.setLength(0);
    for (int i=0; i < paddedLength; i++) {
      if (i < numLeftClipped) {
        refChar='_';
      }
 else       if (i >= (genomicLength + numLeftClipped)) {
        refChar='_';
      }
 else {
        refChar=ref.charAt(i - numLeftClipped);
      }
      logval.append(String.format("String_Node_Str",i,refChar,refPositions.get(i)));
    }
    LOG.debug(logval.toString());
    LOG.debug("String_Node_Str");
    logval.setLength(0);
    for (int i=0; i < paddedLength; i++) {
      if (i < numLeftClipped) {
        queryChar='_';
      }
 else       if (i >= (numLeftClipped + genomicLength)) {
        queryChar='_';
      }
 else {
        queryChar=query.charAt(i - numLeftClipped);
      }
      logval.append(String.format("String_Node_Str",i,queryChar,readIndexes.get(i)));
    }
    LOG.debug(logval.toString());
    LOG.debug(String.format("String_Node_Str",numLeftClipped,numRightClipped));
  }
  for (int queryI=numLeftClipped; queryI < numLeftClipped + genomicLength; queryI++) {
    refPosition=refPositions.get(queryI);
    readIndex=readIndexes.get(queryI);
    final int i=queryI - numLeftClipped;
    if (readIndex > queryLength && !tooBig) {
      tooBig=true;
      tooBigReadIndex=readIndex;
      tooBigRefPosition=refPosition;
    }
    refChar=Character.toUpperCase(ref.charAt(i));
    queryChar=Character.toUpperCase(query.charAt(i));
    boolean hasQual;
    byte qualChar;
    if (qual.length() > 0 && queryChar != '-') {
      hasQual=true;
      qualChar=qualityEncoding.asciiEncodingToPhredQualityScore(qual.charAt(i));
    }
 else {
      hasQual=false;
      qualChar=minQualValue;
    }
    if (refChar != queryChar) {
      sequenceVariations.add(new SamSequenceVariation(refPosition,refChar,readIndex,queryChar,hasQual,qualChar));
    }
  }
  if (tooBig) {
    if (debug && LOG.isDebugEnabled()) {
      LOG.debug(String.format("String_Node_Str",tooBigReadIndex,tooBigRefPosition));
      LOG.debug(String.format("String_Node_Str",queryIndex));
      if (sourceQuery.length() > 0) {
        LOG.debug(String.format("String_Node_Str",sourceQuery));
      }
 else {
        LOG.debug("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
private void findSequenceVariations(){
  char refChar, queryChar;
  int readIndex, refPosition;
  int genomicLength=ref.length();
  int paddedLength=numLeftClipped + genomicLength + numRightClipped;
  boolean tooBig=false;
  int tooBigReadIndex=0, tooBigRefPosition=0;
  refPositions.size(10);
  readIndexes.size(paddedLength);
  refPositions.size(paddedLength);
  refPosition=0;
  readIndex=0;
  for (int i=0; i < paddedLength; i++) {
    if (i < numLeftClipped) {
      readIndex++;
    }
 else     if (i >= (genomicLength + numLeftClipped)) {
      readIndex++;
    }
 else {
      refChar=Character.toUpperCase(ref.charAt(i - numLeftClipped));
      if (refChar != '-') {
        refPosition++;
      }
      if (reverseStrand) {
        final int index=genomicLength - (i - numLeftClipped) - 1;
        queryChar=Character.toUpperCase(query.charAt(index));
      }
 else {
        final int index=i - numLeftClipped;
        queryChar=Character.toUpperCase(query.charAt(index));
      }
      if (queryChar != '-') {
        readIndex++;
      }
    }
    refPositions.set(i,refPosition);
    if (reverseStrand) {
      readIndexes.set(paddedLength - i - 1,readIndex);
    }
 else {
      readIndexes.set(i,readIndex);
    }
  }
  if (debug && LOG.isDebugEnabled()) {
    debugSequences();
    logval.setLength(0);
    logval.append("String_Node_Str");
    for (int i=0; i < paddedLength; i++) {
      logval.append(String.format("String_Node_Str",refPositions.get(i) % 10));
    }
    LOG.debug(logval.toString());
    logval.setLength(0);
    logval.append("String_Node_Str");
    for (int i=0; i < paddedLength; i++) {
      logval.append(String.format("String_Node_Str",readIndexes.get(i) % 10));
    }
    LOG.debug(logval.toString());
    LOG.debug("String_Node_Str");
    logval.setLength(0);
    for (int i=0; i < paddedLength; i++) {
      if (i < numLeftClipped) {
        refChar='_';
      }
 else       if (i >= (genomicLength + numLeftClipped)) {
        refChar='_';
      }
 else {
        refChar=ref.charAt(i - numLeftClipped);
      }
      logval.append(String.format("String_Node_Str",i,refChar,refPositions.get(i)));
    }
    LOG.debug(logval.toString());
    LOG.debug("String_Node_Str");
    logval.setLength(0);
    for (int i=0; i < paddedLength; i++) {
      if (i < numLeftClipped) {
        queryChar='_';
      }
 else       if (i >= (numLeftClipped + genomicLength)) {
        queryChar='_';
      }
 else {
        queryChar=query.charAt(i - numLeftClipped);
      }
      logval.append(String.format("String_Node_Str",i,queryChar,readIndexes.get(i)));
    }
    LOG.debug(logval.toString());
    LOG.debug(String.format("String_Node_Str",numLeftClipped,numRightClipped));
  }
  for (int queryI=numLeftClipped; queryI < numLeftClipped + genomicLength; queryI++) {
    refPosition=refPositions.get(queryI);
    readIndex=readIndexes.get(queryI);
    final int i=queryI - numLeftClipped;
    if (readIndex > queryLength && !tooBig) {
      tooBig=true;
      tooBigReadIndex=readIndex;
      tooBigRefPosition=refPosition;
    }
    refChar=Character.toUpperCase(ref.charAt(i));
    queryChar=Character.toUpperCase(query.charAt(i));
    boolean hasQual;
    byte qualChar;
    if (qual.length() > 0 && queryChar != '-') {
      hasQual=true;
      qualChar=qualityEncoding.asciiEncodingToPhredQualityScore(qual.charAt(i));
    }
 else {
      hasQual=false;
      qualChar=minQualValue;
    }
    if (refChar != queryChar) {
      sequenceVariations.add(new SamSequenceVariation(refPosition,refChar,readIndex,queryChar,hasQual,qualChar));
    }
  }
  if (tooBig) {
    if (debug && LOG.isDebugEnabled()) {
      LOG.debug(String.format("String_Node_Str",tooBigReadIndex,tooBigRefPosition));
      LOG.debug(String.format("String_Node_Str",queryIndex));
      if (sourceQuery.length() > 0) {
        LOG.debug(String.format("String_Node_Str",sourceQuery));
      }
 else {
        LOG.debug("String_Node_Str");
      }
    }
  }
}