Program: 55161
Project: 55161
Buggy source:
@Nullable private Marshallable value(@NotNull IndexQuery<V> vanillaIndexQuery,@NotNull ExcerptTailer tailer,@NotNull Iterator<IndexedValue<V>> iterator,final long from,@NotNull final LongSupplier lastIndexOfSnapshot){
  if (iterator.hasNext()) {
    IndexedValue<V> indexedValue=iterator.next();
    indexedValue.timePublished(System.currentTimeMillis());
    indexedValue.maxIndex(lastIndexRead);
    if (!iterator.hasNext()) {
      if (lastIndexOfSnapshot.getAsLong() == -1)       indexedValue.isEndOfSnapshot(true);
    }
 else {
      indexedValue.isEndOfSnapshot(false);
    }
    return indexedValue;
  }
  final String eventName=vanillaIndexQuery.eventName();
  final Predicate<V> filter=vanillaIndexQuery.filter();
  if (isClosed.get())   throw Jvm.rethrow(new InvalidEventHandlerException("String_Node_Str"));
  try (DocumentContext dc=tailer.readingDocument()){
    try {
      if (!dc.isData())       return null;
      if (LOG.isDebugEnabled())       Jvm.debug().on(getClass(),"String_Node_Str" + fromSizePrefixedBlobs(dc));
      if (from > dc.index())       return null;
      Class<? extends Marshallable> type=typeToString.toType(eventName);
      if (type == null)       return null;
      final StringBuilder serialisedEventName=eventNameDeserialiserPool.acquireStringBuilder();
      @NotNull final ValueIn valueIn=dc.wire().read(serialisedEventName);
      if (valueIn instanceof DefaultValueIn)       return null;
      if (!eventNamesMatch(serialisedEventName,eventName)) {
        return null;
      }
      @NotNull final V v=(V)VanillaObjectCacheFactory.INSTANCE.get().apply(type);
      valueIn.marshallable(v);
      if (!filter.test(v))       return null;
      final IndexedValue<V> indexedValue=this.indexedValue.get();
      long index=dc.index();
      indexedValue.index(index);
      indexedValue.v(v);
      indexedValue.timePublished(System.currentTimeMillis());
      indexedValue.isEndOfSnapshot(indexedValue == lastIndexOfSnapshot);
      indexedValue.maxIndex(Math.max(dc.index(),lastIndexRead));
      return indexedValue;
    }
  finally {
      if (dc.isPresent())       while (dc.wire().hasMore()) {
        dc.wire().read().skipValue();
      }
    }
  }
 }

Fixed version (ground truth):
@Nullable private Marshallable value(@NotNull IndexQuery<V> vanillaIndexQuery,@NotNull ExcerptTailer tailer,@NotNull Iterator<IndexedValue<V>> iterator,final long from,@NotNull final LongSupplier lastIndexOfSnapshot){
  if (iterator.hasNext()) {
    IndexedValue<V> indexedValue=iterator.next();
    indexedValue.timePublished(System.currentTimeMillis());
    indexedValue.maxIndex(lastIndexRead);
    if (!iterator.hasNext()) {
      if (lastIndexOfSnapshot.getAsLong() == -1)       indexedValue.isEndOfSnapshot(true);
    }
 else {
      indexedValue.isEndOfSnapshot(false);
    }
    return indexedValue;
  }
  final String eventName=vanillaIndexQuery.eventName();
  final Predicate<V> filter=vanillaIndexQuery.filter();
  if (isClosed.get())   throw Jvm.rethrow(new InvalidEventHandlerException("String_Node_Str"));
  try (DocumentContext dc=tailer.readingDocument()){
    try {
      if (!dc.isData())       return null;
      if (LOG.isDebugEnabled())       Jvm.debug().on(getClass(),"String_Node_Str" + fromSizePrefixedBlobs(dc));
      if (from > dc.index())       return null;
      Class<? extends Marshallable> type=typeToString.toType(eventName);
      if (type == null)       return null;
      final StringBuilder serialisedEventName=eventNameDeserialiserPool.acquireStringBuilder();
      @NotNull final ValueIn valueIn=dc.wire().read(serialisedEventName);
      if (valueIn instanceof DefaultValueIn)       return null;
      if (!eventNamesMatch(serialisedEventName,eventName)) {
        return null;
      }
      @NotNull final V v=(V)VanillaObjectCacheFactory.INSTANCE.get().apply(type);
      valueIn.marshallable(v);
      if (!filter.test(v))       return null;
      final IndexedValue<V> indexedValue=this.indexedValue.get();
      long index=dc.index();
      indexedValue.index(index);
      indexedValue.v(v);
      indexedValue.timePublished(System.currentTimeMillis());
      indexedValue.isEndOfSnapshot(index == lastIndexOfSnapshot.getAsLong());
      indexedValue.maxIndex(Math.max(dc.index(),lastIndexRead));
      return indexedValue;
    }
  finally {
      if (dc.isPresent())       while (dc.wire().hasMore()) {
        dc.wire().read().skipValue();
      }
    }
  }
 }