Program: 92468
Project: 92468
Buggy source:
/** 
 * Returns a distinct list of signatures which most closely match the target user agent string. Where a single signature is not present across all the nodes the signatures which match the most nodes from the target user agent string are returned.
 * @param state current working state of the matching process
 * @return An enumeration of closest signatures.
 * @throws IOException
 */
private static RankedSignatureIterator getClosestSignatures(final MatchState state) throws IOException {
  if (state.getNodesList().size() == 1) {
    state.setClosestSignaturesCount(state.getNodesList().get(0).getRankedSignatureIndexes().length);
    return new RankedSignatureIterator(){
      final int[] rankedSignatureIndexes=state.getNodesList().get(0).getRankedSignatureIndexes();
      int index=0;
      @Override public boolean hasNext(){
        return index < rankedSignatureIndexes.length;
      }
      @Override public int next(){
        int value=rankedSignatureIndexes[index];
        index++;
        return value;
      }
      @Override public void reset(){
        index=0;
      }
    }
;
  }
 else {
    final MostFrequentFilter filter=new MostFrequentFilter(state.getNodesList());
    state.setClosestSignaturesCount(filter.size());
    return new RankedSignatureIterator(){
      final List<Integer> rankedSignatureIndexes=filter;
      int index=0;
      @Override public boolean hasNext(){
        return index < rankedSignatureIndexes.size();
      }
      @Override public int next(){
        int value=rankedSignatureIndexes.get(index);
        index++;
        return value;
      }
      @Override public void reset(){
        index=0;
      }
    }
;
  }
}

Fixed version (ground truth):
/** 
 * Returns a distinct list of signatures which most closely match the target user agent string. Where a single signature is not present across all the nodes the signatures which match the most nodes from the target user agent string are returned.
 * @param state current working state of the matching process
 * @return An enumeration of closest signatures.
 * @throws IOException
 */
private static RankedSignatureIterator getClosestSignatures(final MatchState state) throws IOException {
  RankedSignatureIterator result;
  if (state.getNodesList().size() == 1) {
    result=new RankedSignatureIterator(){
      final int[] rankedSignatureIndexes=state.getNodesList().get(0).getRankedSignatureIndexes();
      int index=0;
      @Override public boolean hasNext(){
        return index < rankedSignatureIndexes.length;
      }
      @Override public int size(){
        return rankedSignatureIndexes.length;
      }
      @Override public int next(){
        int value=rankedSignatureIndexes[index];
        index++;
        return value;
      }
      @Override public void reset(){
        index=0;
      }
    }
;
  }
 else {
    final MostFrequentFilter filter=new MostFrequentFilter(state);
    result=new RankedSignatureIterator(){
      final List<Integer> rankedSignatureIndexes=filter;
      int index=0;
      @Override public boolean hasNext(){
        return index < rankedSignatureIndexes.size();
      }
      @Override public int size(){
        return rankedSignatureIndexes.size();
      }
      @Override public int next(){
        int value=rankedSignatureIndexes.get(index);
        index++;
        return value;
      }
      @Override public void reset(){
        index=0;
      }
    }
;
  }
  state.closestSignaturesCount+=result.size();
  return result;
}