nus-yam/ex-repair huggingface dataset:
Program: 31091
Project: 31091
Buggy source:
IntrinsicModel extract(AliasTranslator translator,ExprNode node,RecordMetadata m,String preferredKeyColumn,int timestampIndex) throws ParserException {
  this.stack.clear();
  this.keyNodes.clear();
  this.timestamp=timestampIndex < 0 ? null : m.getColumnName(timestampIndex);
  this.preferredKeyColumn=preferredKeyColumn;
  IntrinsicModel model=models.next();
  if (removeAndIntrinsics(translator,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(translator,model,node.rhs,m)) {
          stack.push(node.rhs);
        }
      node=removeAndIntrinsics(translator,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(AliasTranslator translator,ExprNode node,RecordMetadata m,String preferredKeyColumn,int timestampIndex) throws ParserException {
  this.stack.clear();
  this.keyNodes.clear();
  this.timestamp=timestampIndex < 0 ? null : m.getColumnName(timestampIndex);
  this.preferredKeyColumn=preferredKeyColumn;
  IntrinsicModel model=models.next();
  if (removeAndIntrinsics(translator,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(translator,model,node.rhs,m)) {
          stack.push(node.rhs);
        }
      node=removeAndIntrinsics(translator,model,node.lhs,m) ? null : node.lhs;
    break;
default :
  node=stack.poll();
break;
}
}
 else {
node=stack.poll();
}
}
applyKeyExclusions(translator,model);
model.filter=collapseIntrinsicNodes(root);
return model;
}
Program: 31092
Project: 31092
Buggy source:
public boolean remove(CharSequence key){
  if (key == null) {
    if (hasNull) {
      hasNull=false;
      list.remove(null);
      free++;
      return true;
    }
    return false;
  }
  int index=idx(key);
  if (Unsafe.arrayGet(keys,index) == null) {
    return false;
  }
  if (eq(index,key)) {
    removeAt(index);
    return true;
  }
  index=probe(key,index);
  if (index < 0) {
    return false;
  }
  removeAt(index);
  return true;
}

Fixed version (ground truth):
public int remove(CharSequence key){
  if (key == null) {
    if (hasNull) {
      hasNull=false;
      int index=list.remove(null);
      free++;
      return index;
    }
    return -1;
  }
  int index=idx(key);
  if (Unsafe.arrayGet(keys,index) == null) {
    return -1;
  }
  if (eq(index,key)) {
    return removeAt(index);
  }
  index=probe(key,index);
  if (index < 0) {
    return -1;
  }
  return removeAt(index);
}
Program: 31093
Project: 31093
Buggy source:
private void removeAt(int index){
  list.remove(Unsafe.arrayGet(keys,index));
  free++;
  rehash();
}

Fixed version (ground truth):
private int removeAt(int index){
  int result=list.remove(Unsafe.arrayGet(keys,index));
  free++;
  rehash();
  return result;
}
Program: 31094
Project: 31094
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public boolean remove(Object key){
  if (list.remove(key)) {
    int index=idx((T)key);
    if (key.equals(Unsafe.arrayGet(keys,index))) {
      Unsafe.arrayPut(keys,index,noEntryValue);
      free++;
      return true;
    }
    return probeRemove(key,index);
  }
  return false;
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public boolean remove(Object key){
  if (list.remove(key) > -1) {
    int index=idx((T)key);
    if (key.equals(Unsafe.arrayGet(keys,index))) {
      Unsafe.arrayPut(keys,index,noEntryValue);
      free++;
      return true;
    }
    return probeRemove(key,index);
  }
  return false;
}
Program: 31095
Project: 31095
Buggy source:
@Test public void testNullHandling() throws Exception {
  Rnd rnd=new Rnd();
  CharSequenceHashSet set=new CharSequenceHashSet();
  int n=1000;
  for (int i=0; i < n; i++) {
    set.add(next(rnd));
  }
  Assert.assertFalse(set.contains(null));
  Assert.assertTrue(set.add(null));
  Assert.assertEquals(n + 1,set.size());
  Assert.assertFalse(set.add(null));
  Assert.assertEquals(n + 1,set.size());
  Assert.assertTrue(set.contains(null));
  Assert.assertTrue(set.remove(null));
  Assert.assertEquals(n,set.size());
  Assert.assertFalse(set.remove(null));
  Assert.assertEquals(n,set.size());
}

Fixed version (ground truth):
@Test public void testNullHandling() throws Exception {
  Rnd rnd=new Rnd();
  CharSequenceHashSet set=new CharSequenceHashSet();
  int n=1000;
  for (int i=0; i < n; i++) {
    set.add(next(rnd));
  }
  Assert.assertFalse(set.contains(null));
  Assert.assertTrue(set.add(null));
  Assert.assertEquals(n + 1,set.size());
  Assert.assertFalse(set.add(null));
  Assert.assertEquals(n + 1,set.size());
  Assert.assertTrue(set.contains(null));
  Assert.assertTrue(set.remove(null) > -1);
  Assert.assertEquals(n,set.size());
  Assert.assertTrue(set.remove(null) == -1);
  Assert.assertEquals(n,set.size());
}
Program: 31096
Project: 31096
Buggy source:
@Test public void testStress() throws Exception {
  Rnd rnd=new Rnd();
  CharSequenceHashSet set=new CharSequenceHashSet();
  int n=10000;
  for (int i=0; i < n; i++) {
    set.add(next(rnd));
  }
  Assert.assertEquals(n,set.size());
  HashSet<String> check=new HashSet<>();
  for (int i=0, m=set.size(); i < m; i++) {
    check.add(set.get(i).toString());
  }
  Assert.assertEquals(n,check.size());
  Rnd rnd2=new Rnd();
  for (int i=0; i < n; i++) {
    Assert.assertTrue("String_Node_Str" + i,set.contains(next(rnd2)));
  }
  Assert.assertEquals(n,set.size());
  Rnd rnd3=new Rnd();
  for (int i=0; i < n; i++) {
    Assert.assertFalse("String_Node_Str" + i,set.add(next(rnd3)));
  }
  Assert.assertEquals(n,set.size());
  for (int i=0; i < n; i++) {
    Assert.assertFalse("String_Node_Str" + i,set.remove(next(rnd)));
  }
  Rnd rnd4=new Rnd();
  for (int i=0; i < n; i++) {
    Assert.assertTrue("String_Node_Str" + i,set.remove(next(rnd4)));
  }
  Assert.assertEquals(0,set.size());
}

Fixed version (ground truth):
@Test public void testStress() throws Exception {
  Rnd rnd=new Rnd();
  CharSequenceHashSet set=new CharSequenceHashSet();
  int n=10000;
  for (int i=0; i < n; i++) {
    set.add(next(rnd));
  }
  Assert.assertEquals(n,set.size());
  HashSet<String> check=new HashSet<>();
  for (int i=0, m=set.size(); i < m; i++) {
    check.add(set.get(i).toString());
  }
  Assert.assertEquals(n,check.size());
  Rnd rnd2=new Rnd();
  for (int i=0; i < n; i++) {
    Assert.assertTrue("String_Node_Str" + i,set.contains(next(rnd2)));
  }
  Assert.assertEquals(n,set.size());
  Rnd rnd3=new Rnd();
  for (int i=0; i < n; i++) {
    Assert.assertFalse("String_Node_Str" + i,set.add(next(rnd3)));
  }
  Assert.assertEquals(n,set.size());
  for (int i=0; i < n; i++) {
    Assert.assertTrue("String_Node_Str" + i,set.remove(next(rnd)) == -1);
  }
  Rnd rnd4=new Rnd();
  for (int i=0; i < n; i++) {
    Assert.assertTrue("String_Node_Str" + i,set.remove(next(rnd4)) > -1);
  }
  Assert.assertEquals(0,set.size());
}
Program: 31097
Project: 31097
Buggy source:
private DateGreaterThanStrOperator(int position){
  super(ColumnType.BOOLEAN,position);
}

Fixed version (ground truth):
private DateGreaterThanStrOperator(int position){
  super(position);
}
Program: 31098
Project: 31098
Buggy source:
@Override public boolean getBool(Record rec){
  int r=rhs.getInt(rec);
  return lhs.getInt(rec) > r && r > Integer.MIN_VALUE;
}

Fixed version (ground truth):
@Override public boolean getBool(Record rec){
  int r=rhs.getInt(rec);
  return lhs.getInt(rec) > r && r > Numbers.INT_NaN;
}
Program: 31099
Project: 31099
Buggy source:
private StrGreaterThanDateOperator(int position){
  super(ColumnType.BOOLEAN,position);
}

Fixed version (ground truth):
private StrGreaterThanDateOperator(int position){
  super(position);
}
Program: 31100
Project: 31100
Buggy source:
public CharSequence translateAlias(CharSequence column){
  QueryColumn referent=aliasToColumnMap.get(column);
  if (referent != null && !(referent instanceof AnalyticColumn) && referent.getAst().type == ExprNode.LITERAL) {
    return referent.getAst().token;
  }
 else {
    return column;
  }
}

Fixed version (ground truth):
@Override public CharSequence translateAlias(CharSequence column){
  QueryColumn referent=aliasToColumnMap.get(column);
  if (referent != null && !(referent instanceof AnalyticColumn) && referent.getAst().type == ExprNode.LITERAL) {
    return referent.getAst().token;
  }
 else {
    return column;
  }
}
Program: 31101
Project: 31101
Buggy source:
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.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;
  }
}

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,model.getWhereClause(),m,null,getTimestampIndexQuiet(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: 31103
Project: 31103
Buggy source:
private boolean analyzeEquals(IntrinsicModel model,ExprNode node,RecordMetadata m) throws ParserException {
  checkNodeValid(node);
  return analyzeEquals0(model,node,node.lhs,node.rhs,m) || analyzeEquals0(model,node,node.rhs,node.lhs,m);
}

Fixed version (ground truth):
private boolean analyzeEquals(AliasTranslator translator,IntrinsicModel model,ExprNode node,RecordMetadata m) throws ParserException {
  checkNodeValid(node);
  return analyzeEquals0(translator,model,node,node.lhs,node.rhs,m) || analyzeEquals0(translator,model,node,node.rhs,node.lhs,m);
}
Program: 31104
Project: 31104
Buggy source:
private boolean analyzeIn(IntrinsicModel model,ExprNode node,RecordMetadata metadata) throws ParserException {
  if (node.paramCount < 2) {
    throw QueryError.$(node.position,"String_Node_Str");
  }
  ExprNode col=node.paramCount < 3 ? node.lhs : node.args.getLast();
  if (col.type != ExprNode.LITERAL) {
    throw QueryError.$(col.position,"String_Node_Str");
  }
  if (metadata.getColumnIndexQuiet(col.token) == -1) {
    throw QueryError.invalidColumn(col.position,col.token);
  }
  return analyzeInInterval(model,col,node) || analyzeListOfValues(model,col.token,metadata,node) || analyzeInLambda(model,col.token,metadata,node);
}

Fixed version (ground truth):
private boolean analyzeIn(AliasTranslator translator,IntrinsicModel model,ExprNode node,RecordMetadata metadata) throws ParserException {
  if (node.paramCount < 2) {
    throw QueryError.$(node.position,"String_Node_Str");
  }
  ExprNode col=node.paramCount < 3 ? node.lhs : node.args.getLast();
  if (col.type != ExprNode.LITERAL) {
    throw QueryError.$(col.position,"String_Node_Str");
  }
  String column=translator.translateAlias(col.token).toString();
  if (metadata.getColumnIndexQuiet(column) == -1) {
    throw QueryError.invalidColumn(col.position,col.token);
  }
  return analyzeInInterval(model,col,node) || analyzeListOfValues(model,column,metadata,node) || analyzeInLambda(model,column,metadata,node);
}
Program: 31105
Project: 31105
Buggy source:
private boolean removeAndIntrinsics(IntrinsicModel model,ExprNode node,RecordMetadata m) throws ParserException {
switch (node.token) {
case "String_Node_Str":
    return analyzeIn(model,node,m);
case "String_Node_Str":
  return analyzeGreater(model,node,1);
case "String_Node_Str":
return analyzeGreater(model,node,0);
case "String_Node_Str":
return analyzeLess(model,node,1);
case "String_Node_Str":
return analyzeLess(model,node,0);
case "String_Node_Str":
return analyzeEquals(model,node,m);
case "String_Node_Str":
return analyzeNotEquals(model,node);
default :
return false;
}
}

Fixed version (ground truth):
private boolean removeAndIntrinsics(AliasTranslator translator,IntrinsicModel model,ExprNode node,RecordMetadata m) throws ParserException {
switch (node.token) {
case "String_Node_Str":
    return analyzeIn(translator,model,node,m);
case "String_Node_Str":
  return analyzeGreater(model,node,1);
case "String_Node_Str":
return analyzeGreater(model,node,0);
case "String_Node_Str":
return analyzeLess(model,node,1);
case "String_Node_Str":
return analyzeLess(model,node,0);
case "String_Node_Str":
return analyzeEquals(translator,model,node,m);
case "String_Node_Str":
return analyzeNotEquals(model,node);
default :
return false;
}
}
Program: 31107
Project: 31107
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 < 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;
}

