Program: 24851
Project: 24851
Buggy source:
/** 
 * Iterate all the spans from the text query that match the sectionType query also.
 */
public Spans getSpans(final IndexReader reader,final Searcher searcher) throws IOException {
  return new Spans(){
    private Weight typeWeight=sectionTypeQuery.weight(searcher);
    private Scorer typeScorer=typeWeight.scorer(reader);
    private boolean moreType=true;
    private boolean typeCanSkip=true;
    private Spans textSpans=textQuery.getSpans(reader,searcher);
    private boolean moreText=true;
    private boolean firstTime=true;
    public boolean next() throws IOException {
      if (moreText)       moreText=textSpans.next();
      if (firstTime) {
        moreType=typeScorer.next();
        firstTime=false;
      }
      return advance();
    }
    public boolean skipTo(    int target) throws IOException {
      moreText=textSpans.skipTo(target);
      skipType(target);
      return advance();
    }
    private void skipType(    int target) throws IOException {
      if (typeCanSkip) {
        try {
          moreType=typeScorer.skipTo(target);
        }
 catch (        UnsupportedOperationException e) {
          typeCanSkip=false;
        }
      }
      if (!typeCanSkip) {
        while (moreType && typeScorer.doc() < target)         moreType=typeScorer.next();
      }
    }
    private boolean advance() throws IOException {
      while (moreText && moreType) {
        final int textChunk=textSpans.doc();
        final int typeChunk=typeScorer.doc();
        if (textChunk < typeChunk)         moreText=textSpans.skipTo(typeChunk);
 else         if (textChunk > typeChunk)         skipType(textChunk);
 else         break;
      }
      return moreText && moreType;
    }
    public int doc(){
      return textSpans.doc();
    }
    public int start(){
      return textSpans.start();
    }
    public int end(){
      return textSpans.end();
    }
    public float score(){
      return textSpans.score();
    }
    public int coordBits(){
      return textSpans.coordBits();
    }
    public Collection allTerms(){
      return textSpans.allTerms();
    }
    public String toString(){
      return textSpans.toString();
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Iterate all the spans from the text query that match the sectionType query also.
 */
public Spans getSpans(final IndexReader reader,final Searcher searcher) throws IOException {
  return new Spans(){
    private Spans typeSpans=typeQuery.getSpans(reader,searcher);
    private boolean moreType=true;
    private Spans textSpans=textQuery.getSpans(reader,searcher);
    private boolean moreText=true;
    private boolean firstTime=true;
    public boolean next() throws IOException {
      if (moreText)       moreText=textSpans.next();
      if (firstTime) {
        moreType=typeSpans.next();
        firstTime=false;
      }
      return advance();
    }
    public boolean skipTo(    int target) throws IOException {
      moreText=textSpans.skipTo(target);
      moreType=typeSpans.skipTo(target);
      return advance();
    }
    private boolean advance() throws IOException {
      while (moreText && moreType) {
        final int textChunk=textSpans.doc();
        final int typeChunk=typeSpans.doc();
        if (textChunk < typeChunk)         moreText=textSpans.skipTo(typeChunk);
 else         if (textChunk > typeChunk)         moreType=typeSpans.skipTo(textChunk);
 else         break;
      }
      return moreText && moreType;
    }
    public int doc(){
      return textSpans.doc();
    }
    public int start(){
      return textSpans.start();
    }
    public int end(){
      return textSpans.end();
    }
    public float score(){
      return textSpans.score();
    }
    public int coordBits(){
      return textSpans.coordBits();
    }
    public Collection allTerms(){
      return textSpans.allTerms();
    }
    public String toString(){
      return textSpans.toString();
    }
  }
;
}