Program: 42507
Project: 42507
Buggy source:
public void process(JCas jCas) throws AnalysisEngineProcessException {
  Map<Annotation,Integer> annotToDistance=new HashMap<Annotation,Integer>();
  Map<Annotation,Cooccurrence> annotationToCoOccurrence=new HashMap<Annotation,Cooccurrence>();
  for (  Annotation enclosingAnnot : JCasUtil.select(jCas,enclosingScope)) {
    List<? extends Annotation> annots1=asList(subiterate(jCas,annotation1,enclosingAnnot,true,false));
    List<? extends Annotation> annots2=asList(subiterate(jCas,annotation2,enclosingAnnot,true,false));
    if (annots1 != null && annots2 != null && !annots1.isEmpty() && !annots2.isEmpty()) {
      for (      Annotation a1 : annots1) {
        for (        Annotation a2 : annots2) {
          if (a1 != a2) {
            String[] firstIdValues=getValues(firstIdMethods,a1);
            String[] secondIdValues=getValues(secondIdMethods,a2);
            if (keepOnlyNearestNeighbors) {
              int oldDistanceForFirstAnnot=Integer.MAX_VALUE;
              int oldDistanceForSecondAnnot=Integer.MAX_VALUE;
              int distanceBetweenAnnot=BlueCasUtil.distance(a1,a2);
              if (distanceBetweenAnnot != -1) {
                if (annotToDistance.containsKey(a1)) {
                  oldDistanceForFirstAnnot=annotToDistance.get(a1);
                }
                if (annotToDistance.containsKey(a2)) {
                  oldDistanceForSecondAnnot=annotToDistance.get(a2);
                }
                if ((distanceBetweenAnnot < oldDistanceForFirstAnnot) && (distanceBetweenAnnot < oldDistanceForSecondAnnot)) {
                  removeExistingCooccurrences(annotationToCoOccurrence,a1,a2);
                  annotToDistance.put(a1,distanceBetweenAnnot);
                  annotToDistance.put(a2,distanceBetweenAnnot);
                  Cooccurrence cooc=filterCooccurence(jCas,enclosingAnnot,a1,a2,firstIdValues,secondIdValues);
                  if (cooc != null) {
                    annotationToCoOccurrence.put(a1,cooc);
                    annotationToCoOccurrence.put(a2,cooc);
                  }
 else {
                    LOG.warn("String_Node_Str");
                  }
                }
              }
            }
 else {
              filterCooccurence(jCas,enclosingAnnot,a1,a2,firstIdValues,secondIdValues);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void process(JCas jCas) throws AnalysisEngineProcessException {
  Map<Annotation,Integer> annotToDistance=newHashMap();
  Map<Annotation,Cooccurrence> annotationToCoOccurrence=newHashMap();
  for (  Annotation enclosingAnnot : select(jCas,enclosingScope)) {
    List<? extends Annotation> annots1=asList(subiterate(jCas,annotation1,enclosingAnnot,true,false));
    List<? extends Annotation> annots2=asList(subiterate(jCas,annotation2,enclosingAnnot,true,false));
    if (annots1 != null && annots2 != null && !annots1.isEmpty() && !annots2.isEmpty()) {
      for (      Annotation a1 : annots1) {
        for (        Annotation a2 : annots2) {
          if (!haveSameBeginEnd(a1,a2)) {
            String[] firstIdValues=getValues(firstIdMethods,a1);
            String[] secondIdValues=getValues(secondIdMethods,a2);
            if (keepOnlyNearestNeighbors) {
              int oldDistanceForFirstAnnot=Integer.MAX_VALUE;
              int oldDistanceForSecondAnnot=Integer.MAX_VALUE;
              int distanceBetweenAnnot=distance(a1,a2);
              if (distanceBetweenAnnot != -1) {
                if (annotToDistance.containsKey(a1)) {
                  oldDistanceForFirstAnnot=annotToDistance.get(a1);
                }
                if (annotToDistance.containsKey(a2)) {
                  oldDistanceForSecondAnnot=annotToDistance.get(a2);
                }
                if ((distanceBetweenAnnot < oldDistanceForFirstAnnot) && (distanceBetweenAnnot < oldDistanceForSecondAnnot)) {
                  removeExistingCooccurrences(annotationToCoOccurrence,a1,a2);
                  annotToDistance.put(a1,distanceBetweenAnnot);
                  annotToDistance.put(a2,distanceBetweenAnnot);
                  Cooccurrence cooc=filterCooccurence(jCas,enclosingAnnot,a1,a2,firstIdValues,secondIdValues);
                  if (cooc != null) {
                    annotationToCoOccurrence.put(a1,cooc);
                    annotationToCoOccurrence.put(a2,cooc);
                  }
 else {
                    LOG.warn("String_Node_Str");
                  }
                }
              }
            }
 else {
              filterCooccurence(jCas,enclosingAnnot,a1,a2,firstIdValues,secondIdValues);
            }
          }
        }
      }
    }
  }
}