nus-yam/ex-repair huggingface dataset:
Program: 31423
Project: 31423
Buggy source:
@SuppressFBWarnings({"String_Node_Str"}) public AggregatedRecordSource(RecordSource recordSource,@Transient ObjHashSet<String> keyColumns,ObjList<AggregatorFunction> aggregators){
  int keyColumnsSize=keyColumns.size();
  this.keyIndices=new int[keyColumnsSize];
  RecordMetadata rm=recordSource.getMetadata();
  for (int i=0; i < keyColumnsSize; i++) {
    keyIndices[i]=rm.getColumnIndex(keyColumns.get(i));
  }
  this.aggregators=aggregators;
  ObjList<MapRecordValueInterceptor> interceptors=new ObjList<>();
  ObjList<RecordColumnMetadata> columns=tlColumns.get();
  columns.clear();
  int index=0;
  for (int i=0, sz=aggregators.size(); i < sz; i++) {
    AggregatorFunction func=aggregators.getQuick(i);
    int n=columns.size();
    func.prepare(rm,columns,index);
    index+=columns.size() - n;
    if (func instanceof MapRecordValueInterceptor) {
      interceptors.add((MapRecordValueInterceptor)func);
    }
  }
  this.map=new MultiMap(rm,keyColumns,columns,interceptors);
  this.recordSource=recordSource;
}

Fixed version (ground truth):
@SuppressFBWarnings({"String_Node_Str"}) public AggregatedRecordSource(RecordSource recordSource,@Transient ObjHashSet<String> keyColumns,ObjList<AggregatorFunction> aggregators){
  int keyColumnsSize=keyColumns.size();
  this.keyIndices=new int[keyColumnsSize];
  RecordMetadata rm=recordSource.getMetadata();
  for (int i=0; i < keyColumnsSize; i++) {
    keyIndices[i]=rm.getColumnIndex(keyColumns.get(i));
  }
  this.aggregators=aggregators;
  ObjList<MapRecordValueInterceptor> interceptors=new ObjList<>();
  ObjList<RecordColumnMetadata> columns=tlColumns.get();
  columns.clear();
  int index=0;
  for (int i=0, sz=aggregators.size(); i < sz; i++) {
    AggregatorFunction func=aggregators.getQuick(i);
    int n=columns.size();
    func.prepare(columns,index);
    index+=columns.size() - n;
    if (func instanceof MapRecordValueInterceptor) {
      interceptors.add((MapRecordValueInterceptor)func);
    }
  }
  this.map=new MultiMap(rm,keyColumns,columns,interceptors);
  this.recordSource=recordSource;
}
Program: 31424
Project: 31424
Buggy source:
@SuppressFBWarnings({"String_Node_Str"}) public ResampledRecordSource(RecordSource recordSource,@Transient ObjHashSet<String> keyColumns,ObjList<AggregatorFunction> aggregators,TimestampSampler sampler){
  int keyColumnsSize=keyColumns.size();
  this.keyIndices=new IntList(keyColumnsSize);
  ObjHashSet<String> keyCols=new ObjHashSet<>();
  RecordMetadata rm=recordSource.getMetadata();
  this.tsIndex=rm.getTimestampIndex();
  keyCols.add(rm.getColumnName(tsIndex));
  for (int i=0; i < keyColumnsSize; i++) {
    keyCols.add(keyColumns.get(i));
    int index=rm.getColumnIndex(keyColumns.get(i));
    if (index != tsIndex) {
      keyIndices.add(index);
    }
  }
  this.aggregators=aggregators;
  this.sampler=sampler;
  ObjList<MapRecordValueInterceptor> interceptors=new ObjList<>();
  ObjList<RecordColumnMetadata> columns=tlColumns.get();
  columns.clear();
  int index=0;
  for (int i=0, sz=aggregators.size(); i < sz; i++) {
    AggregatorFunction func=aggregators.getQuick(i);
    int n=columns.size();
    func.prepare(rm,columns,index);
    index+=columns.size() - n;
    if (func instanceof MapRecordValueInterceptor) {
      interceptors.add((MapRecordValueInterceptor)func);
    }
  }
  this.map=new MultiMap(rm,keyCols,columns,interceptors);
  this.recordSource=recordSource;
}

Fixed version (ground truth):
@SuppressFBWarnings({"String_Node_Str"}) public ResampledRecordSource(RecordSource recordSource,@Transient ObjHashSet<String> keyColumns,ObjList<AggregatorFunction> aggregators,TimestampSampler sampler){
  int keyColumnsSize=keyColumns.size();
  this.keyIndices=new IntList(keyColumnsSize);
  ObjHashSet<String> keyCols=new ObjHashSet<>();
  RecordMetadata rm=recordSource.getMetadata();
  this.tsIndex=rm.getTimestampIndex();
  keyCols.add(rm.getColumnName(tsIndex));
  for (int i=0; i < keyColumnsSize; i++) {
    keyCols.add(keyColumns.get(i));
    int index=rm.getColumnIndex(keyColumns.get(i));
    if (index != tsIndex) {
      keyIndices.add(index);
    }
  }
  this.aggregators=aggregators;
  this.sampler=sampler;
  ObjList<MapRecordValueInterceptor> interceptors=new ObjList<>();
  ObjList<RecordColumnMetadata> columns=tlColumns.get();
  columns.clear();
  int index=0;
  for (int i=0, sz=aggregators.size(); i < sz; i++) {
    AggregatorFunction func=aggregators.getQuick(i);
    int n=columns.size();
    func.prepare(columns,index);
    index+=columns.size() - n;
    if (func instanceof MapRecordValueInterceptor) {
      interceptors.add((MapRecordValueInterceptor)func);
    }
  }
  this.map=new MultiMap(rm,keyCols,columns,interceptors);
  this.recordSource=recordSource;
}
Program: 31425
Project: 31425
Buggy source:
@Override public void prepare(RecordMetadata metadata,ObjList<RecordColumnMetadata> columns,int offset){
  columns.add(this);
  valueIndex=offset;
}

Fixed version (ground truth):
@Override public void prepare(ObjList<RecordColumnMetadata> columns,int offset){
  columns.add(this);
  valueIndex=offset;
}
Program: 31426
Project: 31426
Buggy source:
@Override public void prepare(RecordMetadata rm,ObjList<RecordColumnMetadata> columns,int offset){
  columns.add(INTERNAL_COL_COUNT);
  columns.add(INTERNAL_COL_SUM);
  columns.add(new ColumnMetadata().setName(getName()).setType(ColumnType.DOUBLE));
  countIdx=offset;
  sumIdx=offset + 1;
  avgIdx=offset + 2;
}

