nus-yam/ex-repair huggingface dataset:
Program: 31207
Project: 31207
Buggy source:
public CharSequence getFlyweightStr(long localRowID){
  long offset=indexColumn.getLong(localRowID);
  int len=Unsafe.getUnsafe().getInt(mappedFile.addressOf(offset,4));
  if (len == NULL_LEN) {
    return null;
  }
  long lo=mappedFile.addressOf(offset + 4,len * 2);
  return csA.of(lo,lo + len * 2);
}

Fixed version (ground truth):
public CharSequence getFlyweightStr(long localRowID){
  return getFlyweightStr0(localRowID,csA);
}
Program: 31208
Project: 31208
Buggy source:
@Override public AnalyticColumn of(String alias,ExprNode ast){
  return (AnalyticColumn)super.of(alias,ast);
}

Fixed version (ground truth):
@Override public AnalyticColumn of(String alias,int aliasPosition,ExprNode ast){
  return (AnalyticColumn)super.of(alias,aliasPosition,ast);
}
Program: 31209
Project: 31209
Buggy source:
public QueryColumn of(String alias,ExprNode ast){
  this.alias=alias;
  this.ast=ast;
  return this;
}

Fixed version (ground truth):
public QueryColumn of(String alias,int aliasPosition,ExprNode ast){
  this.alias=alias;
  this.aliasPosition=aliasPosition;
  this.ast=ast;
  return this;
}
Program: 31210
Project: 31210
Buggy source:
private static void createColumnNameHistogram0(CharSequenceIntHashMap histogram,QueryModel model,JournalReaderFactory factory,boolean ignoreJoins) throws ParserException {
  ObjList<QueryModel> jm=model.getJoinModels();
  int jmSize=ignoreJoins ? 0 : jm.size();
  int n=model.getColumns().size();
  if (n > 0) {
    for (int i=0; i < n; i++) {
      QueryColumn qc=model.getColumns().getQuick(i);
switch (qc.getAst().type) {
case ExprNode.LITERAL:
        if (qc.getAlias() != null) {
          histogram.increment(qc.getAlias());
        }
 else {
          histogram.increment(qc.getAst().token);
        }
      break;
default :
    break;
}
}
}
 else if (jmSize > 0) {
for (int i=0; i < jmSize; i++) {
createColumnNameHistogram0(histogram,jm.getQuick(i),factory,true);
}
}
 else if (model.getJournalName() != null) {
RecordMetadata m=model.collectJournalMetadata(factory);
for (int i=0, k=m.getColumnCount(); i < k; i++) {
histogram.increment(m.getColumnName(i));
}
}
 else {
createColumnNameHistogram0(histogram,model.getNestedModel(),factory,false);
}
}

