Program: 31410
Project: 31410
Buggy source:
@Nullable private Iterator<Record> executeQuery(ChunkedResponse r,JsonHandlerContext ctx) throws IOException {
  CharSequence query=ctx.query;
  try {
    JournalCachingFactory factory=factoryPool.get();
    ctx.factory=factory;
    ctx.recordSource=queryCompilerLocal.get().compileAndRemoveFromCache(factory,query);
    RecordCursor records=ctx.recordSource.prepareCursor(factory);
    r.status(200,"String_Node_Str");
    r.sendHeader();
    r.put('{').putQuoted("String_Node_Str").put(':').putUtf8EscapedAndQuoted(query);
    r.put(',').putQuoted("String_Node_Str").put(':').put('[');
    RecordMetadata metadata=records.getMetadata();
    ctx.metadata=metadata;
    ctx.records=records;
    int columnCount=metadata.getColumnCount();
    for (int i=0; i < columnCount; i++) {
      RecordColumnMetadata column=metadata.getColumnQuick(i);
      if (i > 0) {
        r.put(',');
      }
      r.put('{').putQuoted("String_Node_Str").put(':').putQuoted(column.getName()).put(',').putQuoted("String_Node_Str").put(':').putQuoted(column.getType().name());
      r.put('}');
    }
    r.put(']').put(',');
    r.putQuoted("String_Node_Str").put(':').put('[');
    return records;
  }
 catch (  ParserException pex) {
    ctx.info().$("String_Node_Str").$(query).$(pex).$();
    sendException(r,query,QueryError.getPosition(),QueryError.getMessage(),400);
  }
catch (  JournalException jex) {
    ctx.info().$("String_Node_Str").$(query).$(jex).$();
    sendException(r,query,0,jex.getMessage(),500);
  }
catch (  InterruptedException ex) {
    ctx.info().$("String_Node_Str").$(query).$(ex).$();
    sendException(r,query,0,"String_Node_Str",500);
  }
  return null;
}

Fixed version (ground truth):
private void executeQuery(ChunkedResponse r,JsonHandlerContext ctx) throws IOException {
  CharSequence query=ctx.query;
  try {
    JournalCachingFactory factory=factoryPool.get();
    ctx.factory=factory;
    ctx.recordSource=COMPILER.get().compileAndRemoveFromCache(factory,query);
    RecordCursor cursor=ctx.cursor=ctx.recordSource.prepareCursor(factory);
    r.status(200,"String_Node_Str");
    r.sendHeader();
    r.put('{').putQuoted("String_Node_Str").put(':').putUtf8EscapedAndQuoted(query);
    r.put(',').putQuoted("String_Node_Str").put(':').put('[');
    RecordMetadata metadata=cursor.getMetadata();
    ctx.metadata=metadata;
    for (int i=0, n=metadata.getColumnCount(); i < n; i++) {
      RecordColumnMetadata column=metadata.getColumnQuick(i);
      if (i > 0) {
        r.put(',');
      }
      r.put('{').putQuoted("String_Node_Str").put(':').putQuoted(column.getName()).put(',').putQuoted("String_Node_Str").put(':').putQuoted(column.getType().name());
      r.put('}');
    }
    r.put(']').put(',');
    r.putQuoted("String_Node_Str").put(':').put('[');
  }
 catch (  ParserException pex) {
    ctx.info().$("String_Node_Str").$(query).$("String_Node_Str").$(QueryError.getPosition()).$("String_Node_Str").$(QueryError.getMessage()).$();
    sendException(r,query,QueryError.getPosition(),QueryError.getMessage(),400);
  }
catch (  JournalException jex) {
    ctx.error().$("String_Node_Str").$(query).$(jex).$();
    sendException(r,query,0,jex.getMessage(),500);
  }
catch (  InterruptedException ex) {
    ctx.error().$("String_Node_Str").$(query).$(ex).$();
    sendException(r,query,0,"String_Node_Str",500);
  }
}