Program: 141209
Project: 141209
Buggy source:
/** 
 * Determine features that overlap genomic intervals.
 * @param ivList the list of genomic intervals.
 * @param features the list of features.
 * @param mode the overlap mode.
 * @return the set of features that overlap genomic intervals according to theoverlap mode.
 * @throws EoulsanException
 */
public static Set<String> featuresOverlapped(List<GenomicInterval> ivList,GenomicArray<String> features,OverlapMode mode,StrandUsage stranded) throws EoulsanException, IOException {
  Set<String> fs=null;
  if (mode == UNION) {
    fs=new HashSet<String>();
    for (    final GenomicInterval iv : ivList) {
      final String chr=iv.getChromosome();
      if (!features.containsChromosome(chr))       throw new EoulsanException("String_Node_Str" + chr);
      final Map<GenomicInterval,Set<String>> intervals=features.getEntries(chr,iv.getStart(),iv.getEnd());
      if (stranded == YES || stranded == REVERSE)       filterIntervalsStrands(intervals,iv.getStrand());
      if (intervals != null && intervals.size() > 0) {
        for (        Map.Entry<GenomicInterval,Set<String>> e : intervals.entrySet()) {
          if (e.getValue() != null)           fs.addAll(e.getValue());
        }
      }
    }
  }
 else   if (mode == INTERSECTION_NONEMPTY || mode == INTERSECTION_STRICT) {
    for (    final GenomicInterval iv : ivList) {
      final String chr=iv.getChromosome();
      if (!features.containsChromosome(chr))       throw new EoulsanException("String_Node_Str" + chr);
      final Map<GenomicInterval,Set<String>> intervals=features.getEntries(chr,iv.getStart(),iv.getEnd());
      if (stranded == StrandUsage.YES || stranded == StrandUsage.REVERSE)       filterIntervalsStrands(intervals,iv.getStrand());
      if (intervals.isEmpty()) {
        final Set<String> emptySet=Collections.emptySet();
        intervals.put(iv,emptySet);
      }
      if (intervals != null && intervals.size() > 0) {
        for (        Map.Entry<GenomicInterval,Set<String>> i : intervals.entrySet()) {
          final Set<String> fs2=i.getValue();
          if (fs2.size() > 0 || mode == INTERSECTION_STRICT) {
            if (fs == null)             fs=new HashSet<String>(fs2);
 else             fs.retainAll(fs2);
          }
        }
      }
    }
  }
 else   throw new EoulsanException("String_Node_Str");
  return fs;
}

Fixed version (ground truth):
/** 
 * Determine features that overlap genomic intervals.
 * @param ivList the list of genomic intervals.
 * @param features the list of features.
 * @param mode the overlap mode.
 * @return the set of features that overlap genomic intervals according to theoverlap mode.
 * @throws EoulsanException
 */
public static Set<String> featuresOverlapped(List<GenomicInterval> ivList,GenomicArray<String> features,OverlapMode mode,StrandUsage stranded) throws EoulsanException, IOException {
  Set<String> fs=null;
  if (mode == UNION) {
    fs=new HashSet<String>();
    for (    final GenomicInterval iv : ivList) {
      final String chr=iv.getChromosome();
      if (!features.containsChromosome(chr))       throw new EoulsanException("String_Node_Str" + chr);
      final Map<GenomicInterval,Set<String>> intervals=features.getEntries(chr,iv.getStart(),iv.getEnd());
      if (stranded == YES || stranded == REVERSE)       filterIntervalsStrands(intervals,iv.getStrand());
      if (intervals != null && intervals.size() > 0) {
        for (        Map.Entry<GenomicInterval,Set<String>> e : intervals.entrySet()) {
          if (e.getValue() != null)           fs.addAll(e.getValue());
        }
      }
    }
  }
 else   if (mode == INTERSECTION_NONEMPTY || mode == INTERSECTION_STRICT) {
    for (    final GenomicInterval iv : ivList) {
      final String chr=iv.getChromosome();
      if (!features.containsChromosome(chr))       throw new EoulsanException("String_Node_Str" + chr);
      final Map<GenomicInterval,Set<String>> intervals=features.getEntries(chr,iv.getStart(),iv.getEnd());
      if (stranded == StrandUsage.YES || stranded == StrandUsage.REVERSE)       filterIntervalsStrands(intervals,iv.getStrand());
      if (intervals.isEmpty()) {
        final Set<String> emptySet=Collections.emptySet();
        intervals.put(iv,emptySet);
      }
      if (intervals.size() > 0) {
        for (        Map.Entry<GenomicInterval,Set<String>> i : intervals.entrySet()) {
          final Set<String> fs2=i.getValue();
          if (fs2.size() > 0 || mode == INTERSECTION_STRICT) {
            if (fs == null)             fs=new HashSet<String>(fs2);
 else             fs.retainAll(fs2);
          }
        }
      }
    }
  }
 else   throw new EoulsanException("String_Node_Str");
  return fs;
}