Fixed version (ground truth):
@Override public void prepare(ObjList<RecordColumnMetadata> columns,int offset){
  columns.add(INTERNAL_COL_COUNT);
  columns.add(INTERNAL_COL_SUM);
  columns.add(new ColumnMetadata().setName(getName()).setType(ColumnType.DOUBLE));
  countIdx=offset;
  sumIdx=offset + 1;
  avgIdx=offset + 2;
}
Program: 31427
Project: 31427
Buggy source:
@Override public void prepare(RecordMetadata metadata,ObjList<RecordColumnMetadata> columns,int offset){
  columns.add(INTERNAL_COL_AMOUNT);
  columns.add(INTERNAL_COL_QUANTITY);
  columns.add(new ColumnMetadata().setName(getName()).setType(ColumnType.DOUBLE));
  sumAmtIdx=offset;
  sumQtyIdx=offset + 1;
  vwap=offset + 2;
}

Fixed version (ground truth):
@Override public void prepare(ObjList<RecordColumnMetadata> columns,int offset){
  columns.add(INTERNAL_COL_AMOUNT);
  columns.add(INTERNAL_COL_QUANTITY);
  columns.add(new ColumnMetadata().setName(getName()).setType(ColumnType.DOUBLE));
  sumAmtIdx=offset;
  sumQtyIdx=offset + 1;
  vwap=offset + 2;
}
Program: 31428
Project: 31428
Buggy source:
@Override public void clear(){
  debug().$("String_Node_Str").$();
  metadata=null;
  cursor=null;
  record=null;
  debug().$("String_Node_Str").$();
  factory=Misc.free(factory);
  if (recordSource != null) {
    COMPILER.get().reuse(query,recordSource);
    recordSource=null;
  }
  query=null;
}

Fixed version (ground truth):
@Override public void clear(){
  debug().$("String_Node_Str").$();
  metadata=null;
  cursor=null;
  record=null;
  debug().$("String_Node_Str").$();
  factory=Misc.free(factory);
  if (recordSource != null) {
    CACHE.get().put(query.toString(),recordSource);
    recordSource=null;
  }
  query=null;
}
Program: 31429
Project: 31429
Buggy source:
@Override public QueryCompiler newInstance(){
  return new QueryCompiler();
}

Fixed version (ground truth):
@Override public AssociativeCache<RecordSource> newInstance(){
  return new AssociativeCache<>(8,128);
}
Program: 31431
Project: 31431
Buggy source:
public RecordSource compileSource(JournalReaderFactory factory,CharSequence query) throws ParserException, JournalException {
  RecordSource rs=cache.peek(query);
  if (rs == null) {
    cache.put(query.toString(),rs=resetAndCompile(factory,query));
  }
 else {
    rs.reset();
  }
  return rs;
}

Fixed version (ground truth):
public RecordSource compileSource(JournalReaderFactory factory,CharSequence query) throws ParserException, JournalException {
  return resetAndCompile(factory,query);
}
Program: 31432
Project: 31432
Buggy source:
private RecordSource compileSourceInternal(JournalReaderFactory factory,CharSequence query) throws ParserException, JournalException {
  RecordSource rs=cache.poll(query);
  if (rs == null) {
    rs=compile(parser.parseInternal(query).getQueryModel(),factory);
    cache.put(query,rs);
  }
 else {
    rs.reset();
  }
  return rs;
}

Fixed version (ground truth):
private RecordSource compileSourceInternal(JournalReaderFactory factory,CharSequence query) throws ParserException, JournalException {
  return compile(parser.parseInternal(query).getQueryModel(),factory);
}
Program: 31433
Project: 31433
Buggy source:
@Test public void testJsonPooling() throws Exception {
  generateJournal();
  final JsonHandler[] handler=new JsonHandler[1];
  HttpServer server=new HttpServer(new HttpServerConfiguration(),new SimpleUrlMatcher(){
{
      put("String_Node_Str",handler[0]=createHandler());
    }
  }
);
  server.start();
  try {
    QueryResponse queryResponse1=download("String_Node_Str");
    QueryResponse queryResponse2=download("String_Node_Str");
    QueryResponse queryResponse3=download("String_Node_Str");
    QueryResponse queryResponse4=download("String_Node_Str");
    Assert.assertEquals(10,queryResponse1.result.length);
    Assert.assertEquals(10,queryResponse2.result.length);
    Assert.assertEquals(10,queryResponse3.result.length);
    Assert.assertEquals(10,queryResponse4.result.length);
  }
  finally {
    factoryPool.close();
    server.halt();
  }
}

Fixed version (ground truth):
@Test public void testJsonPooling() throws Exception {
  generateJournal();
  final JsonHandler[] handler=new JsonHandler[1];
  HttpServer server=new HttpServer(new HttpServerConfiguration(),new SimpleUrlMatcher(){
{
      put("String_Node_Str",handler[0]=createHandler());
    }
  }
);
  server.start();
  try {
    QueryResponse queryResponse1=download("String_Node_Str");
    QueryResponse queryResponse2=download("String_Node_Str");
    QueryResponse queryResponse3=download("String_Node_Str");
    QueryResponse queryResponse4=download("String_Node_Str");
    Assert.assertEquals(10,queryResponse1.result.length);
    Assert.assertEquals(10,queryResponse2.result.length);
    Assert.assertEquals(10,queryResponse3.result.length);
    Assert.assertEquals(10,queryResponse4.result.length);
    Assert.assertTrue(handler[0].getCacheHits() > 0);
    Assert.assertTrue(handler[0].getCacheMisses() > 0);
  }
  finally {
    factoryPool.close();
    server.halt();
  }
}
Program: 31434
Project: 31434
Buggy source:
protected void assertThat(String expected,String query) throws JournalException, ParserException, IOException {
  assertThat(expected,query,false);
  assertThat(expected,query,false);
  compiler.clearCache();
}

Fixed version (ground truth):
protected void assertThat(String expected,String query) throws JournalException, ParserException, IOException {
  assertThat(expected,query,false);
  assertThat(expected,query,false);
}
Program: 31435
Project: 31435
Buggy source:
@Test public void testParamInLimit() throws Exception {
  createTabWithNaNs2();
  final String expected="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  sink.clear();
  RecordSource src=compiler.compileSource(factory,"String_Node_Str");
  src.getParam("String_Node_Str").set(10L);
  printer.printCursor(src.prepareCursor(factory),false);
  TestUtils.assertEquals(expected,sink);
  sink.clear();
  src=compiler.compileSource(factory,"String_Node_Str");
  printer.printCursor(src.prepareCursor(factory),false);
  TestUtils.assertEquals(expected,sink);
  sink.clear();
  src=compiler.compileSource(factory,"String_Node_Str");
  src.getParam("String_Node_Str").set(5L);
  printer.printCursor(src.prepareCursor(factory),false);
  final String expected2="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  TestUtils.assertEquals(expected2,sink);
}

