Program: 161041
Project: 161041
Buggy source:
public StreamingOutput streamVersion(final ObjectType type,final String key,final String source,final Integer revision,final HttpServletRequest request){
  return new StreamingOutput(){
    @Override public void write(    final OutputStream output) throws IOException, WebApplicationException {
      final StreamingMarshal marshal=StreamingHelper.getStreamingMarshal(request,output);
      final ReferenceStreamHandler streamHandler=new ReferenceStreamHandler(marshal,source,versionObjectMapper);
      ObjectVersion version=null;
      RpslObject rpslObject=null;
      List<VersionInfo> entriesInSameVersion=null;
      try {
        version=objectReferenceDao.getVersion(type,key,revision);
        entriesInSameVersion=lookupRpslObjectByVersion(version);
        rpslObject=versionDao.getRpslObject(entriesInSameVersion.get(0));
        rpslObject=decorateRpslObject(rpslObject);
      }
 catch (      DataAccessException e) {
        throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).entity(notFoundWhoisInternalResources(request,InternalMessages.noVersion(key))).build());
      }
      streamHandler.streamWhoisObject(rpslObject);
      streamHandler.streamVersion(version);
      if (entriesInSameVersion.size() > 1) {
        streamHandler.streamErrorMessage(InternalMessages.multipleVersionsForTimestamp(entriesInSameVersion.size()));
      }
      objectReferenceDao.streamIncoming(version,streamHandler);
      streamHandler.endStreamingIncoming();
      objectReferenceDao.streamOutgoing(version,streamHandler);
      streamHandler.flush();
    }
  }
;
}

Fixed version (ground truth):
public StreamingOutput streamVersion(final ObjectType type,final String key,final String source,final Integer revision,final HttpServletRequest request){
  return new StreamingOutput(){
    @Override public void write(    final OutputStream output) throws IOException, WebApplicationException {
      final StreamingMarshal marshal=StreamingHelper.getStreamingMarshal(request,output);
      final ReferenceStreamHandler streamHandler=new ReferenceStreamHandler(marshal,source,versionObjectMapper);
      ObjectVersion version;
      RpslObject rpslObject;
      List<VersionInfo> entriesInSameVersion=null;
      try {
        version=objectReferenceDao.getVersion(type,key,revision);
        entriesInSameVersion=lookupRpslObjectByVersion(version);
        rpslObject=versionDao.getRpslObject(entriesInSameVersion.get(0));
        rpslObject=decorateRpslObject(rpslObject);
      }
 catch (      DataAccessException e) {
        throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).entity(notFoundWhoisInternalResources(request,InternalMessages.noVersion(key))).build());
      }
      streamHandler.streamWhoisObject(rpslObject);
      streamHandler.streamVersion(version);
      if (entriesInSameVersion.size() > 1) {
        streamHandler.streamErrorMessage(InternalMessages.multipleVersionsForTimestamp(entriesInSameVersion.size()));
      }
      objectReferenceDao.streamIncoming(version,streamHandler);
      streamHandler.endStreamingIncoming();
      objectReferenceDao.streamOutgoing(version,streamHandler);
      streamHandler.flush();
    }
  }
;
}