Fixed version (ground truth):
private static void createColumnNameHistogram0(CharSequenceIntHashMap histogram,QueryModel model,JournalReaderFactory factory,boolean ignoreJoins) throws ParserException {
  ObjList<QueryModel> jm=model.getJoinModels();
  int jmSize=ignoreJoins ? 0 : jm.size();
  int n=model.getColumns().size();
  if (n > 0) {
    for (int i=0; i < n; i++) {
      QueryColumn qc=model.getColumns().getQuick(i);
switch (qc.getAst().type) {
case ExprNode.LITERAL:
        histogram.increment(qc.getName());
      break;
default :
    break;
}
}
}
 else if (jmSize > 0) {
for (int i=0; i < jmSize; i++) {
createColumnNameHistogram0(histogram,jm.getQuick(i),factory,true);
}
}
 else if (model.getJournalName() != null) {
RecordMetadata m=model.collectJournalMetadata(factory);
for (int i=0, k=m.getColumnCount(); i < k; i++) {
histogram.increment(m.getColumnName(i));
}
}
 else {
createColumnNameHistogram0(histogram,model.getNestedModel(),factory,false);
}
}
Program: 31212
Project: 31212
Buggy source:
private void createOrderHash(QueryModel model){
  CharSequenceIntHashMap hash=model.getOrderHash();
  hash.clear();
  final ObjList<ExprNode> orderBy=model.getOrderBy();
  final int n=orderBy.size();
  final ObjList<QueryColumn> columns=model.getColumns();
  final int m=columns.size();
  final QueryModel nestedModel=model.getNestedModel();
  if (n > 0) {
    final IntList orderByDirection=model.getOrderByDirection();
    for (int i=0; i < n; i++) {
      hash.put(orderBy.getQuick(i).token,orderByDirection.getQuick(i));
    }
  }
 else   if (nestedModel != null && m > 0) {
    createOrderHash(nestedModel);
    CharSequenceIntHashMap thatHash=nestedModel.getOrderHash();
    if (thatHash.size() > 0) {
      for (int i=0; i < m; i++) {
        QueryColumn column=columns.getQuick(i);
        ExprNode node=column.getAst();
        if (node.type == ExprNode.LITERAL) {
          int direction=thatHash.get(node.token);
          if (direction != -1) {
            hash.put(column.getAlias() == null ? node.token : column.getAlias(),direction);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void createOrderHash(QueryModel model){
  CharSequenceIntHashMap hash=model.getOrderHash();
  hash.clear();
  final ObjList<ExprNode> orderBy=model.getOrderBy();
  final int n=orderBy.size();
  final ObjList<QueryColumn> columns=model.getColumns();
  final int m=columns.size();
  final QueryModel nestedModel=model.getNestedModel();
  if (n > 0) {
    final IntList orderByDirection=model.getOrderByDirection();
    for (int i=0; i < n; i++) {
      hash.put(orderBy.getQuick(i).token,orderByDirection.getQuick(i));
    }
  }
 else   if (nestedModel != null && m > 0) {
    createOrderHash(nestedModel);
    CharSequenceIntHashMap thatHash=nestedModel.getOrderHash();
    if (thatHash.size() > 0) {
      for (int i=0; i < m; i++) {
        QueryColumn column=columns.getQuick(i);
        ExprNode node=column.getAst();
        if (node.type == ExprNode.LITERAL) {
          int direction=thatHash.get(node.token);
          if (direction != -1) {
            hash.put(column.getName(),direction);
          }
        }
      }
    }
  }
}
Program: 31213
Project: 31213
Buggy source:
private ExprNode replaceIfAggregate(@Transient ExprNode node,ObjList<QueryColumn> aggregateColumns){
  if (node != null && FunctionFactories.isAggregate(node.token)) {
    QueryColumn c=aggregateColumnPool.next().of(createAlias(aggregateColumnSequence++),node);
    aggregateColumns.add(c);
    return exprNodePool.next().of(ExprNode.LITERAL,c.getAlias(),0,0);
  }
  return node;
}

Fixed version (ground truth):
private ExprNode replaceIfAggregate(@Transient ExprNode node,ObjList<QueryColumn> aggregateColumns){
  if (node != null && FunctionFactories.isAggregate(node.token)) {
    QueryColumn c=aggregateColumnPool.next().of(createAlias(aggregateColumnSequence++),node.position,node);
    aggregateColumns.add(c);
    return exprNodePool.next().of(ExprNode.LITERAL,c.getAlias(),0,0);
  }
  return node;
}
Program: 31214
Project: 31214
Buggy source:
private RecordSource compileAggregates(RecordSource rs,QueryModel model) throws ParserException {
  final int n=aggregators.size();
  final ExprNode sampleBy=model.getSampleBy();
  ObjList<AggregatorFunction> af=new ObjList<>(n);
  for (int i=0; i < n; i++) {
    QueryColumn qc=aggregators.get(i);
    try {
      VirtualColumn vc=virtualColumnBuilder.createVirtualColumn(model,qc.getAst(),rs.getMetadata());
      if (vc instanceof AggregatorFunction) {
        vc.setName(qc.getAlias());
        af.add((AggregatorFunction)vc);
      }
 else {
        throw QueryError.$(qc.getAst().position,"String_Node_Str");
      }
    }
 catch (    ParserException e) {
      Misc.free(rs);
      throw e;
    }
  }
  RecordSource out;
  if (sampleBy == null) {
    out=new AggregatedRecordSource(rs,groupKeyColumns,af,configuration.getDbAggregatePage());
  }
 else {
    TimestampSampler sampler=SamplerFactory.from(sampleBy.token);
    if (sampler == null) {
      Misc.free(rs);
      throw QueryError.$(sampleBy.position,"String_Node_Str");
    }
    out=new ResampledRecordSource(rs,getTimestampIndex(model,model.getTimestamp(),rs.getMetadata()),groupKeyColumns,af,sampler,configuration.getDbAggregatePage());
  }
  return out;
}

Fixed version (ground truth):
private RecordSource compileAggregates(RecordSource rs,QueryModel model) throws ParserException {
  final int n=aggregators.size();
  final ExprNode sampleBy=model.getSampleBy();
  ObjList<AggregatorFunction> af=new ObjList<>(n);
  for (int i=0; i < n; i++) {
    QueryColumn qc=aggregators.get(i);
    VirtualColumn vc=virtualColumnBuilder.createVirtualColumn(model,qc.getAst(),rs.getMetadata());
    if (vc instanceof AggregatorFunction) {
      vc.setName(qc.getAlias());
      af.add((AggregatorFunction)vc);
    }
 else {
      throw QueryError.$(qc.getAst().position,"String_Node_Str");
    }
  }
  RecordSource out;
  if (sampleBy == null) {
    out=new AggregatedRecordSource(rs,groupKeyColumns,af,configuration.getDbAggregatePage());
  }
 else {
    TimestampSampler sampler=SamplerFactory.from(sampleBy.token);
    if (sampler == null) {
      throw QueryError.$(sampleBy.position,"String_Node_Str");
    }
    out=new ResampledRecordSource(rs,getTimestampIndex(model,model.getTimestamp(),rs.getMetadata()),groupKeyColumns,af,sampler,configuration.getDbAggregatePage());
  }
  return out;
}
Program: 31217
Project: 31217
Buggy source:
private int getTimestampIndexQuiet(QueryModel model,ExprNode node,RecordMetadata m) throws ParserException {
  int pos=model.getJournalName() != null ? model.getJournalName().position : 0;
  if (node != null) {
    if (node.type != ExprNode.LITERAL) {
      throw QueryError.position(node.position).$("String_Node_Str").$();
    }
    int index=m.getColumnIndexQuiet(node.token);
    if (index == -1) {
      throw QueryError.position(node.position).$("String_Node_Str").$(node.token).$();
    }
    return index;
  }
 else {
    int index=m.getTimestampIndex();
    if (index > -1) {
      return index;
    }
    for (int i=0, n=m.getColumnCount(); i < n; i++) {
      if (m.getColumnQuick(i).getType() == ColumnType.DATE) {
        if (index == -1) {
          index=i;
        }
 else {
          throw QueryError.position(pos).$("String_Node_Str").$();
        }
      }
    }
    return index;
  }
}

Fixed version (ground truth):
private int getTimestampIndexQuiet(QueryModel model,ExprNode node,RecordMetadata m) throws ParserException {
  if (node != null) {
    if (node.type != ExprNode.LITERAL) {
      throw QueryError.position(node.position).$("String_Node_Str").$();
    }
    int index=m.getColumnIndexQuiet(node.token);
    if (index == -1) {
      throw QueryError.position(node.position).$("String_Node_Str").$(node.token).$();
    }
    return index;
  }
 else {
    int index=m.getTimestampIndex();
    if (index > -1) {
      return index;
    }
    for (int i=0, n=m.getColumnCount(); i < n; i++) {
      if (m.getColumnQuick(i).getType() == ColumnType.DATE) {
        if (index == -1) {
          index=i;
        }
 else {
          return -2;
        }
      }
    }
    return index;
  }
}
Program: 31218
Project: 31218
Buggy source:
private int getTimestampIndex(QueryModel model,ExprNode node,RecordMetadata m) throws ParserException {
  int index=getTimestampIndexQuiet(model,node,m);
  if (index == -1) {
    throw QueryError.position(model.getJournalName() != null ? model.getJournalName().position : 0).$("String_Node_Str").$();
  }
  return index;
}

Fixed version (ground truth):
private int getTimestampIndex(QueryModel model,ExprNode node,RecordMetadata m) throws ParserException {
  int index=getTimestampIndexQuiet(model,node,m);
  int pos=model.getJournalName() != null ? model.getJournalName().position : 0;
switch (index) {
case -1:
    throw QueryError.position(pos).$("String_Node_Str").$();
case -2:
  throw QueryError.position(pos).$("String_Node_Str").$();
default :
return index;
}
}
Program: 31219
Project: 31219
Buggy source:
private RecordSource timestamp(RecordSource rs,QueryModel model) throws ParserException {
  ExprNode timestamp=model.getTimestamp();
  if (timestamp == null) {
    return rs;
  }
  int index=rs.getMetadata().getColumnIndexQuiet(timestamp.token);
  if (index == -1) {
    throw QueryError.invalidColumn(timestamp.position,timestamp.token);
  }
  return new TimestampRelocatingRecordSource(rs,index);
}

Fixed version (ground truth):
private RecordSource timestamp(RecordSource rs,QueryModel model) throws ParserException {
  try {
    ExprNode timestamp=model.getTimestamp();
    if (timestamp == null) {
      return rs;
    }
    int index=rs.getMetadata().getColumnIndexQuiet(timestamp.token);
    if (index == -1) {
      throw QueryError.invalidColumn(timestamp.position,timestamp.token);
    }
    return new TimestampRelocatingRecordSource(rs,index);
  }
 catch (  ParserException e) {
    Misc.free(rs);
    throw e;
  }
}
Program: 31220
Project: 31220
Buggy source:
private RecordSource filter(QueryModel model,RecordSource rs) throws ParserException {
  if (model.getWhereClause() == null) {
    return rs;
  }
  RecordMetadata m=rs.getMetadata();
  if (model.getAlias() != null) {
    m.setAlias(model.getAlias().token);
  }
  IntrinsicModel im=queryFilterAnalyser.extract(model.getWhereClause(),m,null,getTimestampIndexQuiet(model,model.getTimestamp(),m));
  if (im.intrinsicValue == IntrinsicValue.FALSE) {
    return new NoOpJournalRecordSource(rs);
  }
  if (im.intervalHi < Long.MAX_VALUE || im.intervalLo > Long.MIN_VALUE) {
    rs=new IntervalRecordSource(rs,new SingleIntervalSource(new Interval(im.intervalLo,im.intervalHi)));
  }
  if (im.intervalSource != null) {
    rs=new IntervalRecordSource(rs,im.intervalSource);
  }
  if (im.filter != null) {
    VirtualColumn vc=virtualColumnBuilder.createVirtualColumn(model,im.filter,m);
    if (vc.isConstant()) {
      if (vc.getBool(null)) {
        return rs;
      }
 else {
        return new NoOpJournalRecordSource(rs);
      }
    }
    return new FilteredRecordSource(rs,vc,im.filter);
  }
 else {
    return rs;
  }
}

Fixed version (ground truth):
private RecordSource filter(QueryModel model,RecordSource rs) throws ParserException {
  try {
    if (model.getWhereClause() == null) {
      return rs;
    }
    RecordMetadata m=rs.getMetadata();
    if (model.getAlias() != null) {
      m.setAlias(model.getAlias().token);
    }
    IntrinsicModel im=queryFilterAnalyser.extract(model.getWhereClause(),m,null,getTimestampIndexQuiet(model,model.getTimestamp(),m));
    if (im.intrinsicValue == IntrinsicValue.FALSE) {
      return new NoOpJournalRecordSource(rs);
    }
    if (im.intervalHi < Long.MAX_VALUE || im.intervalLo > Long.MIN_VALUE) {
      rs=new IntervalRecordSource(rs,new SingleIntervalSource(new Interval(im.intervalLo,im.intervalHi)));
    }
    if (im.intervalSource != null) {
      rs=new IntervalRecordSource(rs,im.intervalSource);
    }
    if (im.filter != null) {
      VirtualColumn vc=virtualColumnBuilder.createVirtualColumn(model,im.filter,m);
      if (vc.isConstant()) {
        if (vc.getBool(null)) {
          return rs;
        }
 else {
          return new NoOpJournalRecordSource(rs);
        }
      }
      return new FilteredRecordSource(rs,vc,im.filter);
    }
 else {
      return rs;
    }
  }
 catch (  ParserException e) {
    Misc.free(rs);
    throw e;
  }
}
Program: 31221
Project: 31221
Buggy source:
IntrinsicModel extract(ExprNode node,RecordMetadata m,String preferredKeyColumn,int timestampIndex) throws ParserException {
  this.stack.clear();
  this.keyNodes.clear();
  this.timestampNodes.clear();
  this.timestamp=timestampIndex == -1 ? null : m.getColumnName(timestampIndex);
  this.preferredKeyColumn=preferredKeyColumn;
  IntrinsicModel model=models.next();
  if (removeAndIntrinsics(model,node,m)) {
    return model;
  }
  ExprNode root=node;
  while (!stack.isEmpty() || node != null) {
    if (node != null) {
switch (node.token) {
case "String_Node_Str":
        if (!removeAndIntrinsics(model,node.rhs,m)) {
          stack.push(node.rhs);
        }
      node=removeAndIntrinsics(model,node.lhs,m) ? null : node.lhs;
    break;
default :
  node=stack.poll();
break;
}
}
 else {
node=stack.poll();
}
}
model.filter=collapseIntrinsicNodes(root);
return model;
}

Fixed version (ground truth):
IntrinsicModel extract(ExprNode node,RecordMetadata m,String preferredKeyColumn,int timestampIndex) throws ParserException {
  this.stack.clear();
  this.keyNodes.clear();
  this.timestampNodes.clear();
  this.timestamp=timestampIndex < 0 ? null : m.getColumnName(timestampIndex);
  this.preferredKeyColumn=preferredKeyColumn;
  IntrinsicModel model=models.next();
  if (removeAndIntrinsics(model,node,m)) {
    return model;
  }
  ExprNode root=node;
  while (!stack.isEmpty() || node != null) {
    if (node != null) {
switch (node.token) {
case "String_Node_Str":
        if (!removeAndIntrinsics(model,node.rhs,m)) {
          stack.push(node.rhs);
        }
      node=removeAndIntrinsics(model,node.lhs,m) ? null : node.lhs;
    break;
default :
  node=stack.poll();
break;
}
}
 else {
node=stack.poll();
}
}
model.filter=collapseIntrinsicNodes(root);
return model;
}
Program: 31222
Project: 31222
Buggy source:
private String normalise(CharSequence seq){
  boolean capNext=false;
  tempSink.clear();
  for (int i=0, l=seq.length(); i < l; i++) {
    char c=seq.charAt(i);
    if (c > 2047) {
      continue;
    }
switch (c) {
case ' ':
case '_':
case '?':
case '.':
case ',':
case '\'':
case '\"':
case '\\':
case '/':
case '\0':
case ':':
case ')':
case '(':
case '+':
case '-':
case '*':
case '%':
case '~':
      capNext=true;
    break;
default :
  if (capNext) {
    tempSink.put(Character.toUpperCase(c));
    capNext=false;
  }
 else {
    tempSink.put(c);
  }
break;
}
}
return tempSink.toString();
}

Fixed version (ground truth):
private String normalise(CharSequence seq){
  boolean capNext=false;
  tempSink.clear();
  for (int i=0, l=seq.length(); i < l; i++) {
    char c=seq.charAt(i);
    if (c > 2047) {
      continue;
    }
switch (c) {
case ' ':
case '_':
case '?':
case '.':
case ',':
case '\'':
case '\"':
case '\\':
case '/':
case '\0':
case ':':
case ')':
case '(':
case '+':
case '-':
case '*':
case '%':
case '~':
      capNext=true;
    break;
default :
  if (i == 0 && Character.isDigit(c)) {
    tempSink.put('_');
  }
if (capNext) {
  tempSink.put(Character.toUpperCase(c));
  capNext=false;
}
 else {
  tempSink.put(c);
}
break;
}
}
return tempSink.toString();
}
Program: 31223
Project: 31223
Buggy source:
private void writeBin(long headerAddress,DirectInputStream value){
  if (value == null) {
    writeNullString(headerAddress);
    return;
  }
  long offset=mem.allocateOffset(8);
  long len=value.size();
  Unsafe.getUnsafe().putLong(headerAddress,offset);
  Unsafe.getUnsafe().putLong(mem.addressOf(offset),len);
  if (len < 1) {
    return;
  }
  offset=mem.allocateOffset(1);
  long p=0;
  do {
    int remaining=mem.pageRemaining(offset);
    int sz=remaining < len ? remaining : (int)len;
    value.copyTo(mem.addressOf(offset),p,sz);
    p+=sz;
    mem.allocateOffset(sz);
    offset+=sz;
    len-=sz;
  }
 while (len > 0);
}

Fixed version (ground truth):
private void writeBin(long headerAddress,DirectInputStream value){
  long offset=mem.allocateOffset(8);
  long len=value == null ? -1L : value.size();
  Unsafe.getUnsafe().putLong(headerAddress,offset);
  Unsafe.getUnsafe().putLong(mem.addressOf(offset),len);
  if (len < 1) {
    return;
  }
  offset=mem.allocateOffset(1);
  long p=0;
  do {
    int remaining=mem.pageRemaining(offset);
    int sz=remaining < len ? remaining : (int)len;
    value.copyTo(mem.addressOf(offset),p,sz);
    p+=sz;
    mem.allocateOffset(sz);
    offset+=sz;
    len-=sz;
  }
 while (len > 0);
}
Program: 31224
Project: 31224
Buggy source:
public long append(Record record,long prevAddress){
  long thisAddress=mem.allocate(8 + recordPrefix) + 8;
  if (prevAddress != -1) {
    Unsafe.getUnsafe().putLong(prevAddress - 8,thisAddress);
  }
  Unsafe.getUnsafe().putLong(thisAddress - 8,-1L);
  append0(record,thisAddress);
  return thisAddress;
}

Fixed version (ground truth):
public long append(Record record,long prevAddress){
  long thisAddress=beginRecord0(prevAddress);
  append0(record,thisAddress);
  return thisAddress;
}
Program: 31225
Project: 31225
Buggy source:
private <T>void writeAndReadRecords(JournalWriter<T> journal,int count,int pageSize,RecordGenerator<T> generator) throws IOException, JournalException, ParserException {
  for (int i=0; i < count; i++) {
    journal.append(generator.generate(i));
  }
  journal.commit();
  try (RecordList records=new RecordList(journal.getMetadata(),pageSize)){
    LongList offsets=new LongList();
    try (RecordSource rs=compiler.compile(factory,journal.getLocation().getName())){
      long o=-1;
      for (      Record rec : rs.prepareCursor(factory)) {
        offsets.add(o=records.append(rec,o));
      }
    }
     int i=0;
    while (records.hasNext()) {
      generator.assertRecord(records.next(),i++);
    }
  }
 }

Fixed version (ground truth):
private <T>void writeAndReadRecords(JournalWriter<T> journal,int count,int pageSize,RecordGenerator<T> generator) throws IOException, JournalException, ParserException {
  for (int i=0; i < count; i++) {
    journal.append(generator.generate(i));
  }
  journal.commit();
  try (RecordList records=new RecordList(journal.getMetadata(),pageSize)){
    LongList offsets=new LongList();
    try (RecordSource rs=compiler.compile(factory,journal.getLocation().getName())){
      long o=-1;
      for (      Record rec : rs.prepareCursor(factory)) {
        offsets.add(o=records.append(rec,o));
      }
    }
     int i=0;
    records.toTop();
    while (records.hasNext()) {
      generator.assertRecord(records.next(),i++);
    }
  }
 }
Program: 31226
Project: 31226
Buggy source:
private void writeBin(long headerAddress,DirectInputStream value){
  long offset=mem.allocateOffset(8);
  long len=value.size();
  Unsafe.getUnsafe().putLong(headerAddress,offset);
  Unsafe.getUnsafe().putLong(mem.addressOf(offset),len);
  if (len < 1) {
    return;
  }
  offset=mem.allocateOffset(1);
  long p=0;
  do {
    int remaining=mem.pageRemaining(offset);
    int sz=remaining < len ? remaining : (int)len;
    value.copyTo(mem.addressOf(offset),p,sz);
    p+=sz;
    mem.allocateOffset(sz);
    offset+=sz;
    len-=sz;
  }
 while (len > 0);
}

Fixed version (ground truth):
private void writeBin(long headerAddress,DirectInputStream value){
  if (value == null) {
    writeNullString(headerAddress);
    return;
  }
  long offset=mem.allocateOffset(8);
  long len=value.size();
  Unsafe.getUnsafe().putLong(headerAddress,offset);
  Unsafe.getUnsafe().putLong(mem.addressOf(offset),len);
  if (len < 1) {
    return;
  }
  offset=mem.allocateOffset(1);
  long p=0;
  do {
    int remaining=mem.pageRemaining(offset);
    int sz=remaining < len ? remaining : (int)len;
    value.copyTo(mem.addressOf(offset),p,sz);
    p+=sz;
    mem.allocateOffset(sz);
    offset+=sz;
    len-=sz;
  }
 while (len > 0);
}
Program: 31227
Project: 31227
Buggy source:
private boolean isNull(long localRowID){
  return Unsafe.getUnsafe().getInt(mappedFile.addressOf(indexColumn.getLong(localRowID),4)) == NULL_LEN;
}

Fixed version (ground truth):
public boolean isNull(){
  return remaining == -1;
}
Program: 31228
Project: 31228
Buggy source:
@Test public void testCreateAllFieldTypes() throws Exception {
  compiler.execute(factory,"String_Node_Str");
  try (Journal r=factory.reader("String_Node_Str")){
    Assert.assertNotNull(r);
    JournalMetadata m=r.getMetadata();
    Assert.assertEquals(11,m.getColumnCount());
    Assert.assertEquals(ColumnType.INT,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.BYTE,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.SHORT,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.LONG,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.FLOAT,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.DOUBLE,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.DATE,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.BINARY,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.DATE,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.SYMBOL,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.STRING,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(8,m.getTimestampIndex());
    Assert.assertEquals(PartitionBy.MONTH,m.getPartitionBy());
  }
 }

Fixed version (ground truth):
@Test public void testCreateAllFieldTypes() throws Exception {
  compiler.execute(factory,"String_Node_Str");
  try (Journal r=factory.reader("String_Node_Str")){
    Assert.assertNotNull(r);
    JournalMetadata m=r.getMetadata();
    Assert.assertEquals(12,m.getColumnCount());
    Assert.assertEquals(ColumnType.INT,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.BYTE,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.SHORT,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.LONG,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.FLOAT,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.DOUBLE,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.DATE,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.BINARY,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.DATE,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.SYMBOL,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.STRING,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.BOOLEAN,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(8,m.getTimestampIndex());
    Assert.assertEquals(PartitionBy.MONTH,m.getPartitionBy());
  }
 }
Program: 31230
Project: 31230
Buggy source:
private void copy(JournalFactory factory,RecordSource rs,JournalWriter w) throws JournalException {
  final CopyHelper helper=copyHelperCompiler.compile(rs.getMetadata(),w.getMetadata());
  final RecordCursor cursor=rs.prepareCursor(factory);
  while (cursor.hasNext()) {
    JournalEntryWriter ew=w.entryWriter();
    helper.copy(cursor.next(),ew);
    ew.append();
  }
  w.commit();
}

Fixed version (ground truth):
private void copy(JournalFactory factory,RecordSource rs,JournalWriter w) throws JournalException {
  final int tsIndex=w.getMetadata().getTimestampIndex();
  if (tsIndex == -1) {
    copyNonPartitioned(rs.prepareCursor(factory),w,copyHelperCompiler.compile(rs.getMetadata(),w.getMetadata()));
  }
 else {
    copyPartitioned(rs.prepareCursor(factory),w,copyHelperCompiler.compile(rs.getMetadata(),w.getMetadata()),tsIndex);
  }
  w.commit();
}
Program: 31232
Project: 31232
Buggy source:
@Test public void testCreateDefaultPartitionBy() throws Exception {
  try {
    compiler.execute(factory,"String_Node_Str");
    try (Journal r=factory.reader("String_Node_Str")){
      Assert.assertNotNull(r);
      JournalMetadata m=r.getMetadata();
      Assert.assertEquals(5,m.getColumnCount());
      Assert.assertEquals(ColumnType.INT,m.getColumn("String_Node_Str").getType());
      Assert.assertTrue(m.getColumn("String_Node_Str").isIndexed());
      Assert.assertEquals(1,m.getColumn("String_Node_Str").getBucketCount());
      Assert.assertEquals(ColumnType.BYTE,m.getColumn("String_Node_Str").getType());
      Assert.assertEquals(ColumnType.DATE,m.getColumn("String_Node_Str").getType());
      Assert.assertEquals(ColumnType.STRING,m.getColumn("String_Node_Str").getType());
      Assert.assertTrue(m.getColumn("String_Node_Str").isIndexed());
      Assert.assertEquals(63,m.getColumn("String_Node_Str").getBucketCount());
      Assert.assertEquals(ColumnType.LONG,m.getColumn("String_Node_Str").getType());
      Assert.assertTrue(m.getColumn("String_Node_Str").isIndexed());
      Assert.assertEquals(511,m.getColumn("String_Node_Str").getBucketCount());
      Assert.assertEquals(-1,m.getTimestampIndex());
      Assert.assertEquals(PartitionBy.NONE,m.getPartitionBy());
    }
   }
 catch (  ParserException e) {
    e.printStackTrace();
    System.out.println(QueryError.getPosition());
    System.out.println(QueryError.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testCreateDefaultPartitionBy() throws Exception {
  compiler.execute(factory,"String_Node_Str");
  try (Journal r=factory.reader("String_Node_Str")){
    Assert.assertNotNull(r);
    JournalMetadata m=r.getMetadata();
    Assert.assertEquals(5,m.getColumnCount());
    Assert.assertEquals(ColumnType.INT,m.getColumn("String_Node_Str").getType());
    Assert.assertTrue(m.getColumn("String_Node_Str").isIndexed());
    Assert.assertEquals(1,m.getColumn("String_Node_Str").getBucketCount());
    Assert.assertEquals(ColumnType.BYTE,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.DATE,m.getColumn("String_Node_Str").getType());
    Assert.assertEquals(ColumnType.STRING,m.getColumn("String_Node_Str").getType());
    Assert.assertTrue(m.getColumn("String_Node_Str").isIndexed());
    Assert.assertEquals(63,m.getColumn("String_Node_Str").getBucketCount());
    Assert.assertEquals(ColumnType.LONG,m.getColumn("String_Node_Str").getType());
    Assert.assertTrue(m.getColumn("String_Node_Str").isIndexed());
    Assert.assertEquals(511,m.getColumn("String_Node_Str").getBucketCount());
    Assert.assertEquals(-1,m.getTimestampIndex());
    Assert.assertEquals(PartitionBy.NONE,m.getPartitionBy());
  }
 }
Program: 31233
Project: 31233
Buggy source:
private void parse(long lo,long len,int maxLine){
  long hi=lo + len;
  long ptr=lo;
  OUT:   while (ptr < hi) {
    byte c=Unsafe.getUnsafe().getByte(ptr++);
    if (useLineRollBuf) {
      putToRollBuf(c);
    }
    this.fieldHi++;
    if (delayedOutQuote && c != '"') {
      inQuote=delayedOutQuote=false;
    }
    if (c == separator) {
      if (eol) {
        uneol(lo);
      }
      if (inQuote || ignoreEolOnce) {
        continue;
      }
      stashField();
      fieldIndex++;
    }
 else {
switch (c) {
case '"':
        quote();
      break;
case '\r':
case '\n':
    if (inQuote) {
      break;
    }
  if (eol) {
    this.fieldLo=this.fieldHi;
    break;
  }
stashField();
if (ignoreEolOnce) {
ignoreEolOnce();
break;
}
triggerLine(ptr);
if (lineCount > maxLine) {
break OUT;
}
break;
default :
if (eol) {
uneol(lo);
}
break;
}
}
}
if (useLineRollBuf) {
return;
}
if (eol) {
this.fieldLo=0;
}
 else {
rollLine(lo,hi);
useLineRollBuf=true;
}
}

Fixed version (ground truth):
private void parse(long lo,long len,int maxLine){
  long hi=lo + len;
  long ptr=lo;
  OUT:   while (ptr < hi) {
    byte c=Unsafe.getUnsafe().getByte(ptr++);
    char b=(char)c;
    if (useLineRollBuf) {
      putToRollBuf(c);
    }
    this.fieldHi++;
    if (delayedOutQuote && c != '"') {
      inQuote=delayedOutQuote=false;
    }
    if (c == separator) {
      if (eol) {
        uneol(lo);
      }
      if (inQuote || ignoreEolOnce) {
        continue;
      }
      stashField();
      fieldIndex++;
    }
 else {
switch (c) {
case '"':
        quote();
      break;
case '\r':
case '\n':
    if (inQuote) {
      break;
    }
  if (eol) {
    this.fieldLo=this.fieldHi;
    break;
  }
stashField();
if (ignoreEolOnce) {
ignoreEolOnce();
break;
}
triggerLine(ptr);
if (lineCount > maxLine) {
break OUT;
}
break;
default :
if (eol) {
uneol(lo);
}
break;
}
}
}
if (useLineRollBuf) {
return;
}
if (eol) {
this.fieldLo=0;
}
 else {
rollLine(lo,hi);
useLineRollBuf=true;
}
}
Program: 31234
Project: 31234
Buggy source:
private void quote(){
  if (inQuote) {
    delayedOutQuote=!delayedOutQuote;
    lastQuotePos=this.fieldHi;
  }
 else {
    inQuote=true;
    this.fieldLo=this.fieldHi;
  }
}

Fixed version (ground truth):
private void quote(){
  if (inQuote) {
    delayedOutQuote=!delayedOutQuote;
    lastQuotePos=this.fieldHi;
  }
 else   if (fieldHi - fieldLo == 1) {
    inQuote=true;
    this.fieldLo=this.fieldHi;
  }
}
Program: 31236
Project: 31236
Buggy source:
OutputStream putBin(int index);

Fixed version (ground truth):
void putBin(int index,ByteBuffer buf);
Program: 31237
Project: 31237
Buggy source:
public OutputStream putBin(int index){
  skip(index);
  return varCol(index).putBin();
}

Fixed version (ground truth):
public void putBin(int index,ByteBuffer buf){
  varCol(index).putBin(buf);
  skip(index);
}
Program: 31238
Project: 31238
Buggy source:
public void compileQuery(ChunkedResponse r,JournalFactoryPool pool,AtomicLong misses,AtomicLong hits) throws IOException {
  try {
    this.factory=pool.get();
    recordSource=CACHE.get().poll(query);
    if (recordSource == null) {
      recordSource=COMPILER.get().compile(factory,query);
      misses.incrementAndGet();
    }
 else {
      hits.incrementAndGet();
    }
    cursor=recordSource.prepareCursor(factory,cancellationHandler);
    metadata=recordSource.getMetadata();
    header(r,200);
  }
 catch (  ParserException e) {
    info().$("String_Node_Str").$(query).$("String_Node_Str").$(QueryError.getPosition()).$("String_Node_Str").$(QueryError.getMessage()).$();
    sendException(r,QueryError.getPosition(),QueryError.getMessage(),400);
  }
catch (  JournalRuntimeException e) {
    error().$("String_Node_Str").$(query).$(e).$();
    sendException(r,0,e.getMessage(),500);
  }
catch (  InterruptedException e) {
    error().$("String_Node_Str").$(query).$(e).$();
    sendException(r,0,"String_Node_Str",500);
  }
}

Fixed version (ground truth):
public void compileQuery(ChunkedResponse r,JournalFactoryPool pool,JournalFactory writerFactory,AtomicLong misses,AtomicLong hits) throws IOException {
  try {
    this.factory=pool.get();
    recordSource=CACHE.get().poll(query);
    if (recordSource == null) {
      recordSource=executeQuery(r,writerFactory);
      misses.incrementAndGet();
    }
 else {
      hits.incrementAndGet();
    }
    header(r,200);
    if (recordSource != null) {
      cursor=recordSource.prepareCursor(factory,cancellationHandler);
      metadata=recordSource.getMetadata();
    }
 else {
      sendConfirmation(r);
    }
  }
 catch (  ParserException e) {
    syntaxError(r);
  }
catch (  JournalRuntimeException e) {
    internalError(r,e);
  }
catch (  InterruptedException e) {
    error().$("String_Node_Str").$(query).$(e).$();
    sendException(r,0,"String_Node_Str",500);
  }
}
Program: 31239
Project: 31239
Buggy source:
@Override public void handle(IOContext context) throws IOException {
  ExportHandlerContext ctx=localContext.get(context);
  if (ctx == null) {
    localContext.set(context,ctx=new ExportHandlerContext(context.channel.getFd(),context.getServerConfiguration().getDbCyclesBeforeCancel()));
  }
  ChunkedResponse r=context.chunkedResponse();
  if (ctx.parseUrl(r,context.request)) {
    ctx.compileQuery(r,factoryPool,cacheMisses,cacheHits);
    resume(context);
  }
}

Fixed version (ground truth):
@Override public void handle(IOContext context) throws IOException {
  ExportHandlerContext ctx=localContext.get(context);
  if (ctx == null) {
    localContext.set(context,ctx=new ExportHandlerContext(context.channel.getFd(),context.getServerConfiguration().getDbCyclesBeforeCancel()));
  }
  ChunkedResponse r=context.chunkedResponse();
  if (ctx.parseUrl(r,context.request)) {
    ctx.compileQuery(r,factoryPool,null,cacheMisses,cacheHits);
    resume(context);
  }
}
Program: 31241
Project: 31241
Buggy source:
public QueryHandler(JournalFactoryPool factoryPool,ServerConfiguration configuration){
  this.factoryPool=factoryPool;
  this.configuration=configuration;
}

Fixed version (ground truth):
public QueryHandler(JournalFactoryPool factoryPool,ServerConfiguration configuration,JournalFactory writerFactory){
  this.factoryPool=factoryPool;
  this.configuration=configuration;
  this.writerFactory=writerFactory;
}
Program: 31242
Project: 31242
Buggy source:
@Override public void handle(IOContext context) throws IOException {
  QueryHandlerContext ctx=localContext.get(context);
  if (ctx == null) {
    localContext.set(context,ctx=new QueryHandlerContext(context.channel.getFd(),context.getServerConfiguration().getDbCyclesBeforeCancel()));
  }
  ChunkedResponse r=context.chunkedResponse();
  if (ctx.parseUrl(r,context.request)) {
    ctx.compileQuery(r,factoryPool,cacheMisses,cacheHits);
    resume(context);
  }
}

Fixed version (ground truth):
@Override public void handle(IOContext context) throws IOException {
  QueryHandlerContext ctx=localContext.get(context);
  if (ctx == null) {
    localContext.set(context,ctx=new QueryHandlerContext(context.channel.getFd(),context.getServerConfiguration().getDbCyclesBeforeCancel()));
  }
  ChunkedResponse r=context.chunkedResponse();
  if (ctx.parseUrl(r,context.request)) {
    ctx.compileQuery(r,factoryPool,writerFactory,cacheMisses,cacheHits);
    resume(context);
  }
}
Program: 31243
Project: 31243
Buggy source:
public void setName(String name){
  this.name=name;
}

Fixed version (ground truth):
public void setName(ExprNode name){
  this.name=name;
}
Program: 31244
Project: 31244
Buggy source:
public String getName(){
  return name;
}

Fixed version (ground truth):
public ExprNode getName(){
  return name;
}
Program: 31245
Project: 31245
Buggy source:
public void execute(JournalFactory factory,CharSequence statement) throws ParserException, JournalException {
  createWriter(factory,statement).close();
}

Fixed version (ground truth):
public void execute(JournalFactory factory,ParsedModel model) throws ParserException, JournalException {
  createWriter(factory,model).close();
}
Program: 31247
Project: 31247
Buggy source:
@Override public long copyTo(long address,long start,long length){
  long res;
  long rem=remaining - start;
  long size=res=length > rem ? rem : length;
  long offset=workOffset + start;
  do {
    int remaining=mappedFile.pageRemaining(offset);
    int sz=size > remaining ? remaining : (int)size;
    Unsafe.getUnsafe().copyMemory(mappedFile.addressOf(offset,1),address,sz);
    address+=sz;
    offset+=sz;
    size-=sz;
  }
 while (size > 0);
  return res;
}

Fixed version (ground truth):
@Override public long copyTo(long address,long start,long length){
  long res;
  long rem=remaining - start;
  long size=res=length > rem ? rem : length;
  long offset=workOffset + start;
  do {
    long from=mappedFile.addressOf(offset,1);
    int remaining=mappedFile.pageRemaining(offset);
    int sz=size > remaining ? remaining : (int)size;
    Unsafe.getUnsafe().copyMemory(from,address,sz);
    address+=sz;
    offset+=sz;
    size-=sz;
  }
 while (size > 0);
  return res;
}
Program: 31248
Project: 31248
Buggy source:
@Override public int read() throws IOException {
  if (remaining == 0) {
    return -1;
  }
  if (pageRemaining == 0) {
    renew();
  }
  pageRemaining--;
  workOffset++;
  remaining--;
  return Unsafe.getUnsafe().getByte(blockAddress++);
}

Fixed version (ground truth):
@Override public int read() throws IOException {
  if (remaining == 0) {
    return -1;
  }
  if (pageRemaining == 0) {
    renew();
  }
  pageRemaining--;
  workOffset++;
  remaining--;
  return (int)Unsafe.getUnsafe().getByte(blockAddress++) & 0xFF;
}
Program: 31249
Project: 31249
Buggy source:
private boolean processJournalEvents(final WritableByteChannel channel,boolean blocking) throws JournalNetworkException {
  handler.setChannel(channel);
  boolean dataSent=false;
  if (eventProcessor.process(handler,blocking)) {
    dataSent=handler.isDataSent();
    for (int i=0, k=clientStates.size(); i < k; i++) {
      JournalClientState state=clientStates.getQuick(i);
      if (state.isWaitingOnEvents()) {
        dataSent=dispatch0(channel,i) || dataSent;
      }
      state.setWaitingOnEvents(true);
    }
    if (dataSent) {
      commandProducer.write(channel,Command.SERVER_READY_CMD);
    }
 else     if (blocking) {
      LOG.info().$(socketAddress).$("String_Node_Str").$();
    }
  }
 else {
    if (server.isRunning()) {
      commandProducer.write(channel,Command.SERVER_HEARTBEAT);
    }
 else {
      commandProducer.write(channel,Command.SERVER_SHUTDOWN);
    }
  }
  return dataSent;
}

Fixed version (ground truth):
private boolean processJournalEvents(final WritableByteChannel channel,boolean blocking) throws JournalNetworkException {
  handler.setChannel(channel);
  boolean dataSent=false;
  if (eventProcessor.process(handler,blocking)) {
    dataSent=handler.isDataSent();
    for (int i=0, k=clientStates.size(); i < k; i++) {
      JournalClientState state=clientStates.getQuick(i);
      if (state.isWaitingOnEvents()) {
        dataSent=dispatch0(channel,i) || dataSent;
      }
      state.setWaitingOnEvents(true);
    }
    if (dataSent) {
      commandProducer.write(channel,Command.SERVER_READY_CMD);
    }
 else     if (blocking) {
      commandProducer.write(channel,Command.SERVER_HEARTBEAT);
    }
  }
 else {
    if (server.isRunning()) {
      commandProducer.write(channel,Command.SERVER_HEARTBEAT);
    }
 else {
      commandProducer.write(channel,Command.SERVER_SHUTDOWN);
    }
  }
  return dataSent;
}
Program: 31250
Project: 31250
Buggy source:
@Test public void testLagTrickle() throws Exception {
  JournalWriter<Quote> origin=factory.writer(Quote.class,"String_Node_Str");
  TestData.appendQuoteData2(origin);
  final JournalWriter<Quote> randomOrigin=factory.writer(new JournalKey<>(Quote.class,"String_Node_Str",PartitionBy.NONE,false));
  randomOrigin.append(origin.query().all().asResultSet().shuffle(new Rnd()));
  origin.close();
  final JournalWriter<Quote> remote=factory.writer(Quote.class,"String_Node_Str");
  final Journal<Quote> remoteReader=factory.reader(Quote.class,"String_Node_Str");
  Journal<Quote> local=factory.writer(Quote.class,"String_Node_Str");
  local.close();
  local=factory.reader(Quote.class,"String_Node_Str");
  Assert.assertEquals(0,local.size());
  JournalServer server=new JournalServer(serverConfig,factory);
  JournalClient client=new JournalClient(clientConfig,factory);
  server.publish(remote);
  server.start();
  client.subscribe(Quote.class,"String_Node_Str","String_Node_Str");
  client.start();
  lagIteration(randomOrigin,remote,0,100);
  lagIteration(randomOrigin,remote,100,200);
  lagIteration(randomOrigin,remote,200,300);
  lagIteration(randomOrigin,remote,300,400);
  Thread.sleep(200);
  server.halt();
  client.halt();
  local.refresh();
  remoteReader.refresh();
  TestUtils.assertEquals(remoteReader,local);
}

Fixed version (ground truth):
@Test public void testLagTrickle() throws Exception {
  JournalWriter<Quote> origin=factory.writer(Quote.class,"String_Node_Str");
  TestData.appendQuoteData2(origin);
  final JournalWriter<Quote> randomOrigin=factory.writer(new JournalKey<>(Quote.class,"String_Node_Str",PartitionBy.NONE,false));
  randomOrigin.append(origin.query().all().asResultSet().shuffle(new Rnd()));
  origin.close();
  final JournalWriter<Quote> remote=factory.writer(Quote.class,"String_Node_Str");
  final Journal<Quote> remoteReader=factory.reader(Quote.class,"String_Node_Str");
  Journal<Quote> local=factory.writer(Quote.class,"String_Node_Str");
  local.close();
  local=factory.reader(Quote.class,"String_Node_Str");
  Assert.assertEquals(0,local.size());
  JournalServer server=new JournalServer(serverConfig,factory);
  JournalClient client=new JournalClient(clientConfig,factory);
  server.publish(remote);
  server.start();
  client.subscribe(Quote.class,"String_Node_Str","String_Node_Str");
  client.start();
  int n=0;
  while (n < 400) {
    lagIteration(randomOrigin,remote,n,n + 10);
    n+=10;
  }
  Thread.sleep(200);
  server.halt();
  client.halt();
  local.refresh();
  remoteReader.refresh();
  TestUtils.assertEquals(remoteReader,local);
}
Program: 31251
Project: 31251
Buggy source:
public Win32SelectDispatcher(CharSequence ip,int port,RingQueue<IOEvent> ioQueue,Sequence ioSequence,Clock clock,ServerConfiguration configuration,int capacity){
  this.readFdSet=new FDSet(capacity);
  this.writeFdSet=new FDSet(capacity);
  this.ioQueue=ioQueue;
  this.ioSequence=ioSequence;
  this.interestQueue=new RingQueue<>(IOEvent.FACTORY,ioQueue.getCapacity());
  this.interestPubSequence=new MPSequence(interestQueue.getCapacity());
  this.interestPubSequence.setBarrier(this.interestSubSequence);
  this.interestSubSequence.setBarrier(this.interestPubSequence);
  this.clock=clock;
  this.configuration=configuration;
  this.maxConnections=configuration.getHttpMaxConnections();
  this.timeout=configuration.getHttpTimeout();
  this.socketFd=Net.socketTcp(false);
  if (Net.bind(this.socketFd,ip,port)) {
    Net.listen(this.socketFd,128);
    int r=pending.addRow();
    pending.set(r,M_TIMESTAMP,System.currentTimeMillis());
    pending.set(r,M_FD,socketFd);
    readFdSet.add(socketFd);
    readFdSet.setCount(1);
    writeFdSet.setCount(0);
  }
 else {
    throw new NetworkError("String_Node_Str" + Os.errno());
  }
}

Fixed version (ground truth):
public Win32SelectDispatcher(CharSequence ip,int port,RingQueue<IOEvent> ioQueue,Sequence ioSequence,Clock clock,ServerConfiguration configuration,int capacity){
  this.readFdSet=new FDSet(capacity);
  this.writeFdSet=new FDSet(capacity);
  this.ioQueue=ioQueue;
  this.ioSequence=ioSequence;
  this.interestQueue=new RingQueue<>(IOEvent.FACTORY,ioQueue.getCapacity());
  this.interestPubSequence=new MPSequence(interestQueue.getCapacity());
  this.interestPubSequence.setBarrier(this.interestSubSequence);
  this.interestSubSequence.setBarrier(this.interestPubSequence);
  this.clock=clock;
  this.configuration=configuration;
  this.maxConnections=configuration.getHttpMaxConnections();
  this.timeout=configuration.getHttpTimeout();
  this.socketFd=Net.socketTcp(false);
  if (Net.bind(this.socketFd,ip,port)) {
    Net.listen(this.socketFd,128);
    int r=pending.addRow();
    pending.set(r,M_TIMESTAMP,System.currentTimeMillis());
    pending.set(r,M_FD,socketFd);
    pending.set(r,M_OPERATION,ChannelStatus.READ);
    readFdSet.add(socketFd);
    readFdSet.setCount(1);
    writeFdSet.setCount(0);
  }
 else {
    throw new NetworkError("String_Node_Str" + Os.errno());
  }
}
Program: 31252
Project: 31252
Buggy source:
public static void append(CharSink sink,final long value){
  long i=value;
  if (i > Integer.MAX_VALUE || i < Integer.MIN_VALUE) {
    if (i < 0) {
      if (i == Long.MIN_VALUE) {
        sink.put("String_Node_Str");
        return;
      }
      sink.put('-');
      i=-i;
    }
    if (i < 100000000000L) {
      appendLong11(sink,i);
    }
 else     if (i < 1000000000000L) {
      appendLong12(sink,i);
    }
 else     if (i < 10000000000000L) {
      appendLong13(sink,i);
    }
 else     if (i < 100000000000000L) {
      appendLong14(sink,i);
    }
 else     if (i < 1000000000000000L) {
      appendLong15(sink,i);
    }
 else     if (i < 10000000000000000L) {
      appendLong16(sink,i);
    }
 else     if (i < 100000000000000000L) {
      appendLong17(sink,i);
    }
 else     if (i < 1000000000000000000L) {
      appendLong18(sink,i);
    }
 else {
      appendLong19(sink,i);
    }
  }
 else {
    append(sink,(int)i);
  }
}

Fixed version (ground truth):
public static void append(CharSink sink,final long value){
  long i=value;
  if (i > Integer.MAX_VALUE || i < Integer.MIN_VALUE) {
    if (i < 0) {
      if (i == Long.MIN_VALUE) {
        sink.put("String_Node_Str");
        return;
      }
      sink.put('-');
      i=-i;
    }
    if (i < 10000000000L) {
      appendLong10(sink,i);
    }
 else     if (i < 100000000000L) {
      appendLong11(sink,i);
    }
 else     if (i < 1000000000000L) {
      appendLong12(sink,i);
    }
 else     if (i < 10000000000000L) {
      appendLong13(sink,i);
    }
 else     if (i < 100000000000000L) {
      appendLong14(sink,i);
    }
 else     if (i < 1000000000000000L) {
      appendLong15(sink,i);
    }
 else     if (i < 10000000000000000L) {
      appendLong16(sink,i);
    }
 else     if (i < 100000000000000000L) {
      appendLong17(sink,i);
    }
 else     if (i < 1000000000000000000L) {
      appendLong18(sink,i);
    }
 else {
      appendLong19(sink,i);
    }
  }
 else {
    append(sink,(int)i);
  }
}