Program: 161276
Project: 161276
Buggy source:
/** 
 * public for knime 
 */
@Override public int doVcfToVcf(final String inputName,final VcfIterator vcfIn,final VariantContextWriter out){
  try {
    final Set<String> unmatchedcontigs=new HashSet<>();
    final VCFHeader h=vcfIn.getHeader();
    final VCFHeader h2=new VCFHeader(h);
    super.addMetaData(h2);
    final Map<String,VCFInfoHeaderLine> databaseTags=new HashMap<String,VCFInfoHeaderLine>();
    final VCFHeader databaseHeader=this.indexedVcfFileReader.getFileHeader();
    final ContigNameConverter nameConverter=ContigNameConverter.fromDictionaries(h.getSequenceDictionary(),databaseHeader.getSequenceDictionary()).setOnNotFound(this.onContigNotFound);
    for (    final String key : this.peek_info_tags) {
      VCFInfoHeaderLine hinfo=databaseHeader.getInfoHeaderLine(key);
      if (hinfo == null) {
        final String msg="String_Node_Str" + key + "String_Node_Str"+ this.resourceVcfFile;
        if (this.missingIdIsError) {
          LOG.warn(msg);
          continue;
        }
 else {
          LOG.error(msg);
          return -1;
        }
      }
switch (hinfo.getCountType()) {
case G:
        throw new JvarkitException.UserError("String_Node_Str" + hinfo.getID());
default :
      databaseTags.put(hinfo.getID(),hinfo);
    break;
}
hinfo=VCFUtils.renameVCFInfoHeaderLine(hinfo,this.peekTagPrefix + key);
if (h2.getInfoHeaderLine(hinfo.getID()) != null) {
  throw new JvarkitException.UserError("String_Node_Str" + this.peekTagPrefix + key+ "String_Node_Str");
}
h2.addMetaDataLine(hinfo);
;
}
out.writeHeader(h2);
final SAMSequenceDictionaryProgress progress=new SAMSequenceDictionaryProgress(h);
while (vcfIn.hasNext()) {
final VariantContext ctx=progress.watch(vcfIn.next());
final String outContig=nameConverter.apply(ctx.getContig());
if (outContig == null) {
  unmatchedcontigs.add(ctx.getContig());
  continue;
}
final VariantContextBuilder vcb=new VariantContextBuilder(ctx);
CloseableIterator<VariantContext> iter=this.indexedVcfFileReader.query(outContig,Math.max(0,ctx.getStart() - 1),(ctx.getEnd() + 1));
while (iter.hasNext()) {
  final VariantContext ctx2=iter.next();
  if (!outContig.equals(ctx2.getContig()))   continue;
  if (ctx.getStart() != ctx2.getStart())   continue;
  if (!ctx.getReference().equals(ctx2.getReference()))   continue;
  final boolean okAllele;
switch (altAlleleMatcher) {
case all:
{
      okAllele=ctx.getAlternateAlleles().stream().filter(A -> ctx2.hasAlternateAllele(A)).count() == ctx.getAlternateAlleles().size();
      break;
    }
case at_least_one:
{
    okAllele=ctx.getAlternateAlleles().stream().filter(A -> ctx2.hasAlternateAllele(A)).findAny().isPresent();
    break;
  }
case none:
okAllele=true;
break;
default :
throw new IllegalStateException(altAlleleMatcher.name());
}
if (!okAllele) continue;
if (this.peekId && ctx2.hasID()) {
vcb.id(ctx2.getID());
}
boolean somethingWasChanged=false;
for (final String key : databaseTags.keySet()) {
if (!ctx2.hasAttribute(key)) continue;
final VCFInfoHeaderLine dbHeader=databaseTags.get(key);
switch (dbHeader.getCountType()) {
case A:
{
final List<Object> newatt=new ArrayList<>();
final List<Object> ctx2att=ctx2.getAttributeAsList(key);
for (int i=0; i < ctx.getAlternateAlleles().size(); ++i) {
final Allele ctxalt=ctx.getAlternateAllele(i);
int index2=ctx2.getAlleleIndex(ctxalt);
if (index2 == -1 || index2 >= ctx2att.size()) {
  newatt.add(null);
}
 else {
  newatt.add(ctx2att.get(index2));
}
}
if (newatt.stream().filter(Obj -> !(Obj == null || VCFConstants.EMPTY_INFO_FIELD.equals(Obj))).count() > 0) {
vcb.attribute(this.peekTagPrefix + key,newatt);
somethingWasChanged=true;
}
break;
}
case R:
{
final List<Object> newatt=new ArrayList<>();
final List<Object> ctx2att=ctx2.getAttributeAsList(key);
for (int i=0; i < ctx.getAlleles().size(); ++i) {
final Allele ctxalt=ctx.getAlleles().get(i);
int index2=ctx2.getAlleleIndex(ctxalt);
if (index2 == -1 || index2 >= ctx2att.size()) {
newatt.add(null);
}
 else {
newatt.add(ctx2att.get(index2));
}
}
if (newatt.stream().filter(Obj -> !(Obj == null || VCFConstants.EMPTY_INFO_FIELD.equals(Obj))).count() > 0) {
vcb.attribute(this.peekTagPrefix + key,newatt);
somethingWasChanged=true;
}
break;
}
default :
{
final Object o=ctx2.getAttribute(key);
vcb.attribute(this.peekTagPrefix + key,o);
somethingWasChanged=true;
break;
}
}
}
if (somethingWasChanged) break;
}
iter.close();
iter=null;
out.add(vcb.make());
if (out.checkError()) break;
}
progress.finish();
if (!unmatchedcontigs.isEmpty()) {
LOG.debug("String_Node_Str" + unmatchedcontigs.stream().collect(Collectors.joining("String_Node_Str")));
}
return 0;
}
 catch (final Exception err) {
LOG.error(err);
return -1;
}
}

