Program: 30546
Project: 30546
Buggy source:
/** 
 * Adds a fragment record (mapped or unmapped) to the set using the provided contig start and optionally the strand, cigar string, quality string or default quality score.  This does not modify the flag field, which should be updated if desired before adding the return to the list of records.
 */
private SAMRecord createReadNoFlag(final String name,final int contig,final int start,final boolean negativeStrand,final boolean recordUnmapped,final String cigar,final String qualityString,final int defaultQuality) throws SAMException {
  final SAMRecord rec=new SAMRecord(this.header);
  rec.setReadName(name);
  if (chroms.length <= contig) {
    throw new SAMException("String_Node_Str" + chroms.length + "String_Node_Str"+ contig);
  }
  if (0 <= contig) {
    rec.setReferenceIndex(contig);
    rec.setReferenceName(chroms[contig]);
    rec.setAlignmentStart(start);
  }
  if (!recordUnmapped) {
    rec.setReadNegativeStrandFlag(negativeStrand);
    if (null != cigar) {
      rec.setCigarString(cigar);
    }
 else     if (!rec.getReadUnmappedFlag()) {
      rec.setCigarString(readLength + "String_Node_Str");
    }
    rec.setMappingQuality(255);
  }
 else {
    rec.setReadUnmappedFlag(true);
  }
  rec.setAttribute(SAMTag.RG.name(),READ_GROUP_ID);
  if (programRecord != null) {
    rec.setAttribute(SAMTag.PG.name(),programRecord.getProgramGroupId());
  }
  if (readGroup != null) {
    rec.setAttribute(SAMTag.RG.name(),readGroup.getReadGroupId());
  }
  fillInBasesAndQualities(rec,qualityString,defaultQuality);
  return rec;
}

Fixed version (ground truth):
/** 
 * Adds a fragment record (mapped or unmapped) to the set using the provided contig start and optionally the strand, cigar string, quality string or default quality score.  This does not modify the flag field, which should be updated if desired before adding the return to the list of records.
 */
private SAMRecord createReadNoFlag(final String name,final int contig,final int start,final boolean negativeStrand,final boolean recordUnmapped,final String cigar,final String qualityString,final int defaultQuality) throws SAMException {
  final SAMRecord rec=new SAMRecord(this.header);
  rec.setReadName(name);
  if (chroms.length <= contig) {
    throw new SAMException("String_Node_Str" + chroms.length + "String_Node_Str"+ contig);
  }
  if (0 <= contig) {
    rec.setReferenceIndex(contig);
    rec.setReferenceName(chroms[contig]);
    rec.setAlignmentStart(start);
  }
  if (!recordUnmapped) {
    rec.setReadNegativeStrandFlag(negativeStrand);
    if (null != cigar) {
      rec.setCigarString(cigar);
    }
 else     if (!rec.getReadUnmappedFlag()) {
      rec.setCigarString(readLength + "String_Node_Str");
    }
    rec.setMappingQuality(255);
  }
 else {
    rec.setReadUnmappedFlag(true);
  }
  rec.setAttribute(SAMTag.RG.name(),READ_GROUP_ID);
  if (useNmFlag) {
    rec.setAttribute(SAMTag.NM.name(),SequenceUtil.calculateSamNmTagFromCigar(rec));
  }
  if (programRecord != null) {
    rec.setAttribute(SAMTag.PG.name(),programRecord.getProgramGroupId());
  }
  if (readGroup != null) {
    rec.setAttribute(SAMTag.RG.name(),readGroup.getReadGroupId());
  }
  fillInBasesAndQualities(rec,qualityString,defaultQuality);
  return rec;
}