Program: 161292
Project: 161292
Buggy source:
@Override protected Collection<Throwable> call(final String inputName) throws Exception {
  if (this.XML == null) {
    return wrapException("String_Node_Str" + OPTION_XML + "String_Node_Str");
  }
  final Map<String,Map<Integer,String>> flowcell2lane2id=new HashMap<String,Map<Integer,String>>();
  SamReader sfr=null;
  SAMFileWriter sfw=null;
  try {
    final Pattern readNameSignature=Pattern.compile(super.readNameSignatureStr);
    final JAXBContext context=JAXBContext.newInstance(ReadGroup.class,ReadGroupList.class);
    final Unmarshaller unmarshaller=context.createUnmarshaller();
    final ReadGroupList rgl=unmarshaller.unmarshal(new StreamSource(XML),ReadGroupList.class).getValue();
    if (rgl.flowcells.isEmpty()) {
      return wrapException("String_Node_Str" + XML);
    }
    sfr=openSamReader(inputName);
    final SAMFileHeader header=sfr.getFileHeader().clone();
    header.addComment("String_Node_Str" + getName());
    final Set<String> seenids=new HashSet<String>();
    final List<SAMReadGroupRecord> samReadGroupRecords=new ArrayList<SAMReadGroupRecord>();
    for (    final FlowCell fc : rgl.flowcells) {
      final Map<Integer,String> lane2id=new HashMap<Integer,String>();
      for (      final Lane lane : fc.lanes) {
        for (        final ReadGroup rg : lane.readGroups) {
          if (seenids.contains(rg.id)) {
            return wrapException("String_Node_Str" + rg.id + "String_Node_Str");
          }
          seenids.add(rg.id);
          final SAMReadGroupRecord rgrec=new SAMReadGroupRecord(rg.id);
          rgrec.setLibrary(rg.library);
          rgrec.setPlatform(rg.platform);
          rgrec.setSample(rg.sample);
          rgrec.setPlatformUnit(rg.platform);
          if (rg.center != null)           rgrec.setSequencingCenter(rg.center);
          if (rg.description != null)           rgrec.setDescription(rg.description);
          lane2id.put(lane.id,rg.id);
          samReadGroupRecords.add(rgrec);
        }
      }
      if (flowcell2lane2id.containsKey(fc.name)) {
        return wrapException("String_Node_Str" + fc.name + "String_Node_Str");
      }
      flowcell2lane2id.put(fc.name,lane2id);
    }
    header.setReadGroups(samReadGroupRecords);
    sfw=openSAMFileWriter(header,true);
    final SAMSequenceDictionaryProgress progress=new SAMSequenceDictionaryProgress(header);
    final SAMRecordIterator iter=sfr.iterator();
    while (iter.hasNext()) {
      final SAMRecord rec=progress.watch(iter.next());
      final Matcher matcher=readNameSignature.matcher(rec.getReadName());
      final String flowcellStr;
      final String laneStr;
      if (matcher.matches()) {
        flowcellStr=matcher.group(1);
        laneStr=matcher.group(2);
      }
 else {
        return wrapException("String_Node_Str" + rec.getReadName() + "String_Node_Str"+ readNameSignature.pattern()+ "String_Node_Str"+ OPTION_READNAMESIGNATURESTR);
      }
      String RGID=null;
      final Map<Integer,String> lane2id=flowcell2lane2id.get(flowcellStr);
      if (lane2id == null)       throw new RuntimeException("String_Node_Str" + rec.getReadName());
      try {
        RGID=lane2id.get(Integer.parseInt(laneStr));
      }
 catch (      final Exception e) {
        return wrapException("String_Node_Str" + rec.getReadName());
      }
      if (RGID == null) {
        throw new RuntimeException("String_Node_Str" + rec.getReadName() + "String_Node_Str"+ flowcellStr+ "String_Node_Str"+ laneStr+ "String_Node_Str"+ lane2id);
      }
      rec.setAttribute(SAMTag.RG.name(),RGID);
      sfw.addAlignment(rec);
    }
    progress.finish();
    iter.close();
    LOG.info("String_Node_Str");
    return RETURN_OK;
  }
 catch (  Exception err) {
    return wrapException(err);
  }
 finally {
    CloserUtil.close(sfw);
    CloserUtil.close(sfr);
  }
}