Fixed version (ground truth):
/** 
 * public for knime 
 */
@Override public int doVcfToVcf(final String inputName,final VcfIterator vcfIn,final VariantContextWriter out){
  try {
    final Set<String> unmatchedcontigs=new HashSet<>();
    final VCFHeader h=vcfIn.getHeader();
    final VCFHeader h2=new VCFHeader(h);
    super.addMetaData(h2);
    final Map<String,VCFInfoHeaderLine> databaseTags=new HashMap<String,VCFInfoHeaderLine>();
    final VCFHeader databaseHeader=this.indexedVcfFileReader.getFileHeader();
    final ContigNameConverter nameConverter=ContigNameConverter.fromDictionaries(h.getSequenceDictionary(),databaseHeader.getSequenceDictionary()).setOnNotFound(this.onContigNotFound);
    for (    final String key : this.peek_info_tags) {
      VCFInfoHeaderLine hinfo=databaseHeader.getInfoHeaderLine(key);
      if (hinfo == null) {
        final String msg="String_Node_Str" + key + "String_Node_Str"+ this.resourceVcfFile;
        if (this.missingIdIsError) {
          LOG.warn(msg);
          continue;
        }
 else {
          LOG.error(msg);
          return -1;
        }
      }
switch (hinfo.getCountType()) {
case G:
        throw new JvarkitException.UserError("String_Node_Str" + hinfo.getID());
default :
      databaseTags.put(hinfo.getID(),hinfo);
    break;
}
hinfo=VCFUtils.renameVCFInfoHeaderLine(hinfo,this.peekTagPrefix + key);
if (h2.getInfoHeaderLine(hinfo.getID()) != null) {
  throw new JvarkitException.UserError("String_Node_Str" + this.peekTagPrefix + key+ "String_Node_Str");
}
h2.addMetaDataLine(hinfo);
;
}
out.writeHeader(h2);
final SAMSequenceDictionaryProgress progress=new SAMSequenceDictionaryProgress(h);
while (vcfIn.hasNext()) {
final VariantContext ctx=progress.watch(vcfIn.next());
final String outContig=nameConverter.apply(ctx.getContig());
if (outContig == null) {
  unmatchedcontigs.add(ctx.getContig());
  continue;
}
final VariantContextBuilder vcb=new VariantContextBuilder(ctx);
CloseableIterator<VariantContext> iter=this.indexedVcfFileReader.query(outContig,Math.max(0,ctx.getStart() - 1),(ctx.getEnd() + 1));
while (iter.hasNext()) {
  final VariantContext ctx2=iter.next();
  if (!outContig.equals(ctx2.getContig()))   continue;
  if (ctx.getStart() != ctx2.getStart())   continue;
  if (!ctx.getReference().equals(ctx2.getReference()))   continue;
  final boolean okAllele;
switch (altAlleleMatcher) {
case all:
{
      okAllele=ctx.getAlternateAlleles().stream().filter(A -> ctx2.hasAlternateAllele(A)).count() == ctx.getAlternateAlleles().size();
      break;
    }
case at_least_one:
{
    okAllele=ctx.getAlternateAlleles().stream().filter(A -> ctx2.hasAlternateAllele(A)).findAny().isPresent();
    break;
  }
case none:
okAllele=true;
break;
default :
throw new IllegalStateException(altAlleleMatcher.name());
}
if (!okAllele) continue;
if (this.peekId && ctx2.hasID()) {
vcb.id(ctx2.getID());
}
boolean somethingWasChanged=false;
for (final String key : databaseTags.keySet()) {
if (!ctx2.hasAttribute(key)) continue;
final VCFInfoHeaderLine dbHeader=databaseTags.get(key);
switch (dbHeader.getCountType()) {
case A:
{
final List<Object> newatt=new ArrayList<>();
final List<Object> ctx2att=ctx2.getAttributeAsList(key);
for (int i=0; i < ctx.getAlternateAlleles().size(); ++i) {
final Allele ctxalt=ctx.getAlternateAllele(i);
int index2=ctx2.getAlternateAlleles().indexOf(ctxalt);
if (index2 == -1 || index2 >= ctx2att.size()) {
  newatt.add(null);
}
 else {
  newatt.add(ctx2att.get(index2));
}
}
if (newatt.stream().filter(Obj -> !(Obj == null || VCFConstants.EMPTY_INFO_FIELD.equals(Obj))).count() > 0) {
vcb.attribute(this.peekTagPrefix + key,newatt);
somethingWasChanged=true;
}
break;
}
case R:
{
final List<Object> newatt=new ArrayList<>();
final List<Object> ctx2att=ctx2.getAttributeAsList(key);
for (int i=0; i < ctx.getAlleles().size(); ++i) {
final Allele ctxalt=ctx.getAlleles().get(i);
int index2=ctx2.getAlleleIndex(ctxalt);
if (index2 == -1 || index2 >= ctx2att.size()) {
newatt.add(null);
}
 else {
newatt.add(ctx2att.get(index2));
}
}
if (newatt.stream().filter(Obj -> !(Obj == null || VCFConstants.EMPTY_INFO_FIELD.equals(Obj))).count() > 0) {
vcb.attribute(this.peekTagPrefix + key,newatt);
somethingWasChanged=true;
}
break;
}
default :
{
final Object o=ctx2.getAttribute(key);
vcb.attribute(this.peekTagPrefix + key,o);
somethingWasChanged=true;
break;
}
}
}
if (somethingWasChanged) break;
}
iter.close();
iter=null;
out.add(vcb.make());
if (out.checkError()) break;
}
progress.finish();
if (!unmatchedcontigs.isEmpty()) {
LOG.debug("String_Node_Str" + unmatchedcontigs.stream().collect(Collectors.joining("String_Node_Str")));
}
return 0;
}
 catch (final Exception err) {
LOG.error(err);
return -1;
}
}