Fixed version (ground truth):
IntrinsicModel extract(AliasTranslator translator,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(translator,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(translator,model,node.rhs,m)) {
          stack.push(node.rhs);
        }
      node=removeAndIntrinsics(translator,model,node.lhs,m) ? null : node.lhs;
    break;
default :
  node=stack.poll();
break;
}
}
 else {
node=stack.poll();
}
}
model.filter=collapseIntrinsicNodes(root);
return model;
}
Program: 31108
Project: 31108
Buggy source:
private IntrinsicModel modelOf(CharSequence seq,String preferredColumn) throws ParserException {
  lexer.setContent(seq);
  p.parseExpr(lexer,ast);
  return e.extract(ast.poll(),w.getMetadata(),preferredColumn,w.getMetadata().getTimestampIndex());
}

Fixed version (ground truth):
private IntrinsicModel modelOf(CharSequence seq,String preferredColumn) throws ParserException {
  lexer.setContent(seq);
  p.parseExpr(lexer,ast);
  return e.extract(new AliasTranslator(){
    @Override public CharSequence translateAlias(    CharSequence column){
      return column;
    }
  }
,ast.poll(),w.getMetadata(),preferredColumn,w.getMetadata().getTimestampIndex());
}
Program: 31109
Project: 31109
Buggy source:
private void applyKeyExclusions(AliasTranslator translator,IntrinsicModel model){
  if (model.keyColumn != null && keyExclNodes.size() > 0) {
    for (int i=0, n=keyExclNodes.size(); i < n; i++) {
      ExprNode node=keyExclNodes.getQuick(i);
      ExprNode col;
      ExprNode val;
      if (node.lhs.type == ExprNode.LITERAL) {
        col=node.lhs;
        val=node.rhs;
      }
 else {
        col=node.rhs;
        val=node.lhs;
      }
      final String column=translator.translateAlias(col.token).toString();
      if (column.equals(model.keyColumn)) {
        String value=Chars.equals("String_Node_Str",val.token) ? null : Chars.stripQuotes(val.token);
        int index=model.keyValues.remove(value);
        if (index > -1) {
          model.keyValuePositions.removeIndex(index);
        }
        node.intrinsicValue=IntrinsicValue.TRUE;
      }
    }
  }
  keyExclNodes.clear();
}

