Program: 141252
Project: 141252
Buggy source:
private static Set<String> featuresOverlapped(List<GenomicInterval> ivList,GenomicArray<String> features,String mode,String stranded) throws EoulsanException {
  Set<String> fs=null;
  Map<GenomicInterval,String> inter=new HashMap<GenomicInterval,String>();
  if (mode.equals("String_Node_Str")) {
    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);
      Map<GenomicInterval,String> intervals=features.getEntries(chr,iv.getStart(),iv.getEnd());
      if (stranded.equals("String_Node_Str") || stranded.equals("String_Node_Str")) {
        for (        Map.Entry<GenomicInterval,String> e : intervals.entrySet()) {
          if (e.getKey().getStrand() == iv.getStrand())           inter.put(e.getKey(),e.getValue());
        }
        intervals=inter;
      }
      if (intervals != null) {
        Collection<String> values=intervals.values();
        if (values != null) {
          fs.addAll(values);
        }
      }
    }
  }
 else   if (mode.equals("String_Node_Str")) {
    final Set<String> featureTmp=new HashSet<String>();
    for (    final GenomicInterval iv : ivList) {
      final String chr=iv.getChromosome();
      if (!features.containsChromosome(chr))       throw new EoulsanException("String_Node_Str" + chr);
      Map<GenomicInterval,String> intervals=features.getEntries(chr,iv.getStart(),iv.getEnd());
      if (stranded.equals("String_Node_Str") || stranded.equals("String_Node_Str")) {
        for (        Map.Entry<GenomicInterval,String> e : intervals.entrySet()) {
          if (e.getKey().getStrand() == iv.getStrand())           inter.put(e.getKey(),e.getValue());
        }
        intervals=inter;
      }
      if (intervals != null) {
        Collection<String> values=intervals.values();
        if (values != null) {
          for (int pos=iv.getStart(); pos <= iv.getEnd(); pos++) {
            featureTmp.clear();
            for (            Map.Entry<GenomicInterval,String> e : intervals.entrySet()) {
              if (e.getKey().include(pos,pos))               featureTmp.add(e.getValue());
            }
            if (featureTmp.size() > 0) {
              if (fs == null) {
                fs=new HashSet<String>();
                fs.addAll(featureTmp);
              }
 else               fs.retainAll(featureTmp);
            }
          }
        }
      }
    }
  }
 else   if (mode == "String_Node_Str") {
    final Set<String> featureTmp=new HashSet<String>();
    for (    final GenomicInterval iv : ivList) {
      final String chr=iv.getChromosome();
      if (!features.containsChromosome(chr))       throw new EoulsanException("String_Node_Str" + chr);
      Map<GenomicInterval,String> intervals=features.getEntries(chr,iv.getStart(),iv.getEnd());
      if (stranded.equals("String_Node_Str") || stranded.equals("String_Node_Str")) {
        for (        Map.Entry<GenomicInterval,String> e : intervals.entrySet()) {
          if (e.getKey().getStrand() == iv.getStrand())           inter.put(e.getKey(),e.getValue());
        }
        intervals=inter;
      }
      if (intervals != null) {
        Collection<String> values=intervals.values();
        if (values != null) {
          for (int pos=iv.getStart(); pos <= iv.getEnd(); pos++) {
            featureTmp.clear();
            for (            Map.Entry<GenomicInterval,String> e : intervals.entrySet()) {
              if (e.getKey().include(pos,pos)) {
                featureTmp.add(e.getValue());
              }
            }
            if (fs == null) {
              fs=new HashSet<String>();
              fs.addAll(featureTmp);
            }
 else             fs.retainAll(featureTmp);
          }
        }
      }
 else {
        if (fs == null)         fs=new HashSet<String>();
 else         fs.clear();
      }
    }
  }
  return fs;
}

Fixed version (ground truth):
private static Set<String> featuresOverlapped(List<GenomicInterval> ivList,GenomicArray<String> features,String mode,String stranded) throws EoulsanException {
  Set<String> fs=null;
  Map<GenomicInterval,String> inter=new HashMap<GenomicInterval,String>();
  if (mode.equals("String_Node_Str")) {
    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);
      Map<GenomicInterval,String> intervals=features.getEntries(chr,iv.getStart(),iv.getEnd());
      if (stranded.equals("String_Node_Str") || stranded.equals("String_Node_Str")) {
        for (        Map.Entry<GenomicInterval,String> e : intervals.entrySet()) {
          if (e.getKey().getStrand() == iv.getStrand())           inter.put(e.getKey(),e.getValue());
        }
        intervals=inter;
      }
      if (intervals != null) {
        Collection<String> values=intervals.values();
        if (values != null) {
          fs.addAll(values);
        }
      }
    }
  }
 else   if (mode.equals("String_Node_Str")) {
    final Set<String> featureTmp=new HashSet<String>();
    for (    final GenomicInterval iv : ivList) {
      final String chr=iv.getChromosome();
      if (!features.containsChromosome(chr))       throw new EoulsanException("String_Node_Str" + chr);
      Map<GenomicInterval,String> intervals=features.getEntries(chr,iv.getStart(),iv.getEnd());
      if (stranded.equals("String_Node_Str") || stranded.equals("String_Node_Str")) {
        for (        Map.Entry<GenomicInterval,String> e : intervals.entrySet()) {
          if (e.getKey().getStrand() == iv.getStrand())           inter.put(e.getKey(),e.getValue());
        }
        intervals=inter;
      }
      if (intervals != null) {
        Collection<String> values=intervals.values();
        if (values != null) {
          for (int pos=iv.getStart(); pos <= iv.getEnd(); pos++) {
            featureTmp.clear();
            for (            Map.Entry<GenomicInterval,String> e : intervals.entrySet()) {
              if (e.getKey().include(pos,pos))               featureTmp.add(e.getValue());
            }
            if (featureTmp.size() > 0) {
              if (fs == null) {
                fs=new HashSet<String>();
                fs.addAll(featureTmp);
              }
 else               fs.retainAll(featureTmp);
            }
          }
        }
      }
    }
  }
 else   if ("String_Node_Str".equals(mode)) {
    final Set<String> featureTmp=new HashSet<String>();
    for (    final GenomicInterval iv : ivList) {
      final String chr=iv.getChromosome();
      if (!features.containsChromosome(chr))       throw new EoulsanException("String_Node_Str" + chr);
      Map<GenomicInterval,String> intervals=features.getEntries(chr,iv.getStart(),iv.getEnd());
      if (stranded.equals("String_Node_Str") || stranded.equals("String_Node_Str")) {
        for (        Map.Entry<GenomicInterval,String> e : intervals.entrySet()) {
          if (e.getKey().getStrand() == iv.getStrand())           inter.put(e.getKey(),e.getValue());
        }
        intervals=inter;
      }
      if (intervals != null) {
        Collection<String> values=intervals.values();
        if (values != null) {
          for (int pos=iv.getStart(); pos <= iv.getEnd(); pos++) {
            featureTmp.clear();
            for (            Map.Entry<GenomicInterval,String> e : intervals.entrySet()) {
              if (e.getKey().include(pos,pos)) {
                featureTmp.add(e.getValue());
              }
            }
            if (fs == null) {
              fs=new HashSet<String>();
              fs.addAll(featureTmp);
            }
 else             fs.retainAll(featureTmp);
          }
        }
      }
 else {
        if (fs == null)         fs=new HashSet<String>();
 else         fs.clear();
      }
    }
  }
  return fs;
}