Fixed version (ground truth):
@Override protected Collection<Throwable> call(final String inputName) throws Exception {
  if (this.XML == null) {
    return wrapException("String_Node_Str" + OPTION_XML + "String_Node_Str");
  }
  final Map<String,Map<Integer,String>> flowcell2lane2id=new HashMap<String,Map<Integer,String>>();
  SamReader sfr=null;
  SAMFileWriter sfw=null;
  try {
    final Pattern readNameSignature=Pattern.compile(super.readNameSignatureStr);
    final JAXBContext context=JAXBContext.newInstance(ReadGroup.class,ReadGroupList.class);
    final Unmarshaller unmarshaller=context.createUnmarshaller();
    final ReadGroupList rgl=unmarshaller.unmarshal(new StreamSource(XML),ReadGroupList.class).getValue();
    if (rgl.flowcells.isEmpty()) {
      return wrapException("String_Node_Str" + XML);
    }
    sfr=openSamReader(inputName);
    final SAMFileHeader header=sfr.getFileHeader().clone();
    header.addComment("String_Node_Str" + getName());
    final Set<String> seenids=new HashSet<String>();
    final List<SAMReadGroupRecord> samReadGroupRecords=new ArrayList<SAMReadGroupRecord>();
    for (    final FlowCell fc : rgl.flowcells) {
      final Map<Integer,String> lane2id=new HashMap<Integer,String>();
      for (      final Lane lane : fc.lanes) {
        for (        final ReadGroup rg : lane.readGroups) {
          if (seenids.contains(rg.id)) {
            return wrapException("String_Node_Str" + rg.id + "String_Node_Str");
          }
          seenids.add(rg.id);
          final SAMReadGroupRecord rgrec=new SAMReadGroupRecord(rg.id);
          rgrec.setLibrary(rg.library);
          rgrec.setPlatform(rg.platform);
          rgrec.setSample(rg.sample);
          rgrec.setPlatformUnit(rg.platformunit);
          if (rg.center != null)           rgrec.setSequencingCenter(rg.center);
          if (rg.description != null)           rgrec.setDescription(rg.description);
          lane2id.put(lane.id,rg.id);
          samReadGroupRecords.add(rgrec);
        }
      }
      if (flowcell2lane2id.containsKey(fc.name)) {
        return wrapException("String_Node_Str" + fc.name + "String_Node_Str");
      }
      flowcell2lane2id.put(fc.name,lane2id);
    }
    header.setReadGroups(samReadGroupRecords);
    sfw=openSAMFileWriter(header,true);
    final SAMSequenceDictionaryProgress progress=new SAMSequenceDictionaryProgress(header);
    final SAMRecordIterator iter=sfr.iterator();
    while (iter.hasNext()) {
      final SAMRecord rec=progress.watch(iter.next());
      final Matcher matcher=readNameSignature.matcher(rec.getReadName());
      final String flowcellStr;
      final String laneStr;
      if (matcher.matches()) {
        flowcellStr=matcher.group(1);
        laneStr=matcher.group(2);
      }
 else {
        return wrapException("String_Node_Str" + rec.getReadName() + "String_Node_Str"+ readNameSignature.pattern()+ "String_Node_Str"+ OPTION_READNAMESIGNATURESTR);
      }
      String RGID=null;
      final Map<Integer,String> lane2id=flowcell2lane2id.get(flowcellStr);
      if (lane2id == null)       throw new RuntimeException("String_Node_Str" + rec.getReadName());
      try {
        RGID=lane2id.get(Integer.parseInt(laneStr));
      }
 catch (      final Exception e) {
        return wrapException("String_Node_Str" + rec.getReadName());
      }
      if (RGID == null) {
        throw new RuntimeException("String_Node_Str" + rec.getReadName() + "String_Node_Str"+ flowcellStr+ "String_Node_Str"+ laneStr+ "String_Node_Str"+ lane2id);
      }
      rec.setAttribute(SAMTag.RG.name(),RGID);
      sfw.addAlignment(rec);
    }
    progress.finish();
    iter.close();
    LOG.info("String_Node_Str");
    return RETURN_OK;
  }
 catch (  Exception err) {
    return wrapException(err);
  }
 finally {
    CloserUtil.close(sfw);
    CloserUtil.close(sfr);
  }
}