Fixed version (ground truth):
@Test public void testParamInLimit() throws Exception {
  createTabWithNaNs2();
  final String expected="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  sink.clear();
  RecordSource src=compiler.compileSource(factory,"String_Node_Str");
  src.getParam("String_Node_Str").set(10L);
  printer.printCursor(src.prepareCursor(factory),false);
  TestUtils.assertEquals(expected,sink);
  sink.clear();
  src=compiler.compileSource(factory,"String_Node_Str");
  src.getParam("String_Node_Str").set(10L);
  printer.printCursor(src.prepareCursor(factory),false);
  TestUtils.assertEquals(expected,sink);
  sink.clear();
  src=compiler.compileSource(factory,"String_Node_Str");
  src.getParam("String_Node_Str").set(5L);
  printer.printCursor(src.prepareCursor(factory),false);
  final String expected2="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  TestUtils.assertEquals(expected2,sink);
}
Program: 31436
Project: 31436
Buggy source:
private boolean processRegistrations(long timestamp){
  long cursor;
  boolean useful=false;
  int count=0;
  int offset=0;
  while ((cursor=interestSubSequence.next()) > -1) {
    useful=true;
    IOEvent evt=interestQueue.get(cursor);
    IOContext context=evt.context;
    ChannelStatus op=evt.status;
    interestSubSequence.done(cursor);
    int fd=(int)context.channel.getFd();
    LOG.debug().$("String_Node_Str").$(fd).$("String_Node_Str").$(op).$();
    kqueue.setOffset(offset);
    offset+=Kqueue.SIZEOF_KEVENT;
    count++;
switch (op) {
case READ:
      kqueue.readFD(fd,timestamp);
    break;
case WRITE:
  kqueue.writeFD(fd,timestamp);
break;
case DISCONNECTED:
disconnect(context,DisconnectReason.SILLY);
continue;
}
int r=pending.addRow();
pending.set(r,0,timestamp);
pending.set(r,1,fd);
pending.set(r,context);
if (count > Kqueue.NUM_KEVENTS - 1) {
kqueue.register(count);
count=0;
}
}
if (count > 0) {
kqueue.register(count);
}
return useful;
}

Fixed version (ground truth):
private boolean processRegistrations(long timestamp){
  long cursor;
  boolean useful=false;
  int count=0;
  int offset=0;
  while ((cursor=interestSubSequence.next()) > -1) {
    useful=true;
    IOEvent evt=interestQueue.get(cursor);
    IOContext context=evt.context;
    ChannelStatus op=evt.status;
    interestSubSequence.done(cursor);
    int fd=(int)context.channel.getFd();
    LOG.debug().$("String_Node_Str").$(fd).$("String_Node_Str").$(op).$();
    kqueue.setOffset(offset);
    offset+=Kqueue.SIZEOF_KEVENT;
    count++;
switch (op) {
case READ:
      kqueue.readFD(fd,timestamp);
    break;
case WRITE:
  kqueue.writeFD(fd,timestamp);
break;
case DISCONNECTED:
disconnect(context,DisconnectReason.SILLY);
continue;
case EOF:
disconnect(context,DisconnectReason.PEER);
continue;
}
int r=pending.addRow();
pending.set(r,0,timestamp);
pending.set(r,1,fd);
pending.set(r,context);
if (count > Kqueue.NUM_KEVENTS - 1) {
kqueue.register(count);
count=0;
}
}
if (count > 0) {
kqueue.register(count);
}
return useful;
}
Program: 31438
Project: 31438
Buggy source:
private void disconnect(IOContext context,KQueueDispatcher.DisconnectReason reason){
  LOG.debug().$("String_Node_Str").$(context.channel.getFd()).$("String_Node_Str").$(reason).$();
  context.close();
  connectionCount--;
}

Fixed version (ground truth):
private void disconnect(IOContext context,DisconnectReason reason){
  LOG.debug().$("String_Node_Str").$(context.channel.getFd()).$("String_Node_Str").$(reason).$();
  context.close();
  connectionCount--;
}
Program: 31440
Project: 31440
Buggy source:
public void read(long localRowID,T obj){
  for (int i=0; i < columnCount; i++) {
    ColumnMetadata m;
    if (journal.getInactiveColumns().get(i) || (m=Unsafe.arrayGet(columnMetadata,i)).offset == 0) {
      continue;
    }
switch (m.type) {
case BOOLEAN:
      Unsafe.getUnsafe().putBoolean(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getBool(localRowID));
    break;
case BYTE:
  Unsafe.getUnsafe().putByte(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getByte(localRowID));
break;
case DOUBLE:
Unsafe.getUnsafe().putDouble(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getDouble(localRowID));
break;
case FLOAT:
Unsafe.getUnsafe().putFloat(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getFloat(localRowID));
break;
case INT:
Unsafe.getUnsafe().putInt(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getInt(localRowID));
break;
case LONG:
case DATE:
Unsafe.getUnsafe().putLong(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getLong(localRowID));
break;
case SHORT:
Unsafe.getUnsafe().putShort(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getShort(localRowID));
break;
case STRING:
Unsafe.getUnsafe().putObject(obj,m.offset,((VariableColumn)Unsafe.arrayGet(columns,i)).getStr(localRowID));
break;
case SYMBOL:
Unsafe.getUnsafe().putObject(obj,m.offset,m.symbolTable.value(((FixedColumn)Unsafe.arrayGet(columns,i)).getInt(localRowID)));
break;
case BINARY:
readBin(localRowID,obj,i,m);
}
}
}

Fixed version (ground truth):
public void read(long localRowID,T obj){
  for (int i=0; i < columnCount; i++) {
    ColumnMetadata m;
    if (journal.getInactiveColumns().get(i) || (m=Unsafe.arrayGet(columnMetadata,i)).offset == 0) {
      continue;
    }
switch (m.type) {
case BOOLEAN:
      Unsafe.getUnsafe().putBoolean(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getBool(localRowID));
    break;
case BYTE:
  Unsafe.getUnsafe().putByte(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getByte(localRowID));
break;
case DOUBLE:
Unsafe.getUnsafe().putDouble(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getDouble(localRowID));
break;
case FLOAT:
Unsafe.getUnsafe().putFloat(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getFloat(localRowID));
break;
case INT:
Unsafe.getUnsafe().putInt(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getInt(localRowID));
break;
case LONG:
case DATE:
Unsafe.getUnsafe().putLong(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getLong(localRowID));
break;
case SHORT:
Unsafe.getUnsafe().putShort(obj,m.offset,((FixedColumn)Unsafe.arrayGet(columns,i)).getShort(localRowID));
break;
case STRING:
Unsafe.getUnsafe().putObject(obj,m.offset,((VariableColumn)Unsafe.arrayGet(columns,i)).getStr(localRowID));
break;
case SYMBOL:
Unsafe.getUnsafe().putObject(obj,m.offset,m.symbolTable.value(((FixedColumn)Unsafe.arrayGet(columns,i)).getInt(localRowID)));
break;
case BINARY:
readBin(localRowID,obj,i,m);
break;
default :
break;
}
}
}
Program: 31441
Project: 31441
Buggy source:
private void printRecord(Record r,RecordMetadata m,int i){
switch (m.getColumnQuick(i).getType()) {
case DATE:
    Dates.appendDateTime(sink,r.getDate(i));
  break;
case DOUBLE:
Numbers.append(sink,r.getDouble(i),12);
break;
case FLOAT:
Numbers.append(sink,r.getFloat(i),4);
break;
case INT:
Numbers.append(sink,r.getInt(i));
break;
case STRING:
r.getStr(i,sink);
break;
case SYMBOL:
sink.put(r.getSym(i));
break;
case SHORT:
Numbers.append(sink,r.getShort(i));
break;
case LONG:
Numbers.append(sink,r.getLong(i));
break;
case BYTE:
Numbers.append(sink,r.get(i));
break;
case BOOLEAN:
sink.put(r.getBool(i) ? "String_Node_Str" : "String_Node_Str");
break;
}
}