Fixed version (ground truth):
private void applyKeyExclusions(AliasTranslator translator,IntrinsicModel model){
  if (model.keyColumn != null && keyExclNodes.size() > 0) {
    for (int i=0, n=keyExclNodes.size(); i < n; i++) {
      ExprNode node=keyExclNodes.getQuick(i);
      ExprNode col;
      ExprNode val;
      if (node.lhs.type == ExprNode.LITERAL) {
        col=node.lhs;
        val=node.rhs;
      }
 else {
        col=node.rhs;
        val=node.lhs;
      }
      final String column=translator.translateAlias(col.token).toString();
      if (column.equals(model.keyColumn)) {
        String value=Chars.equals("String_Node_Str",val.token) ? null : Chars.stripQuotes(val.token);
        int index=model.keyValues.remove(value);
        if (index > -1) {
          model.keyValuePositions.removeIndex(index);
        }
        node.intrinsicValue=IntrinsicValue.TRUE;
        if (model.keyValues.size() == 0) {
          model.intrinsicValue=IntrinsicValue.FALSE;
          break;
        }
      }
    }
  }
  keyExclNodes.clear();
}
Program: 31110
Project: 31110
Buggy source:
@Test public void testOr() throws Exception {
  modelOf("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testOr() throws Exception {
  IntrinsicModel m=modelOf("String_Node_Str");
  Assert.assertEquals(IntrinsicValue.UNDEFINED,m.intrinsicValue);
  assertFilter(m,"String_Node_Str");
}
Program: 31112
Project: 31112
Buggy source:
@Override public void prepareFor(Record record){
  DirectMapValues values=MapUtils.getMapValues(map,record,partitionBy);
  final CharSequence str=valueColumn.getFlyweightStr(record);
  if (values.isNew()) {
    nextNull=true;
    store(str,values);
  }
 else {
    nextNull=false;
    long ptr=values.getLong(0);
    int len=values.getInt(1);
    copyToBuffer(ptr);
    if (toByteLen(str.length()) > len) {
      Unsafe.free(ptr,len);
      store(str,values);
    }
 else {
      Chars.put(ptr,str);
    }
  }
}

Fixed version (ground truth):
@Override public void prepareFor(Record record){
  DirectMapValues values=MapUtils.getMapValues(map,record,partitionBy);
  final CharSequence str=valueColumn.getFlyweightStr(record);
  if (values.isNew()) {
    nextNull=true;
    if (str == null) {
      allocAndStoreNull(values);
    }
 else {
      allocAndStore(str,values);
    }
  }
 else {
    nextNull=false;
    long ptr=values.getLong(0);
    int len=values.getInt(1);
    copyToBuffer(ptr);
    if (str == null) {
      Unsafe.getUnsafe().putInt(ptr,VariableColumn.NULL_LEN);
    }
 else     if (toByteLen(str.length()) > len) {
      Unsafe.free(ptr,len);
      allocAndStore(str,values);
    }
 else {
      Chars.put(ptr,str);
    }
  }
}
Program: 31113
Project: 31113
Buggy source:
private void copyToBuffer(long ptr){
  int l=toByteLen(Unsafe.getUnsafe().getInt(ptr));
  if (l > bufPtrLen) {
    if (bufPtr != 0) {
      Unsafe.free(bufPtr,bufPtrLen);
    }
    bufPtrLen=Numbers.ceilPow2(l);
    bufPtr=Unsafe.malloc(bufPtrLen);
    cs.of(bufPtr + 4,bufPtr + bufPtrLen);
  }
 else {
    cs.of(bufPtr + 4,bufPtr + l);
  }
  Unsafe.getUnsafe().copyMemory(ptr,bufPtr,l);
}

Fixed version (ground truth):
private void copyToBuffer(long ptr){
  int l=Unsafe.getUnsafe().getInt(ptr);
  if (l == VariableColumn.NULL_LEN) {
    nextNull=true;
    return;
  }
  l=toByteLen(l);
  if (l > bufPtrLen) {
    if (bufPtr != 0) {
      Unsafe.free(bufPtr,bufPtrLen);
    }
    bufPtrLen=Numbers.ceilPow2(l);
    bufPtr=Unsafe.malloc(bufPtrLen);
    cs.of(bufPtr + 4,bufPtr + bufPtrLen);
  }
 else {
    cs.of(bufPtr + 4,bufPtr + l);
  }
  Unsafe.getUnsafe().copyMemory(ptr,bufPtr,l);
}
Program: 31114
Project: 31114
Buggy source:
@Test @Ignore public void testPrevWithNull() throws Exception {
  assertThat("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test public void testPrevWithNull() throws Exception {
  assertThat("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"+ "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","String_Node_Str");
}
Program: 31116
Project: 31116
Buggy source:
public void subtractIntervals(CharSequence seq,int lo,int lim,int position) throws ParserException {
  LongList temp=shuffleTemp();
  temp.clear();
  IntervalCompiler.parseIntervalEx(seq,lo,lim,position,temp);
  final LongList dest=shuffleDest();
  dest.clear();
  if (this.intervals == null) {
    IntervalCompiler.subtract(INFINITE_INTERVAL,temp,dest);
  }
 else {
    IntervalCompiler.subtract(temp,this.intervals,dest);
  }
  this.intervals=dest;
  if (this.intervals.size() == 0) {
    intrinsicValue=IntrinsicValue.FALSE;
  }
}

Fixed version (ground truth):
private void subtractIntervals(LongList temp){
  final LongList dest=shuffleDest();
  dest.clear();
  if (this.intervals == null) {
    IntervalCompiler.subtract(INFINITE_INTERVAL,temp,dest);
  }
 else {
    IntervalCompiler.subtract(temp,this.intervals,dest);
  }
  this.intervals=dest;
  if (this.intervals.size() == 0) {
    intrinsicValue=IntrinsicValue.FALSE;
  }
}
Program: 31117
Project: 31117
Buggy source:
private RecordSource compile(QueryModel model,JournalReaderFactory factory) throws ParserException {
  optimiseOrderBy(model,ORDER_BY_UNKNOWN);
  optimiseSubQueries(model,factory);
  createOrderHash(model);
  return compileNoOptimise(model,factory);
}

Fixed version (ground truth):
private RecordSource compile(QueryModel model,JournalReaderFactory factory) throws ParserException {
  optimiseInvertedBooleans(model);
  optimiseOrderBy(model,ORDER_BY_UNKNOWN);
  optimiseSubQueries(model,factory);
  createOrderHash(model);
  return compileNoOptimise(model,factory);
}
Program: 31118
Project: 31118
Buggy source:
private boolean analyzeGreater(IntrinsicModel model,ExprNode node,int inc) throws ParserException {
  checkNodeValid(node);
  if (Chars.equals(node.lhs.token,node.rhs.token)) {
    model.intrinsicValue=IntrinsicValue.FALSE;
    return false;
  }
  if (timestamp == null) {
    return false;
  }
  if (node.lhs.type == ExprNode.LITERAL && node.lhs.token.equals(timestamp)) {
    if (node.rhs.type != ExprNode.CONSTANT) {
      return false;
    }
    try {
      model.intersectIntervals(Dates.tryParse(quoteEraser.ofQuoted(node.rhs.token)) + inc,Long.MAX_VALUE);
      return true;
    }
 catch (    NumericException e) {
      throw QueryError.$(node.rhs.position,"String_Node_Str");
    }
  }
  if (node.rhs.type == ExprNode.LITERAL && node.rhs.token.equals(timestamp)) {
    if (node.lhs.type != ExprNode.CONSTANT) {
      return false;
    }
    try {
      model.intersectIntervals(Long.MIN_VALUE,Dates.tryParse(quoteEraser.ofQuoted(node.lhs.token)) - inc);
      return true;
    }
 catch (    NumericException e) {
      throw QueryError.$(node.lhs.position,"String_Node_Str");
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean analyzeGreater(IntrinsicModel model,ExprNode node,int increment) throws ParserException {
  checkNodeValid(node);
  if (Chars.equals(node.lhs.token,node.rhs.token)) {
    model.intrinsicValue=IntrinsicValue.FALSE;
    return false;
  }
  if (timestamp == null) {
    return false;
  }
  if (node.lhs.type == ExprNode.LITERAL && node.lhs.token.equals(timestamp)) {
    if (node.rhs.type != ExprNode.CONSTANT) {
      return false;
    }
    try {
      model.intersectIntervals(Dates.tryParse(quoteEraser.ofQuoted(node.rhs.token)) + increment,Long.MAX_VALUE);
      node.intrinsicValue=IntrinsicValue.TRUE;
      return true;
    }
 catch (    NumericException e) {
      throw QueryError.$(node.rhs.position,"String_Node_Str");
    }
  }
  if (node.rhs.type == ExprNode.LITERAL && node.rhs.token.equals(timestamp)) {
    if (node.lhs.type != ExprNode.CONSTANT) {
      return false;
    }
    try {
      model.intersectIntervals(Long.MIN_VALUE,Dates.tryParse(quoteEraser.ofQuoted(node.lhs.token)) - increment);
      return true;
    }
 catch (    NumericException e) {
      throw QueryError.$(node.lhs.position,"String_Node_Str");
    }
  }
  return false;
}
Program: 31119
Project: 31119
Buggy source:
private boolean removeAndIntrinsics(AliasTranslator translator,IntrinsicModel model,ExprNode node,RecordMetadata m) throws ParserException {
switch (node.token) {
case "String_Node_Str":
    return analyzeIn(translator,model,node,m);
case "String_Node_Str":
  return analyzeGreater(model,node,1);
case "String_Node_Str":
return analyzeGreater(model,node,0);
case "String_Node_Str":
return analyzeLess(model,node,1);
case "String_Node_Str":
return analyzeLess(model,node,0);
case "String_Node_Str":
return analyzeEquals(translator,model,node,m);
case "String_Node_Str":
return analyzeNotEquals(translator,model,node,m);
default :
return false;
}
}

Fixed version (ground truth):
private boolean removeAndIntrinsics(AliasTranslator translator,IntrinsicModel model,ExprNode node,RecordMetadata m) throws ParserException {
switch (node.token) {
case "String_Node_Str":
    return analyzeIn(translator,model,node,m);
case "String_Node_Str":
  return analyzeGreater(model,node,1);
case "String_Node_Str":
return analyzeGreater(model,node,0);
case "String_Node_Str":
return analyzeLess(model,node,1);
case "String_Node_Str":
return analyzeLess(model,node,0);
case "String_Node_Str":
return analyzeEquals(translator,model,node,m);
case "String_Node_Str":
return analyzeNotEquals(translator,model,node,m);
case "String_Node_Str":
return "String_Node_Str".equals(node.rhs.token) && analyzeNotIn(translator,model,node,m);
default :
return false;
}
}
Program: 31120
Project: 31120
Buggy source:
private VirtualColumn processConstantExpression(Function f){
switch (f.getType()) {
case ColumnType.INT:
    return new IntConstant(f.getInt(null),f.getPosition());
case ColumnType.DOUBLE:
  return new DoubleConstant(f.getDouble(null),f.getPosition());
case ColumnType.BOOLEAN:
return new BooleanConstant(f.getBool(null),f.getPosition());
case ColumnType.STRING:
CharSequence cs=f.getStr(null);
return cs == null ? new NullConstant(f.getPosition()) : new StrConstant(cs.toString(),f.getPosition());
case ColumnType.LONG:
return new LongConstant(f.getLong(null),f.getPosition());
default :
return f;
}
}

Fixed version (ground truth):
private VirtualColumn processConstantExpression(Function f){
switch (f.getType()) {
case ColumnType.INT:
    return new IntConstant(f.getInt(null),f.getPosition());
case ColumnType.DOUBLE:
  return new DoubleConstant(f.getDouble(null),f.getPosition());
case ColumnType.FLOAT:
return new FloatConstant(f.getFloat(null),f.getPosition());
case ColumnType.BOOLEAN:
return new BooleanConstant(f.getBool(null),f.getPosition());
case ColumnType.STRING:
CharSequence cs=f.getStr(null);
return cs == null ? new NullConstant(f.getPosition()) : new StrConstant(cs.toString(),f.getPosition());
case ColumnType.LONG:
return new LongConstant(f.getLong(null),f.getPosition());
case ColumnType.DATE:
return new DateConstant(f.getDate(null),f.getPosition());
default :
return f;
}
}
Program: 31121
Project: 31121
Buggy source:
private static void addMonthInterval(int period,int count,LongList out){
  int k=out.size();
  long lo=out.getQuick(k - 2);
  long hi=out.getQuick(k - 1);
  for (int i=0, n=count - 1; i < n; i++) {
    lo=Dates.addMonths(lo,period);
    hi=Dates.addMonths(hi,period);
    out.add(lo);
    out.add(hi);
  }
}

Fixed version (ground truth):
private static void addMonthInterval(int period,int count,LongList out){
  int k=out.size();
  long lo=out.getQuick(k - 2);
  long hi=out.getQuick(k - 1);
  for (int i=0, n=count - 1; i < n; i++) {
    lo=Dates.addMonths(lo,period);
    hi=Dates.addMonths(hi,period);
    append(out,lo,hi);
  }
}
Program: 31122
Project: 31122
Buggy source:
private static void parseRange(CharSequence seq,int lo,int p,int lim,int position,LongList out) throws ParserException {
  char type=seq.charAt(lim - 1);
  int period;
  try {
    period=Numbers.parseInt(seq,p + 1,lim - 1);
  }
 catch (  NumericException e) {
    throw QueryError.$(position,"String_Node_Str");
  }
  try {
    Dates.parseInterval(seq,lo,p,out);
    int n=out.size();
    out.setQuick(n - 1,Dates.addPeriod(out.getQuick(n - 1),type,period));
    return;
  }
 catch (  NumericException ignore) {
  }
  try {
    long loMillis=Dates.tryParse(seq,lo,p - 1);
    out.add(loMillis);
    out.add(Dates.addPeriod(loMillis,type,period));
  }
 catch (  NumericException e) {
    throw QueryError.$(position,"String_Node_Str");
  }
}

Fixed version (ground truth):
private static void parseRange(CharSequence seq,int lo,int p,int lim,int position,LongList out) throws ParserException {
  char type=seq.charAt(lim - 1);
  int period;
  try {
    period=Numbers.parseInt(seq,p + 1,lim - 1);
  }
 catch (  NumericException e) {
    throw QueryError.$(position,"String_Node_Str");
  }
  try {
    Dates.parseInterval(seq,lo,p,out);
    int n=out.size();
    out.setQuick(n - 1,Dates.addPeriod(out.getQuick(n - 1),type,period));
    return;
  }
 catch (  NumericException ignore) {
  }
  try {
    long loMillis=Dates.tryParse(seq,lo,p - 1);
    append(out,loMillis,Dates.addPeriod(loMillis,type,period));
  }
 catch (  NumericException e) {
    throw QueryError.$(position,"String_Node_Str");
  }
}
Program: 31123
Project: 31123
Buggy source:
/** 
 * Performs set subtraction on two lists of intervals. Subtracts b from a, e.g. result = a - b. Both sets are expected to be ordered chronologically.
 * @param a list of intervals
 * @param b list of intervals
 * @return result of subtraction
 */
public static ObjList<Interval> subtract(ObjList<Interval> a,ObjList<Interval> b){
  ObjList<Interval> out=new ObjList<>();
  int indexA=0;
  int indexB=0;
  final int sizeA=a.size();
  final int sizeB=b.size();
  Interval intervalA=null;
  Interval intervalB=null;
  while (true) {
    if (intervalA == null && indexA < sizeA) {
      intervalA=a.getQuick(indexA++);
    }
    if (intervalB == null && indexB < sizeB) {
      intervalB=b.getQuick(indexB++);
    }
    if (intervalA != null && intervalB == null) {
      append(out,intervalA);
      intervalA=null;
      continue;
    }
    if (intervalA == null) {
      break;
    }
    if (intervalA.getHi() < intervalB.getLo()) {
      append(out,intervalA);
      intervalA=null;
    }
 else     if (intervalA.getLo() > intervalB.getHi()) {
      intervalB=null;
    }
 else {
      if (intervalA.getLo() < intervalB.getLo()) {
        append(out,new Interval(intervalA.getLo(),intervalB.getLo()));
      }
      if (intervalA.getHi() > intervalB.getHi()) {
        intervalA=new Interval(intervalB.getHi(),intervalA.getHi());
        intervalB=null;
      }
 else {
        intervalA=null;
      }
    }
  }
  return out;
}

Fixed version (ground truth):
/** 
 * Performs set subtraction on two lists of intervals. Subtracts b from a, e.g. result = a - b. Both sets are expected to be ordered chronologically.
 * @param a   list of intervals
 * @param b   list of intervals
 * @param out result of subtraction
 */
public static void subtract(LongList a,LongList b,LongList out){
  final int sizeA=a.size() / 2;
  final int sizeB=b.size() / 2;
  int intervalA=0;
  int intervalB=0;
  boolean fetchA=true;
  if (intervalA < sizeA) {
    long aLo=getIntervalLo(a,intervalA);
    long aHi=getIntervalHi(a,intervalA);
    while (intervalA < sizeA) {
      if (fetchA) {
        aLo=getIntervalLo(a,intervalA);
        aHi=getIntervalHi(a,intervalA);
        fetchA=true;
      }
      if (intervalB == sizeB) {
        append(out,aLo,aHi);
        intervalA++;
        continue;
      }
      long bLo=getIntervalLo(b,intervalB);
      long bHi=getIntervalHi(b,intervalB);
      if (aHi < bLo) {
        append(out,aLo,aHi);
        intervalA++;
      }
 else       if (aLo > bHi) {
        intervalB++;
      }
 else {
        if (aLo < bLo) {
          append(out,aLo,bLo - 1);
        }
        if (aHi > bHi) {
          aLo=bHi + 1;
          fetchA=false;
          intervalB++;
        }
 else {
          intervalA++;
        }
      }
    }
  }
}
Program: 31124
Project: 31124
Buggy source:
private static void addMillisInterval(long period,int count,LongList out){
  int k=out.size();
  long lo=out.getQuick(k - 2);
  long hi=out.getQuick(k - 1);
  for (int i=0, n=count - 1; i < n; i++) {
    lo+=period;
    hi+=period;
    out.add(lo);
    out.add(hi);
  }
}

Fixed version (ground truth):
private static void addMillisInterval(long period,int count,LongList out){
  int k=out.size();
  long lo=out.getQuick(k - 2);
  long hi=out.getQuick(k - 1);
  for (int i=0, n=count - 1; i < n; i++) {
    lo+=period;
    hi+=period;
    append(out,lo,hi);
  }
}
Program: 31125
Project: 31125
Buggy source:
private static void addYearIntervals(int period,int count,LongList out){
  int k=out.size();
  long lo=out.getQuick(k - 2);
  long hi=out.getQuick(k - 1);
  for (int i=0, n=count - 1; i < n; i++) {
    lo=Dates.addYear(lo,period);
    hi=Dates.addYear(hi,period);
    out.add(lo);
    out.add(hi);
  }
}

Fixed version (ground truth):
private static void addYearIntervals(int period,int count,LongList out){
  int k=out.size();
  long lo=out.getQuick(k - 2);
  long hi=out.getQuick(k - 1);
  for (int i=0, n=count - 1; i < n; i++) {
    lo=Dates.addYear(lo,period);
    hi=Dates.addYear(hi,period);
    append(out,lo,hi);
  }
}
Program: 31127
Project: 31127
Buggy source:
private CharSequence getSymbol(char c){
  List<CharSequence> l=symbols.get(c);
  if (l == null) {
    return null;
  }
  for (int i=0, sz=l.size(); i < sz; i++) {
    CharSequence txt=l.get(i);
    boolean match=(txt.length() - 2) < (_len - _pos);
    if (match) {
      for (int k=1; k < txt.length(); k++) {
        if (content.charAt(_pos + (k - 1)) != txt.charAt(k)) {
          match=false;
          break;
        }
      }
    }
    if (match) {
      return txt;
    }
  }
  return null;
}

Fixed version (ground truth):
private CharSequence getSymbol(char c){
  List<CharSequence> l=symbols.get(c);
  if (l == null) {
    return null;
  }
  for (int i=0, sz=l.size(); i < sz; i++) {
    CharSequence txt=l.get(i);
    int n=txt.length();
    boolean match=(n - 2) < (_len - _pos);
    if (match) {
      for (int k=1; k < n; k++) {
        if (content.charAt(_pos + (k - 1)) != txt.charAt(k)) {
          match=false;
          break;
        }
      }
    }
    if (match) {
      return txt;
    }
  }
  return null;
}
Program: 31128
Project: 31128
Buggy source:
public boolean add(CharSequence key){
  if (insertKey(key)) {
    list.add(key);
    if (free == 0) {
      rehash();
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean add(CharSequence key){
  if (key == null) {
    if (hasNull) {
      return false;
    }
    hasNull=true;
    list.add(null);
    free--;
    return true;
  }
  if (insertKey(key)) {
    if (free == 0) {
      resize();
    }
    return true;
  }
  return false;
}
Program: 31129
Project: 31129
Buggy source:
public final void clear(){
  free=capacity;
  Arrays.fill(keys,null);
  list.clear();
}

Fixed version (ground truth):
public final void clear(){
  free=capacity;
  Arrays.fill(keys,null);
  list.clear();
  hasNull=false;
}
Program: 31130
Project: 31130
Buggy source:
@SuppressWarnings({"String_Node_Str"}) private void rehash(){
  int newCapacity=keys.length << 1;
  mask=newCapacity - 1;
  free=capacity=(int)(newCapacity * loadFactor);
  CharSequence[] oldKeys=keys;
  this.keys=new CharSequence[newCapacity];
  Arrays.fill(keys,null);
  for (int i=oldKeys.length; i-- > 0; ) {
    if (Unsafe.arrayGet(oldKeys,i) != null) {
      insertKey(Unsafe.arrayGet(oldKeys,i));
    }
  }
}

Fixed version (ground truth):
private void rehash(){
}
Program: 31131
Project: 31131
Buggy source:
public boolean contains(CharSequence value){
  int index=idx(value);
  return Unsafe.arrayGet(keys,index) != null && (value == Unsafe.arrayGet(keys,index) || Chars.equals(value,Unsafe.arrayGet(keys,index)) || probeContains(value,index));
}

Fixed version (ground truth):
public boolean contains(CharSequence key){
  if (key == null) {
    return hasNull;
  }
  int index=idx(key);
  return Unsafe.arrayGet(keys,index) != null && (eq(index,key) || probe(key,index) > -1);
}
Program: 31132
Project: 31132
Buggy source:
private boolean insertKey(CharSequence key){
  int index=idx(key);
  if (Unsafe.arrayGet(keys,index) == null) {
    Unsafe.arrayPut(keys,index,key);
    free--;
    return true;
  }
 else {
    return !(key == Unsafe.arrayGet(keys,index) || Chars.equals(key,Unsafe.arrayGet(keys,index))) && probeInsert(key,index);
  }
}

Fixed version (ground truth):
private boolean insertKey(CharSequence key){
  int index=idx(key);
  if (Unsafe.arrayGet(keys,index) == null) {
    String sk=key.toString();
    Unsafe.arrayPut(keys,index,sk);
    list.add(sk);
    free--;
    return true;
  }
 else {
    if (eq(index,key)) {
      return false;
    }
    int next=probe(key,index);
    if (next < 0) {
      String sk=key.toString();
      Unsafe.arrayPut(keys,-next - 1,sk);
      list.add(sk);
      free--;
      return true;
    }
    return false;
  }
}
Program: 31133
Project: 31133
Buggy source:
private static long parseDateTime(CharSequence seq,int lo,int lim) throws NumericException {
  int p=lo;
  if (p + 4 > lim) {
    throw NumericException.INSTANCE;
  }
  int year=Numbers.parseInt(seq,p,p+=4);
  checkChar(seq,p++,lim,'-');
  if (p + 2 > lim) {
    throw NumericException.INSTANCE;
  }
  int month=Numbers.parseInt(seq,p,p+=2);
  checkRange(month,1,12);
  checkChar(seq,p++,lim,'-');
  if (p + 2 > lim) {
    throw NumericException.INSTANCE;
  }
  boolean l=isLeapYear(year);
  int day=Numbers.parseInt(seq,p,p+=2);
  checkRange(day,1,getDaysPerMonth(month,l));
  checkChar(seq,p++,lim,'T');
  if (p + 2 > lim) {
    throw NumericException.INSTANCE;
  }
  int hour=Numbers.parseInt(seq,p,p+=2);
  checkRange(hour,0,23);
  checkChar(seq,p++,lim,':');
  if (p + 2 > lim) {
    throw NumericException.INSTANCE;
  }
  int min=Numbers.parseInt(seq,p,p+=2);
  checkRange(min,0,59);
  checkChar(seq,p++,lim,':');
  if (p + 2 > lim) {
    throw NumericException.INSTANCE;
  }
  int sec=Numbers.parseInt(seq,p,p+=2);
  checkRange(sec,0,59);
  int mil=0;
  if (p < lim && seq.charAt(p) == '.') {
    if (p + 4 > lim) {
      throw NumericException.INSTANCE;
    }
    mil=Numbers.parseInt(seq,++p,p+=3);
    checkRange(mil,0,999);
  }
  if (p < lim) {
    checkChar(seq,p,lim,'Z');
  }
  return yearMillis(year,l) + monthOfYearMillis(month,l) + (day - 1) * DAY_MILLIS + hour * HOUR_MILLIS + min * MINUTE_MILLIS + sec * SECOND_MILLIS + mil;
}

Fixed version (ground truth):
private static long parseDateTime(CharSequence seq,int lo,int lim) throws NumericException {
  int p=lo;
  if (lim - p < 20) {
    throw NumericException.INSTANCE;
  }
  int year=Numbers.parseInt(seq,p,p+=4);
  checkChar(seq,p++,lim,'-');
  int month=Numbers.parseInt(seq,p,p+=2);
  checkRange(month,1,12);
  checkChar(seq,p++,lim,'-');
  boolean l=isLeapYear(year);
  int day=Numbers.parseInt(seq,p,p+=2);
  checkRange(day,1,getDaysPerMonth(month,l));
  checkChar(seq,p++,lim,'T');
  int hour=Numbers.parseInt(seq,p,p+=2);
  checkRange(hour,0,23);
  checkChar(seq,p++,lim,':');
  int min=Numbers.parseInt(seq,p,p+=2);
  checkRange(min,0,59);
  checkChar(seq,p++,lim,':');
  int sec=Numbers.parseInt(seq,p,p+=2);
  checkRange(sec,0,59);
  int mil=0;
  if (p < lim && seq.charAt(p) == '.') {
    if (p + 4 > lim) {
      throw NumericException.INSTANCE;
    }
    mil=Numbers.parseInt(seq,++p,p+=3);
    checkRange(mil,0,999);
  }
  if (p < lim) {
    checkChar(seq,p,lim,'Z');
  }
  return yearMillis(year,l) + monthOfYearMillis(month,l) + (day - 1) * DAY_MILLIS + hour * HOUR_MILLIS + min * MINUTE_MILLIS + sec * SECOND_MILLIS + mil;
}
Program: 31135
Project: 31135
Buggy source:
private static void append0(CharSink sink,int val){
  if (val < 10) {
    sink.put('0');
  }
  Numbers.append(sink,val);
}

Fixed version (ground truth):
private static void append0(CharSink sink,int val){
  if (Math.abs(val) < 10) {
    sink.put('0');
  }
  Numbers.append(sink,val);
}
Program: 31136
Project: 31136
Buggy source:
private static void append0000(CharSink sink,int val){
  if (val < 10) {
    sink.put('0').put('0').put('0');
  }
 else   if (val < 100) {
    sink.put('0').put('0');
  }
 else   if (val < 1000) {
    sink.put('0');
  }
  Numbers.append(sink,val);
}

Fixed version (ground truth):
private static void append0000(CharSink sink,int val){
  int v=Math.abs(val);
  if (v < 10) {
    sink.put('0').put('0').put('0');
  }
 else   if (v < 100) {
    sink.put('0').put('0');
  }
 else   if (v < 1000) {
    sink.put('0');
  }
  Numbers.append(sink,val);
}
Program: 31137
Project: 31137
Buggy source:
private static void append00(CharSink sink,int val){
  if (val < 10) {
    sink.put('0').put('0');
  }
 else   if (val < 100) {
    sink.put('0');
  }
  Numbers.append(sink,val);
}

Fixed version (ground truth):
private static void append00(CharSink sink,int val){
  int v=Math.abs(val);
  if (v < 10) {
    sink.put('0').put('0');
  }
 else   if (v < 100) {
    sink.put('0');
  }
  Numbers.append(sink,val);
}
Program: 31138
Project: 31138
Buggy source:
@SuppressWarnings("String_Node_Str") private static float parseFloat(CharSequence sequence,int lo,int lim) throws NumericException {
  int p=lo;
  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;
}
break;
}
}
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 lo,int lim) throws NumericException {
  int p=lo;
  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;
case 'F':
case 'f':
if (i + 1 < lim) {
throw NumericException.INSTANCE;
}
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;
}
break;
}
}
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: 31139
Project: 31139
Buggy source:
private static int parseInt0(CharSequence sequence,final int p,int lim) throws NumericException {
  if (lim == p) {
    throw NumericException.INSTANCE;
  }
  boolean negative=sequence.charAt(p) == '-';
  int i=p;
  if (negative) {
    i++;
  }
  if (i >= lim) {
    throw NumericException.INSTANCE;
  }
  int val=0;
  for (; i < lim; i++) {
    int c=sequence.charAt(i);
    if (c < '0' || c > '9') {
      throw NumericException.INSTANCE;
    }
    int r=(val << 3) + (val << 1) - (c - '0');
    if (r > val) {
      throw NumericException.INSTANCE;
    }
    val=r;
  }
  if (val == Integer.MIN_VALUE && !negative) {
    throw NumericException.INSTANCE;
  }
  return negative ? val : -val;
}

Fixed version (ground truth):
private static int parseInt0(CharSequence sequence,final int p,int lim) throws NumericException {
  if (lim == p) {
    throw NumericException.INSTANCE;
  }
  boolean negative=sequence.charAt(p) == '-';
  int i=p;
  if (negative) {
    i++;
  }
  if (i >= lim) {
    throw NumericException.INSTANCE;
  }
  int val=0;
  for (; i < lim; i++) {
    char c=sequence.charAt(i);
    if (c < '0' || c > '9') {
      throw NumericException.INSTANCE;
    }
    int r=(val << 3) + (val << 1) - (c - '0');
    if (r > val) {
      throw NumericException.INSTANCE;
    }
    val=r;
  }
  if (val == Integer.MIN_VALUE && !negative) {
    throw NumericException.INSTANCE;
  }
  return negative ? val : -val;
}