Fixed version (ground truth):
private void printRecord(Record r,RecordMetadata m,int i){
switch (m.getColumnQuick(i).getType()) {
case DATE:
    Dates.appendDateTime(sink,r.getDate(i));
  break;
case DOUBLE:
Numbers.append(sink,r.getDouble(i),12);
break;
case FLOAT:
Numbers.append(sink,r.getFloat(i),4);
break;
case INT:
Numbers.append(sink,r.getInt(i));
break;
case STRING:
r.getStr(i,sink);
break;
case SYMBOL:
sink.put(r.getSym(i));
break;
case SHORT:
Numbers.append(sink,r.getShort(i));
break;
case LONG:
Numbers.append(sink,r.getLong(i));
break;
case BYTE:
Numbers.append(sink,r.get(i));
break;
case BOOLEAN:
sink.put(r.getBool(i) ? "String_Node_Str" : "String_Node_Str");
break;
default :
break;
}
}
Program: 31443
Project: 31443
Buggy source:
@SuppressFBWarnings({"String_Node_Str"}) @Override public void onLineCount(int count){
  if (calcTypes(count,true) && !calcTypes(count - 1,false)) {
    for (int i=0; i < fieldCount; i++) {
      _metadata.getQuick(i).name=_headers.getQuick(i);
    }
    header=true;
  }
  if (!header) {
    for (int i=0; i < fieldCount; i++) {
      tempSink.clear();
      tempSink.put('f').put(i);
      _metadata.getQuick(i).name=tempSink.toString();
    }
  }
  if (importSchema != null) {
    ObjList<ImportedColumnMetadata> override=importSchema.getMetadata();
    for (int i=0, k=override.size(); i < k; i++) {
      ImportedColumnMetadata m=override.getQuick(i);
      if (m.columnIndex < fieldCount) {
        ImportedColumnMetadata im=_metadata.getQuick(m.columnIndex);
        im.importedType=m.importedType;
        im.type=m.type;
        im.size=m.size;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onLineCount(int count){
  if (calcTypes(count,true) && !calcTypes(count - 1,false)) {
    for (int i=0; i < fieldCount; i++) {
      _metadata.getQuick(i).name=_headers.getQuick(i);
    }
    header=true;
  }
  if (!header) {
    for (int i=0; i < fieldCount; i++) {
      tempSink.clear();
      tempSink.put('f').put(i);
      _metadata.getQuick(i).name=tempSink.toString();
    }
  }
  if (importSchema != null) {
    ObjList<ImportedColumnMetadata> override=importSchema.getMetadata();
    for (int i=0, k=override.size(); i < k; i++) {
      ImportedColumnMetadata m=override.getQuick(i);
      if (m.columnIndex < fieldCount) {
        ImportedColumnMetadata im=_metadata.getQuick(m.columnIndex);
        im.importedType=m.importedType;
        im.type=m.type;
        im.size=m.size;
      }
    }
  }
}
Program: 31444
Project: 31444
Buggy source:
/** 
 * computes the length of binary data speculatively. <p/> <p/> Our requirement is to create byte[] of the exact length to store the binary data. If we do this in a straight-forward way, it takes two passes over the data. Experiments show that this is a non-trivial overhead (35% or so is spent on the first pass in calculating the length.) <p/> <p/> So the approach here is that we compute the length speculatively, without looking at the whole contents. The obtained speculative value is never less than the actual length of the binary data, but it may be bigger. So if the speculation goes wrong, we'll pay the cost of reallocation and buffer copying. <p/> <p/> If the base64 text is tightly packed with no indentation nor illegal char (like what most web services produce), then the speculation of this method will be correct, so we get the performance benefit.
 */
private static int guessLength(String text){
  final int len=text.length();
  int j=len - 1;
  for (; j > -1; j--) {
    byte code=decodeMap[text.charAt(j)];
    if (code == PADDING) {
      continue;
    }
    if (code == -1) {
      return text.length() / 4 * 3;
    }
    break;
  }
  j++;
  int padSize=len - j;
  if (padSize > 2) {
    return text.length() / 4 * 3;
  }
  return text.length() / 4 * 3 - padSize;
}

Fixed version (ground truth):
/** 
 * computes the length of binary data speculatively. <p/> <p/> Our requirement is to create byte[] of the exact length to store the binary data. If we do this in a straight-forward way, it takes two passes over the data. Experiments show that this is a non-trivial overhead (35% or so is spent on the first pass in calculating the length.) <p/> <p/> So the approach here is that we compute the length speculatively, without looking at the whole contents. The obtained speculative value is never less than the actual length of the binary data, but it may be bigger. So if the speculation goes wrong, we'll pay the cost of reallocation and buffer copying. <p/> <p/> If the base64 text is tightly packed with no indentation nor illegal char (like what most web services produce), then the speculation of this method will be correct, so we get the performance benefit.
 */
private static int guessLength(String text){
  final int len=text.length();
  int j=len - 1;
  for (; j > -1; j--) {
    byte code=decodeMap[text.charAt(j)];
    if (code != PADDING) {
      if (code == -1) {
        return text.length() / 4 * 3;
      }
      break;
    }
  }
  j++;
  int padSize=len - j;
  if (padSize > 2) {
    return text.length() / 4 * 3;
  }
  return text.length() / 4 * 3 - padSize;
}
Program: 31445
Project: 31445
Buggy source:
@SuppressFBWarnings("String_Node_Str") @SuppressWarnings("String_Node_Str") public static void copyNonBlocking(ReadableByteChannel channel,ByteBuffer to,final int retryCount) throws DisconnectedChannelException, SlowReadableChannelException, EndOfChannelException {
  int r=to.remaining();
  int target=r;
  int retriesRemaining=retryCount;
  while (target > 0) {
    int result;
    try {
      result=channel.read(to);
    }
 catch (    SlowReadableChannelException e) {
      throw e;
    }
catch (    IOException e) {
      throw DisconnectedChannelException.INSTANCE;
    }
    if (result == 0 && target == r && Net.EOF()) {
      throw EndOfChannelException.INSTANCE;
    }
    if (result == 0 && target < r) {
      break;
    }
 else     if (--retriesRemaining < 0) {
      throw SlowReadableChannelException.INSTANCE;
    }
    target-=result;
  }
}

Fixed version (ground truth):
@SuppressFBWarnings("String_Node_Str") @SuppressWarnings("String_Node_Str") public static void copyNonBlocking(ReadableByteChannel channel,ByteBuffer to,final int retryCount) throws DisconnectedChannelException, SlowReadableChannelException, EndOfChannelException {
  int r=to.remaining();
  int target=r;
  int retriesRemaining=retryCount;
  while (target > 0) {
    int result;
    try {
      result=channel.read(to);
    }
 catch (    SlowReadableChannelException e) {
      throw e;
    }
catch (    IOException e) {
      throw DisconnectedChannelException.INSTANCE;
    }
    if (result == 0 && target == r && Net.eof()) {
      throw EndOfChannelException.INSTANCE;
    }
    if (result == 0 && target < r) {
      break;
    }
 else     if (--retriesRemaining < 0) {
      throw SlowReadableChannelException.INSTANCE;
    }
    target-=result;
  }
}
Program: 31446
Project: 31446
Buggy source:
private static long parseDateTimeFmt3(CharSequence seq,int lo,int lim) throws NumericException {
  int p=lo;
  int day=_int(seq,p,p+=2,lim);
  checkChar(seq,p++,lim,'/');
  int month=_int(seq,p,p+=2,lim);
  checkRange(month,1,12);
  checkChar(seq,p++,lim,'/');
  int year=_int(seq,p,p + 4,lim);
  boolean l=isLeapYear(year);
  checkRange(day,1,getDaysPerMonth(month,l));
  return yearMillis(year,l) + monthOfYearMillis(month,l) + (day - 1) * DAY_MILLIS;
}

Fixed version (ground truth):
private static long parseDateTimeFmt3(CharSequence seq,int lo,int lim) throws NumericException {
  int p=lo;
  int day=int0(seq,p,p+=2,lim);
  checkChar(seq,p++,lim,'/');
  int month=int0(seq,p,p+=2,lim);
  checkRange(month,1,12);
  checkChar(seq,p++,lim,'/');
  int year=int0(seq,p,p + 4,lim);
  boolean l=isLeapYear(year);
  checkRange(day,1,getDaysPerMonth(month,l));
  return yearMillis(year,l) + monthOfYearMillis(month,l) + (day - 1) * DAY_MILLIS;
}
Program: 31447
Project: 31447
Buggy source:
@SuppressFBWarnings("String_Node_Str") public static <T>T free(T object){
  if (object instanceof Closeable) {
    try {
      ((Closeable)object).close();
      return null;
    }
 catch (    IOException e) {
      throw new Error(e);
    }
  }
  return object;
}

Fixed version (ground truth):
@SuppressFBWarnings("String_Node_Str") public static <T>T free(T object){
  if (object instanceof Closeable) {
    try {
      ((Closeable)object).close();
      return null;
    }
 catch (    IOException e) {
      throw new FatalError(e);
    }
  }
  return object;
}
Program: 31448
Project: 31448
Buggy source:
@SuppressWarnings("String_Node_Str") private static float parseFloat(CharSequence sequence,int p,int lim) throws NumericException {
  if (lim == p) {
    throw NumericException.INSTANCE;
  }
  boolean negative=sequence.charAt(p) == '-';
  if (negative) {
    p++;
  }
  if (p >= lim) {
    throw NumericException.INSTANCE;
  }
switch (sequence.charAt(p)) {
case 'N':
    return parseFloatConst(sequence,p,lim,NaN,Float.NaN);
case 'I':
  return parseFloatConst(sequence,p,lim,INFINITY,negative ? Float.NEGATIVE_INFINITY : Float.POSITIVE_INFINITY);
}
int val=0;
int dp=-1;
int dpe=lim;
int exp=0;
out: for (int i=p; i < lim; i++) {
int c=sequence.charAt(i);
switch (c) {
case '.':
  dp=i;
continue;
case 'E':
case 'e':
exp=parseInt(sequence,i + 1,lim);
if (dpe == lim) {
dpe=i;
}
break out;
default :
if (c < '0' || c > '9') {
throw NumericException.INSTANCE;
}
if (val <= INT_OVERFLOW_MAX) {
val=(val << 3) + (val << 1) + (c - '0');
}
 else if (dpe == lim) {
dpe=i;
}
}
}
exp=dp == -1 ? exp : exp - (dpe - dp - 1);
if (exp > 38) {
exp=38;
}
 else if (exp < -38) {
exp=-38;
}
if (exp > 0) {
return (negative ? -val : val) * pow10f[exp];
}
 else {
return (negative ? -val : val) / pow10f[-exp];
}
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private static float parseFloat(CharSequence sequence,int p,int lim) throws NumericException {
  if (lim == p) {
    throw NumericException.INSTANCE;
  }
  boolean negative=sequence.charAt(p) == '-';
  if (negative) {
    p++;
  }
  if (p >= lim) {
    throw NumericException.INSTANCE;
  }
switch (sequence.charAt(p)) {
case 'N':
    return parseFloatConst(sequence,p,lim,NaN,Float.NaN);
case 'I':
  return parseFloatConst(sequence,p,lim,INFINITY,negative ? Float.NEGATIVE_INFINITY : Float.POSITIVE_INFINITY);
default :
break;
}
int val=0;
int dp=-1;
int dpe=lim;
int exp=0;
out: for (int i=p; i < lim; i++) {
int c=sequence.charAt(i);
switch (c) {
case '.':
dp=i;
continue;
case 'E':
case 'e':
exp=parseInt(sequence,i + 1,lim);
if (dpe == lim) {
dpe=i;
}
break out;
default :
if (c < '0' || c > '9') {
throw NumericException.INSTANCE;
}
if (val <= INT_OVERFLOW_MAX) {
val=(val << 3) + (val << 1) + (c - '0');
}
 else if (dpe == lim) {
dpe=i;
}
}
}
exp=dp == -1 ? exp : exp - (dpe - dp - 1);
if (exp > 38) {
exp=38;
}
 else if (exp < -38) {
exp=-38;
}
if (exp > 0) {
return (negative ? -val : val) * pow10f[exp];
}
 else {
return (negative ? -val : val) / pow10f[-exp];
}
}
Program: 31449
Project: 31449
Buggy source:
@SuppressFBWarnings("String_Node_Str") private static void loadLib(String lib){
  InputStream is=Os.class.getResourceAsStream(lib);
  if (is == null) {
    throw new Error("String_Node_Str" + lib + "String_Node_Str");
  }
  try {
    File tempLib=null;
    try {
      tempLib=File.createTempFile(lib,"String_Node_Str");
      try (FileOutputStream out=new FileOutputStream(tempLib)){
        byte[] buf=new byte[4096];
        while (true) {
          int read=is.read(buf);
          if (read == -1) {
            break;
          }
          out.write(buf,0,read);
        }
      }
  finally {
        tempLib.deleteOnExit();
      }
      System.load(tempLib.getAbsolutePath());
    }
 catch (    IOException e) {
      throw new Error("String_Node_Str" + tempLib,e);
    }
  }
  finally {
    Misc.free(is);
  }
}

Fixed version (ground truth):
@SuppressFBWarnings("String_Node_Str") private static void loadLib(String lib){
  InputStream is=Os.class.getResourceAsStream(lib);
  if (is == null) {
    throw new FatalError("String_Node_Str" + lib + "String_Node_Str");
  }
  try {
    File tempLib=null;
    try {
      tempLib=File.createTempFile(lib,"String_Node_Str");
      try (FileOutputStream out=new FileOutputStream(tempLib)){
        byte[] buf=new byte[4096];
        while (true) {
          int read=is.read(buf);
          if (read == -1) {
            break;
          }
          out.write(buf,0,read);
        }
      }
  finally {
        tempLib.deleteOnExit();
      }
      System.load(tempLib.getAbsolutePath());
    }
 catch (    IOException e) {
      throw new FatalError("String_Node_Str" + tempLib,e);
    }
  }
  finally {
    Misc.free(is);
  }
}
Program: 31450
Project: 31450
Buggy source:
@Override protected boolean runSerially(){
  boolean useful=false;
  final int n=kqueue.poll();
  int watermark=pending.size();
  final long timestamp=clock.getTicks();
  int offset=0;
  if (n > 0) {
    for (int i=0; i < n; i++) {
      kqueue.setOffset(offset);
      offset+=Kqueue.SIZEOF_KEVENT;
      int fd=kqueue.getFd();
      if (fd == socketFd) {
        long _fd=accept();
        if (_fd < 0) {
          continue;
        }
        addPending(_fd,timestamp);
      }
 else {
        int row=findPending(fd,kqueue.getData());
        if (row < 0) {
          LOG.error().$("String_Node_Str").$(fd).$();
          continue;
        }
        long cursor=ioSequence.nextBully();
        IOEvent evt=ioQueue.get(cursor);
        evt.context=pending.get(row);
        evt.status=kqueue.getFilter() == Kqueue.EVFILT_READ ? ChannelStatus.READ : ChannelStatus.WRITE;
        ioSequence.done(cursor);
        LOG.debug().$("String_Node_Str").$(kqueue.getFilter()).$("String_Node_Str").$(fd).$();
        pending.deleteRow(row);
        watermark--;
      }
    }
    if (watermark < pending.size()) {
      enqueuePending(watermark);
    }
    useful=true;
  }
  long deadline=timestamp - timeout;
  if (pending.size() > 0 && pending.get(0,0) < deadline) {
    processIdleConnections(deadline);
    useful=true;
  }
  return processRegistrations(timestamp) || useful;
}

Fixed version (ground truth):
@Override protected boolean runSerially(){
  boolean useful=false;
  final int n=kqueue.poll();
  int watermark=pending.size();
  final long timestamp=clock.getTicks();
  int offset=0;
  if (n > 0) {
    for (int i=0; i < n; i++) {
      kqueue.setOffset(offset);
      offset+=Kqueue.SIZEOF_KEVENT;
      int fd=kqueue.getFd();
      if (fd == socketFd) {
        long _fd=accept();
        if (_fd < 0) {
          continue;
        }
        addPending(_fd,timestamp);
      }
 else {
        int row=findPending(fd,kqueue.getData());
        if (row < 0) {
          LOG.error().$("String_Node_Str").$(fd).$();
          continue;
        }
        if (kqueue.getFlags() == Kqueue.EV_EOF) {
          disconnect(pending.get(row),DisconnectReason.PEER);
        }
 else {
          long cursor=ioSequence.nextBully();
          IOEvent evt=ioQueue.get(cursor);
          evt.context=pending.get(row);
          evt.status=kqueue.getFilter() == Kqueue.EVFILT_READ ? ChannelStatus.READ : ChannelStatus.WRITE;
          ioSequence.done(cursor);
          LOG.debug().$("String_Node_Str").$(kqueue.getFilter()).$("String_Node_Str").$(fd).$();
        }
        pending.deleteRow(row);
        watermark--;
      }
    }
    if (watermark < pending.size()) {
      enqueuePending(watermark);
    }
    useful=true;
  }
  long deadline=timestamp - timeout;
  if (pending.size() > 0 && pending.get(0,0) < deadline) {
    processIdleConnections(deadline);
    useful=true;
  }
  return processRegistrations(timestamp) || useful;
}
Program: 31452
Project: 31452
Buggy source:
public CharSequence optionTok(){
  while (hasNext()) {
    CharSequence cs=next();
    if (!Chars.equals(cs,' ')) {
      return cs;
    }
  }
  return null;
}

Fixed version (ground truth):
public CharSequence optionTok(){
  while (hasNext()) {
    CharSequence cs=next();
    if (!whitespace.contains(cs)) {
      return cs;
    }
  }
  return null;
}
Program: 31453
Project: 31453
Buggy source:
private CharSequence optionTok(){
  while (lexer.hasNext()) {
    CharSequence cs=lexer.next();
    if (!whitespace.contains(cs)) {
      return cs;
    }
  }
  return null;
}

Fixed version (ground truth):
private CharSequence optionTok(){
  return lexer.optionTok();
}
Program: 31454
Project: 31454
Buggy source:
@Override public long availableIndex(long lo){
  for (int i=0, n=this.barriers.length; i < n; i++) {
    long cursor=Unsafe.arrayGet(this.barriers,i).availableIndex(lo);
    lo=lo < cursor ? lo : cursor;
  }
  return lo;
}

Fixed version (ground truth):
@SuppressFBWarnings("String_Node_Str") @Override public long availableIndex(long lo){
  Barrier[] barriers=this.barriers;
  for (int i=0, n=barriers.length; i < n; i++) {
    long cursor=Unsafe.arrayGet(barriers,i).availableIndex(lo);
    lo=lo < cursor ? lo : cursor;
  }
  return lo;
}
Program: 31455
Project: 31455
Buggy source:
@Test public void testPackageHierarchy() throws Exception {
  final File a=temp.newFile();
  final File b=temp.newFile();
  try (LoggerFactory factory=new LoggerFactory()){
    factory.add(new LogWriterConfig("String_Node_Str",LoggerFactory.LOG_LEVEL_INFO,new LogWriterFactory(){
      @Override public LogWriter createLogWriter(      RingQueue<LogRecordSink> ring,      Sequence seq){
        LogFileWriter w=new LogFileWriter(ring,seq);
        w.setLocation(a.getAbsolutePath());
        return w;
      }
    }
,LoggerFactory.DEFAULT_QUEUE_DEPTH,LoggerFactory.DEFAULT_MSG_SIZE));
    factory.add(new LogWriterConfig("String_Node_Str",LoggerFactory.LOG_LEVEL_INFO,new LogWriterFactory(){
      @Override public LogWriter createLogWriter(      RingQueue<LogRecordSink> ring,      Sequence seq){
        LogFileWriter w=new LogFileWriter(ring,seq);
        w.setLocation(b.getAbsolutePath());
        return w;
      }
    }
,LoggerFactory.DEFAULT_QUEUE_DEPTH,LoggerFactory.DEFAULT_MSG_SIZE));
    factory.bind();
    factory.startThread();
    AsyncLogger logger=factory.create("String_Node_Str");
    logger.xinfo()._("String_Node_Str").$();
    AsyncLogger logger1=factory.create("String_Node_Str");
    logger1.xinfo()._("String_Node_Str").$();
    Assert.assertEquals("String_Node_Str" + Misc.EOL,Files.readStringFromFile(a));
    Assert.assertEquals("String_Node_Str" + Misc.EOL,Files.readStringFromFile(b));
  }
 }

Fixed version (ground truth):
@Test public void testPackageHierarchy() throws Exception {
  final File a=temp.newFile();
  final File b=temp.newFile();
  try (LoggerFactory factory=new LoggerFactory()){
    factory.add(new LogWriterConfig("String_Node_Str",LoggerFactory.LOG_LEVEL_INFO,new LogWriterFactory(){
      @Override public LogWriter createLogWriter(      RingQueue<LogRecordSink> ring,      Sequence seq){
        LogFileWriter w=new LogFileWriter(ring,seq);
        w.setLocation(a.getAbsolutePath());
        return w;
      }
    }
,LoggerFactory.DEFAULT_QUEUE_DEPTH,LoggerFactory.DEFAULT_MSG_SIZE));
    factory.add(new LogWriterConfig("String_Node_Str",LoggerFactory.LOG_LEVEL_INFO,new LogWriterFactory(){
      @Override public LogWriter createLogWriter(      RingQueue<LogRecordSink> ring,      Sequence seq){
        LogFileWriter w=new LogFileWriter(ring,seq);
        w.setLocation(b.getAbsolutePath());
        return w;
      }
    }
,LoggerFactory.DEFAULT_QUEUE_DEPTH,LoggerFactory.DEFAULT_MSG_SIZE));
    factory.bind();
    factory.startThread();
    AsyncLogger logger=factory.create("String_Node_Str");
    logger.xinfo()._("String_Node_Str").$();
    AsyncLogger logger1=factory.create("String_Node_Str");
    logger1.xinfo()._("String_Node_Str").$();
    Thread.sleep(100);
    Assert.assertEquals("String_Node_Str" + Misc.EOL,Files.readStringFromFile(a));
    Assert.assertEquals("String_Node_Str" + Misc.EOL,Files.readStringFromFile(b));
  }
 }
Program: 31456
Project: 31456
Buggy source:
@Test public void testMultiplexing() throws Exception {
  final File x=temp.newFile();
  final File y=temp.newFile();
  try (LoggerFactory factory=new LoggerFactory()){
    factory.add(new LogWriterConfig(LoggerFactory.LOG_LEVEL_INFO,new LogWriterFactory(){
      @Override public LogWriter createLogWriter(      RingQueue<LogRecordSink> ring,      Sequence seq){
        LogFileWriter w=new LogFileWriter(ring,seq);
        w.setLocation(x.getAbsolutePath());
        return w;
      }
    }
,LoggerFactory.DEFAULT_QUEUE_DEPTH,LoggerFactory.DEFAULT_MSG_SIZE));
    factory.add(new LogWriterConfig(LoggerFactory.LOG_LEVEL_INFO,new LogWriterFactory(){
      @Override public LogWriter createLogWriter(      RingQueue<LogRecordSink> ring,      Sequence seq){
        LogFileWriter w=new LogFileWriter(ring,seq);
        w.setLocation(y.getAbsolutePath());
        return w;
      }
    }
,LoggerFactory.DEFAULT_QUEUE_DEPTH,LoggerFactory.DEFAULT_MSG_SIZE));
    factory.bind();
    factory.startThread();
    try {
      AsyncLogger logger=factory.create("String_Node_Str");
      for (int i=0; i < 100000; i++) {
        logger.xinfo()._("String_Node_Str")._(i).$();
      }
      Assert.assertTrue(x.length() > 0);
      TestUtils.assertEquals(x,y);
    }
  finally {
      factory.haltThread();
    }
  }
 }

Fixed version (ground truth):
@Test public void testMultiplexing() throws Exception {
  final File x=temp.newFile();
  final File y=temp.newFile();
  try (LoggerFactory factory=new LoggerFactory()){
    factory.add(new LogWriterConfig(LoggerFactory.LOG_LEVEL_INFO,new LogWriterFactory(){
      @Override public LogWriter createLogWriter(      RingQueue<LogRecordSink> ring,      Sequence seq){
        LogFileWriter w=new LogFileWriter(ring,seq);
        w.setLocation(x.getAbsolutePath());
        return w;
      }
    }
,LoggerFactory.DEFAULT_QUEUE_DEPTH,LoggerFactory.DEFAULT_MSG_SIZE));
    factory.add(new LogWriterConfig(LoggerFactory.LOG_LEVEL_INFO,new LogWriterFactory(){
      @Override public LogWriter createLogWriter(      RingQueue<LogRecordSink> ring,      Sequence seq){
        LogFileWriter w=new LogFileWriter(ring,seq);
        w.setLocation(y.getAbsolutePath());
        return w;
      }
    }
,LoggerFactory.DEFAULT_QUEUE_DEPTH,LoggerFactory.DEFAULT_MSG_SIZE));
    factory.bind();
    factory.startThread();
    try {
      AsyncLogger logger=factory.create("String_Node_Str");
      for (int i=0; i < 100000; i++) {
        logger.xinfo()._("String_Node_Str")._(i).$();
      }
      Thread.sleep(100);
      Assert.assertTrue(x.length() > 0);
      TestUtils.assertEquals(x,y);
    }
  finally {
      factory.haltThread();
    }
  }
 }
Program: 31458
Project: 31458
Buggy source:
private RecordSource<? extends Record> compileSingleOrSubQuery(QueryModel model,JournalReaderFactory factory) throws JournalException, ParserException {
  return model.getJournalName() != null ? compileSingleJournal(model,factory) : compileSubQuery(model,factory);
}

Fixed version (ground truth):
private RecordSource<? extends Record> compileSingleOrSubQuery(QueryModel model,JournalReaderFactory factory) throws JournalException, ParserException {
  if (model.getLimitLo() != null || model.getLimitHi() != null) {
    analyseLimit(model);
  }
  return model.getJournalName() != null ? compileSingleJournal(model,factory) : compileSubQuery(model,factory);
}
Program: 31459
Project: 31459
Buggy source:
private CharSequence optionTok(){
  while (lexer.hasNext()) {
    CharSequence cs=lexer.next();
    if (!Chars.equals(cs,' ')) {
      return cs;
    }
  }
  return null;
}

Fixed version (ground truth):
private CharSequence optionTok(){
  while (lexer.hasNext()) {
    CharSequence cs=lexer.next();
    if (!whitespace.contains(cs)) {
      return cs;
    }
  }
  return null;
}
Program: 31460
Project: 31460
Buggy source:
@Test @Ignore public void testJsonEncodeControlChars() throws Exception {
  generateJournal();
  HttpServer server=new HttpServer(new HttpServerConfiguration(),new SimpleUrlMatcher(){
{
      put("String_Node_Str",new JsonHandler(factory));
    }
  }
);
  server.start();
  try {
    String newLineStr="String_Node_Str";
    String query="String_Node_Str" + newLineStr + "String_Node_Str";
    QueryResponse queryResponse=download("String_Node_Str" + newLineStr + "String_Node_Str");
    Assert.assertEquals(query,queryResponse.query);
    Assert.assertEquals(newLineStr,queryResponse.result[0].id);
  }
  finally {
    server.halt();
  }
}

Fixed version (ground truth):
@Test public void testJsonEncodeControlChars() throws Exception {
  generateJournal();
  HttpServer server=new HttpServer(new HttpServerConfiguration(),new SimpleUrlMatcher(){
{
      put("String_Node_Str",new JsonHandler(factory));
    }
  }
);
  server.start();
  try {
    String newLineStr="String_Node_Str";
    String query="String_Node_Str" + newLineStr + "String_Node_Str";
    QueryResponse queryResponse=download("String_Node_Str" + newLineStr + "String_Node_Str");
    Assert.assertEquals(query,queryResponse.query);
    Assert.assertEquals(newLineStr,queryResponse.result[0].id);
  }
  finally {
    server.halt();
  }
}
Program: 31461
Project: 31461
Buggy source:
@Override public void alert(){
  signal();
}

Fixed version (ground truth):
@Override public void alert(){
  alerted=true;
  signal();
}
Program: 31462
Project: 31462
Buggy source:
@SuppressFBWarnings("String_Node_Str") @Override public void await(){
  lock.lock();
  try {
    condition.awaitUninterruptibly();
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@SuppressFBWarnings("String_Node_Str") @Override public void await(){
  lock.lock();
  try {
    if (alerted) {
      throw AlertedException.INSTANCE;
    }
    condition.awaitUninterruptibly();
  }
  finally {
    lock.unlock();
  }
}
Program: 31463
Project: 31463
Buggy source:
@SuppressFBWarnings({"String_Node_Str","String_Node_Str"}) @Override public void await(){
  lock.lock();
  try {
    if (!condition.await(time,unit)) {
      throw TimeoutException.INSTANCE;
    }
  }
 catch (  InterruptedException e) {
    throw new JournalRuntimeException(e);
  }
 finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@SuppressFBWarnings({"String_Node_Str","String_Node_Str"}) @Override public void await(){
  lock.lock();
  try {
    if (alerted) {
      throw AlertedException.INSTANCE;
    }
    if (!condition.await(time,unit)) {
      throw TimeoutException.INSTANCE;
    }
  }
 catch (  InterruptedException e) {
    throw new JournalRuntimeException(e);
  }
 finally {
    lock.unlock();
  }
}
Program: 31465
Project: 31465
Buggy source:
@SuppressFBWarnings({"String_Node_Str"}) @Override public void onFields(int line,CharSequence[] values,int hi){
  try {
    JournalEntryWriter w=writer.entryWriter();
    for (int i=0; i < hi; i++) {
      if (Unsafe.arrayGet(values,i).length() == 0) {
        continue;
      }
      try {
switch (metadata.getQuick(i).importedType) {
case STRING:
          w.putStr(i,Unsafe.arrayGet(values,i));
        break;
case DOUBLE:
      w.putDouble(i,Numbers.parseDoubleQuiet(Unsafe.arrayGet(values,i)));
    break;
case INT:
  w.putInt(i,Numbers.parseIntQuiet(Unsafe.arrayGet(values,i)));
break;
case FLOAT:
w.putFloat(i,Numbers.parseFloatQuiet(Unsafe.arrayGet(values,i)));
break;
case DATE_ISO:
w.putDate(i,Dates.parseDateTimeQuiet(Unsafe.arrayGet(values,i)));
break;
case DATE_1:
w.putDate(i,Dates.parseDateTimeFmt1Quiet(Unsafe.arrayGet(values,i)));
break;
case DATE_2:
w.putDate(i,Dates.parseDateTimeFmt2Quiet(Unsafe.arrayGet(values,i)));
break;
case DATE_3:
w.putDate(i,Dates.parseDateTimeFmt3Quiet(Unsafe.arrayGet(values,i)));
break;
case SYMBOL:
w.putSym(i,Unsafe.arrayGet(values,i));
break;
case LONG:
w.putLong(i,Numbers.parseLongQuiet(Unsafe.arrayGet(values,i)));
break;
case BOOLEAN:
w.putBool(i,Chars.equalsIgnoreCase(Unsafe.arrayGet(values,i),"String_Node_Str"));
}
}
 catch (Exception e) {
LOGGER.info("String_Node_Str",line,i,metadata.getQuick(i).type,e.getMessage());
break;
}
}
w.append();
}
 catch (JournalException e) {
throw new JournalRuntimeException(e);
}
}

Fixed version (ground truth):
@SuppressFBWarnings({"String_Node_Str"}) @Override public void onFields(int line,CharSequence[] values,int hi){
  try {
    JournalEntryWriter w=writer.entryWriter();
    for (int i=0; i < hi; i++) {
      if (Unsafe.arrayGet(values,i).length() == 0) {
        continue;
      }
      try {
switch (metadata.getQuick(i).importedType) {
case STRING:
          w.putStr(i,Unsafe.arrayGet(values,i));
        break;
case DOUBLE:
      w.putDouble(i,Numbers.parseDouble(Unsafe.arrayGet(values,i)));
    break;
case INT:
  w.putInt(i,Numbers.parseInt(Unsafe.arrayGet(values,i)));
break;
case FLOAT:
w.putFloat(i,Numbers.parseFloat(Unsafe.arrayGet(values,i)));
break;
case DATE_ISO:
w.putDate(i,Dates.parseDateTime(Unsafe.arrayGet(values,i)));
break;
case DATE_1:
w.putDate(i,Dates.parseDateTimeFmt1(Unsafe.arrayGet(values,i)));
break;
case DATE_2:
w.putDate(i,Dates.parseDateTimeFmt2(Unsafe.arrayGet(values,i)));
break;
case DATE_3:
w.putDate(i,Dates.parseDateTimeFmt3(Unsafe.arrayGet(values,i)));
break;
case SYMBOL:
w.putSym(i,Unsafe.arrayGet(values,i));
break;
case LONG:
w.putLong(i,Numbers.parseLong(Unsafe.arrayGet(values,i)));
break;
case BOOLEAN:
w.putBool(i,Chars.equalsIgnoreCase(Unsafe.arrayGet(values,i),"String_Node_Str"));
}
}
 catch (Exception e) {
errors.increment(i);
LOGGER.debug("String_Node_Str",line,i,metadata.getQuick(i).type,e.getMessage());
break;
}
}
w.append();
}
 catch (JournalException e) {
throw new JournalRuntimeException(e);
}
}