nus-yam/ex-repair huggingface dataset:
Program: 31140
Project: 31140
Buggy source:
@SuppressWarnings("String_Node_Str") private static double parseDouble(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;
  }
switch (sequence.charAt(i)) {
case 'N':
    return parseConst(sequence,i,lim,NaN,Double.NaN);
case 'I':
  return parseConst(sequence,i,lim,INFINITY,negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY);
default :
break;
}
long val=0;
int dp=-1;
int dpe=lim;
int exp=0;
out: for (; 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 <= LONG_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 > 308) {
exp=308;
}
 else if (exp < -308) {
exp=-308;
}
if (exp > 0) {
return (negative ? -val : val) * pow10d[exp];
}
 else {
return (negative ? -val : val) / pow10d[-exp];
}
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private static double parseDouble(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;
  }
switch (sequence.charAt(i)) {
case 'N':
    return parseConst(sequence,i,lim,NaN,Double.NaN);
case 'I':
  return parseConst(sequence,i,lim,INFINITY,negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY);
default :
break;
}
long val=0;
int dp=-1;
int dpe=lim;
int exp=0;
out: for (; 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 'D':
case 'd':
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 <= LONG_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 > 308) {
exp=308;
}
 else if (exp < -308) {
exp=-308;
}
if (exp > 0) {
return (negative ? -val : val) * pow10d[exp];
}
 else {
return (negative ? -val : val) / pow10d[-exp];
}
}
Program: 31141
Project: 31141
Buggy source:
private static long parseLong0(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;
  }
  long val=0;
  for (; i < lim; i++) {
    int c=sequence.charAt(i);
    if (c < '0' || c > '9') {
      throw NumericException.INSTANCE;
    }
    long r=(val << 3) + (val << 1) - (c - '0');
    if (r > val) {
      throw NumericException.INSTANCE;
    }
    val=r;
  }
  if (val == Long.MIN_VALUE && !negative) {
    throw NumericException.INSTANCE;
  }
  return negative ? val : -val;
}

Fixed version (ground truth):
private static long parseLong0(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;
  }
  long val=0;
  for (; i < lim; i++) {
    int c=sequence.charAt(i);
    if (c == 'L' || c == 'l') {
      if (i + 1 < lim) {
        throw NumericException.INSTANCE;
      }
      break;
    }
    if (c < '0' || c > '9') {
      throw NumericException.INSTANCE;
    }
    long r=(val << 3) + (val << 1) - (c - '0');
    if (r > val) {
      throw NumericException.INSTANCE;
    }
    val=r;
  }
  if (val == Long.MIN_VALUE && !negative) {
    throw NumericException.INSTANCE;
  }
  return negative ? val : -val;
}
Program: 31142
Project: 31142
Buggy source:
public VirtualColumnRecordSource(RecordSource delegate,ObjList<VirtualColumn> virtualColumns){
  this.delegate=delegate;
  RecordMetadata dm=delegate.getMetadata();
  this.metadata=new VirtualRecordMetadata(dm,virtualColumns);
  this.record=new VirtualRecord(dm.getColumnCount(),virtualColumns,delegate.getRecord());
  this.virtualColumnStorageFacade=VirtualColumnStorageFacade.INSTANCE;
  this.storageFacade=new SplitRecordStorageFacade(dm.getColumnCount());
}

Fixed version (ground truth):
public VirtualColumnRecordSource(RecordSource delegate,ObjList<VirtualColumn> virtualColumns){
  this.delegate=delegate;
  this.virtualColumns=virtualColumns;
  RecordMetadata dm=delegate.getMetadata();
  this.metadata=new VirtualRecordMetadata(dm,virtualColumns);
  this.record=new VirtualRecord(dm.getColumnCount(),virtualColumns,delegate.getRecord());
  this.virtualColumnStorageFacade=new VirtualColumnStorageFacade();
  this.storageFacade=new SplitRecordStorageFacade(dm.getColumnCount());
}
Program: 31143
Project: 31143
Buggy source:
@Override public SymbolTable getSymbolTable(int index){
  return null;
}

Fixed version (ground truth):
@Override public SymbolTable getSymbolTable(int index){
  return virtualColumns.getQuick(index).getSymbolTable();
}
Program: 31144
Project: 31144
Buggy source:
@Override public long getLong(Record rec){
  try {
    CharSequence s=value.getFlyweightStr(rec);
    return s == null ? 0 : Dates.parseTime24(s);
  }
 catch (  NumericException ignore) {
    return 0;
  }
}

Fixed version (ground truth):
@Override public long getLong(Record rec){
  try {
    CharSequence s=value.getFlyweightStr(rec);
    return s == null ? Long.MIN_VALUE : Dates.parseTime24(s);
  }
 catch (  NumericException ignore) {
    return 0;
  }
}
Program: 31145
Project: 31145
Buggy source:
@Test public void testAndArgCheck2() throws Exception {
  try {
    assertThat("String_Node_Str","String_Node_Str");
    Assert.fail();
  }
 catch (  ParserException e) {
    Assert.assertEquals(67,QueryError.getPosition());
  }
}

Fixed version (ground truth):
@Test public void testAndArgCheck2() throws Exception {
  try {
    expectFailure("String_Node_Str");
  }
 catch (  ParserException e) {
    Assert.assertEquals(67,QueryError.getPosition());
  }
}
Program: 31146
Project: 31146
Buggy source:
@Test public void testOrArgCheck() throws Exception {
  try {
    assertThat("String_Node_Str","String_Node_Str");
    Assert.fail();
  }
 catch (  ParserException e) {
    Assert.assertEquals(44,QueryError.getPosition());
  }
}

Fixed version (ground truth):
@Test public void testOrArgCheck() throws Exception {
  try {
    expectFailure("String_Node_Str");
  }
 catch (  ParserException e) {
    Assert.assertEquals(44,QueryError.getPosition());
  }
}
Program: 31147
Project: 31147
Buggy source:
@Test public void testOrArgCheck2() throws Exception {
  try {
    assertThat("String_Node_Str","String_Node_Str");
    Assert.fail();
  }
 catch (  ParserException e) {
    Assert.assertEquals(67,QueryError.getPosition());
  }
}

Fixed version (ground truth):
@Test public void testOrArgCheck2() throws Exception {
  try {
    expectFailure("String_Node_Str");
  }
 catch (  ParserException e) {
    Assert.assertEquals(67,QueryError.getPosition());
  }
}
Program: 31148
Project: 31148
Buggy source:
@Test public void testAndArgCheck() throws Exception {
  try {
    assertThat("String_Node_Str","String_Node_Str");
    Assert.fail();
  }
 catch (  ParserException e) {
    Assert.assertEquals(44,QueryError.getPosition());
  }
}

Fixed version (ground truth):
@Test public void testAndArgCheck() throws Exception {
  try {
    expectFailure("String_Node_Str");
  }
 catch (  ParserException e) {
    Assert.assertEquals(44,QueryError.getPosition());
  }
}
Program: 31149
Project: 31149
Buggy source:
@Override public void putNull(int index){
switch (meta[index].type) {
case ColumnType.STRING:
    putNullStr(index);
  break;
case ColumnType.SYMBOL:
putSymbol0(index,null);
break;
case ColumnType.INT:
putInt0(index,Integer.MIN_VALUE);
break;
case ColumnType.FLOAT:
putFloat(index,Float.NaN);
break;
case ColumnType.DOUBLE:
putDouble(index,Double.NaN);
break;
case ColumnType.LONG:
putLong(index,Long.MIN_VALUE);
break;
case ColumnType.BINARY:
putBin0(index,null);
break;
case ColumnType.DATE:
putDate(index,Long.MIN_VALUE);
break;
default :
fixCol(index).putNull();
break;
}
}

Fixed version (ground truth):
@Override public void putNull(int index){
switch (meta[index].type) {
case ColumnType.STRING:
    putNullStr(index);
  break;
case ColumnType.SYMBOL:
putSymbol0(index,null);
break;
case ColumnType.INT:
putInt0(index,Integer.MIN_VALUE);
break;
case ColumnType.FLOAT:
putFloat(index,Float.NaN);
break;
case ColumnType.DOUBLE:
putDouble(index,Double.NaN);
break;
case ColumnType.LONG:
putLong(index,Numbers.LONG_NaN);
break;
case ColumnType.BINARY:
putBin0(index,null);
break;
case ColumnType.DATE:
putDate(index,Numbers.LONG_NaN);
break;
default :
fixCol(index).putNull();
break;
}
}
Program: 31150
Project: 31150
Buggy source:
public void setLhs(VirtualColumn lhs){
  this.lhs=lhs;
}

Fixed version (ground truth):
public void setLhs(VirtualColumn lhs) throws ParserException {
  this.lhs=lhs;
}
Program: 31152
Project: 31152
Buggy source:
private void optimiseInvertedBooleans(QueryModel model){
  ExprNode where=model.getWhereClause();
  if (where != null) {
    model.setWhereClause(optimiseInvertedBooleans(where,false));
  }
  if (model.getNestedModel() != null) {
    optimiseInvertedBooleans(model.getNestedModel());
  }
  ObjList<QueryModel> joinModels=model.getJoinModels();
  for (int i=0, n=joinModels.size(); i < n; i++) {
    QueryModel m=joinModels.getQuick(i);
    if (m != model) {
      optimiseInvertedBooleans(joinModels.getQuick(i));
    }
  }
}

Fixed version (ground truth):
private void optimiseInvertedBooleans(QueryModel model) throws ParserException {
  ExprNode where=model.getWhereClause();
  if (where != null) {
    model.setWhereClause(optimiseInvertedBooleans(where,false));
  }
  if (model.getNestedModel() != null) {
    optimiseInvertedBooleans(model.getNestedModel());
  }
  ObjList<QueryModel> joinModels=model.getJoinModels();
  for (int i=0, n=joinModels.size(); i < n; i++) {
    QueryModel m=joinModels.getQuick(i);
    if (m != model) {
      optimiseInvertedBooleans(joinModels.getQuick(i));
    }
  }
}
Program: 31153
Project: 31153
Buggy source:
public static void formatHTTP(CharSink sink,long millis){
  int y=getYear(millis);
  boolean l=isLeapYear(y);
  int m=getMonthOfYear(millis,y,l);
  sink.put(DAYS_OF_WEEK[getDayOfWeek(millis) - 1]).put("String_Node_Str").put(getDayOfMonth(millis,y,m,l)).put(' ').put(MONTHS_OF_YEAR[m - 1]).put(' ').put(y).put(' ').put(getHourOfDay(millis)).put(':').put(getMinuteOfHour(millis)).put(':').put(getSecondOfMinute(millis)).put(' ').put("String_Node_Str");
}

Fixed version (ground truth):
public static void formatHTTP(CharSink sink,long millis){
  int y=getYear(millis);
  boolean l=isLeapYear(y);
  int m=getMonthOfYear(millis,y,l);
  sink.put(DAYS_OF_WEEK[getDayOfWeek(millis) - 1]).put("String_Node_Str").put(getDayOfMonth(millis,y,m,l)).put(' ').put(MONTHS_OF_YEAR[m - 1]).put(' ');
  append0000(sink,y);
  sink.put(' ');
  append0(sink,getHourOfDay(millis));
  sink.put(':');
  append0(sink,getMinuteOfHour(millis));
  sink.put(':');
  append0(sink,getSecondOfMinute(millis));
  sink.put(' ').put("String_Node_Str");
}
Program: 31154
Project: 31154
Buggy source:
public void addColumn(QueryColumn column){
  columns.add(column);
}

Fixed version (ground truth):
public void addColumn(QueryColumn column){
  columns.add(column);
  if (column.getAlias() != null) {
    aliasToColumnMap.put(column.getAlias(),column);
  }
}
Program: 31155
Project: 31155
Buggy source:
public void clear(){
  columns.clear();
  joinModels.clear();
  joinModels.add(this);
  sampleBy=null;
  orderBy.clear();
  orderByDirection.clear();
  dependencies.clear();
  parsedWhere.clear();
  whereClause=null;
  nestedModel=null;
  journalName=null;
  alias=null;
  latestBy=null;
  recordSource=null;
  metadata=null;
  joinCriteria=null;
  joinType=JOIN_INNER;
  orderedJoinModels1.clear();
  orderedJoinModels2.clear();
  parsedWhereConsts.clear();
  aliasIndexes.clear();
  postJoinWhereClause=null;
  context=null;
  orderedJoinModels=orderedJoinModels2;
  limitHi=null;
  limitLo=null;
  limitHiVc=null;
  limitLoVc=null;
  columnNameHistogram.clear();
  parameterMap.clear();
  timestamp=null;
  exprNodeStack.clear();
  journalMetadata=null;
  joinColumns.clear();
  withClauses.clear();
}

Fixed version (ground truth):
public void clear(){
  columns.clear();
  aliasToColumnMap.clear();
  joinModels.clear();
  joinModels.add(this);
  sampleBy=null;
  orderBy.clear();
  orderByDirection.clear();
  dependencies.clear();
  parsedWhere.clear();
  whereClause=null;
  nestedModel=null;
  journalName=null;
  alias=null;
  latestBy=null;
  recordSource=null;
  metadata=null;
  joinCriteria=null;
  joinType=JOIN_INNER;
  orderedJoinModels1.clear();
  orderedJoinModels2.clear();
  parsedWhereConsts.clear();
  aliasIndexes.clear();
  postJoinWhereClause=null;
  context=null;
  orderedJoinModels=orderedJoinModels2;
  limitHi=null;
  limitLo=null;
  limitHiVc=null;
  limitLoVc=null;
  columnNameHistogram.clear();
  parameterMap.clear();
  timestamp=null;
  exprNodeStack.clear();
  journalMetadata=null;
  joinColumns.clear();
  withClauses.clear();
}
Program: 31156
Project: 31156
Buggy source:
private int resolveJournalIndex(QueryModel parent,@Transient CharSequence alias,CharSequence column,int position) throws ParserException {
  ObjList<QueryModel> joinModels=parent.getJoinModels();
  int index=-1;
  if (alias == null) {
    for (int i=0, n=joinModels.size(); i < n; i++) {
      RecordMetadata m=joinModels.getQuick(i).getMetadata();
      if (m.getColumnIndexQuiet(column) == -1) {
        continue;
      }
      if (index > -1) {
        throw QueryError.ambiguousColumn(position);
      }
      index=i;
    }
    if (index == -1) {
      throw QueryError.invalidColumn(position,column);
    }
    return index;
  }
 else {
    index=parent.getAliasIndex(alias);
    if (index == -1) {
      throw QueryError.$(position,"String_Node_Str");
    }
    RecordMetadata m=joinModels.getQuick(index).getMetadata();
    if (m.getColumnIndexQuiet(column) == -1) {
      throw QueryError.invalidColumn(position,column);
    }
    return index;
  }
}

Fixed version (ground truth):
private int resolveJournalIndex(QueryModel parent,@Transient CharSequence alias,CharSequence col,int position) throws ParserException {
  CharSequence column=parent.translateAlias(col);
  ObjList<QueryModel> joinModels=parent.getJoinModels();
  int index=-1;
  if (alias == null) {
    for (int i=0, n=joinModels.size(); i < n; i++) {
      RecordMetadata m=joinModels.getQuick(i).getMetadata();
      if (m.getColumnIndexQuiet(column) == -1) {
        continue;
      }
      if (index > -1) {
        throw QueryError.ambiguousColumn(position);
      }
      index=i;
    }
    if (index == -1) {
      throw QueryError.invalidColumn(position,column);
    }
    return index;
  }
 else {
    index=parent.getAliasIndex(alias);
    if (index == -1) {
      throw QueryError.$(position,"String_Node_Str");
    }
    RecordMetadata m=joinModels.getQuick(index).getMetadata();
    if (m.getColumnIndexQuiet(column) == -1) {
      throw QueryError.invalidColumn(position,column);
    }
    return index;
  }
}
Program: 31157
Project: 31157
Buggy source:
@Override public void visit(ExprNode node) throws ParserException {
switch (node.type) {
case ExprNode.LITERAL:
    int dot=node.token.indexOf('.');
  CharSequence name=extractColumnName(node.token,dot);
indexes.add(resolveJournalIndex(parent,dot == -1 ? null : csPool.next().of(node.token,0,dot),name,node.position));
names.add(name);
break;
case ExprNode.CONSTANT:
if (nullConstants.contains(node.token)) {
nullCount++;
}
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void visit(ExprNode node) throws ParserException {
switch (node.type) {
case ExprNode.LITERAL:
    int dot=node.token.indexOf('.');
  CharSequence name=extractColumnName(node.token,dot);
indexes.add(resolveJournalIndex(parent,dot == -1 ? null : csPool.next().of(node.token,0,dot),name,node.position));
if (names != null) {
names.add(name);
}
break;
case ExprNode.CONSTANT:
if (nullConstants.contains(node.token)) {
nullCount++;
}
break;
default :
break;
}
}
Program: 31158
Project: 31158
Buggy source:
private VirtualColumn lookupColumn(ExprNode node) throws ParserException {
  try {
    if (columnNameHistogram.get(node.token) > 0) {
      throw QueryError.ambiguousColumn(node.position);
    }
    int index=metadata.getColumnIndex(node.token);
switch (metadata.getColumnQuick(index).getType()) {
case ColumnType.DOUBLE:
      return new DoubleRecordSourceColumn(index,node.position);
case ColumnType.INT:
    return new IntRecordSourceColumn(index,node.position);
case ColumnType.LONG:
  return new LongRecordSourceColumn(index,node.position);
case ColumnType.STRING:
return new StrRecordSourceColumn(index,node.position);
case ColumnType.SYMBOL:
return new SymRecordSourceColumn(index,node.position);
case ColumnType.BYTE:
return new ByteRecordSourceColumn(index,node.position);
case ColumnType.FLOAT:
return new FloatRecordSourceColumn(index,node.position);
case ColumnType.BOOLEAN:
return new BoolRecordSourceColumn(index,node.position);
case ColumnType.SHORT:
return new ShortRecordSourceColumn(index,node.position);
case ColumnType.BINARY:
return new BinaryRecordSourceColumn(index,node.position);
case ColumnType.DATE:
return new DateRecordSourceColumn(index,node.position);
default :
throw QueryError.$(node.position,"String_Node_Str");
}
}
 catch (NoSuchColumnException e) {
throw QueryError.invalidColumn(node.position,node.token);
}
}

Fixed version (ground truth):
private VirtualColumn lookupColumn(ExprNode node) throws ParserException {
  CharSequence column=model.translateAlias(node.token);
  try {
    if (columnNameHistogram.get(column) > 0) {
      throw QueryError.ambiguousColumn(node.position);
    }
    int index=metadata.getColumnIndex(column);
switch (metadata.getColumnQuick(index).getType()) {
case ColumnType.DOUBLE:
      return new DoubleRecordSourceColumn(index,node.position);
case ColumnType.INT:
    return new IntRecordSourceColumn(index,node.position);
case ColumnType.LONG:
  return new LongRecordSourceColumn(index,node.position);
case ColumnType.STRING:
return new StrRecordSourceColumn(index,node.position);
case ColumnType.SYMBOL:
return new SymRecordSourceColumn(index,node.position);
case ColumnType.BYTE:
return new ByteRecordSourceColumn(index,node.position);
case ColumnType.FLOAT:
return new FloatRecordSourceColumn(index,node.position);
case ColumnType.BOOLEAN:
return new BoolRecordSourceColumn(index,node.position);
case ColumnType.SHORT:
return new ShortRecordSourceColumn(index,node.position);
case ColumnType.BINARY:
return new BinaryRecordSourceColumn(index,node.position);
case ColumnType.DATE:
return new DateRecordSourceColumn(index,node.position);
default :
throw QueryError.$(node.position,"String_Node_Str");
}
}
 catch (NoSuchColumnException e) {
throw QueryError.invalidColumn(node.position,column);
}
}
Program: 31159
Project: 31159
Buggy source:
VirtualColumn createVirtualColumn(QueryModel model,ExprNode node,RecordMetadata metadata) throws ParserException {
  this.columnNameHistogram=model.getColumnNameHistogram();
  this.parameterMap=model.getParameterMap();
  this.metadata=metadata;
  algo.traverse(node,this);
  return stack.poll();
}

Fixed version (ground truth):
VirtualColumn createVirtualColumn(QueryModel model,ExprNode node,RecordMetadata metadata) throws ParserException {
  this.columnNameHistogram=model.getColumnNameHistogram();
  this.parameterMap=model.getParameterMap();
  this.model=model;
  this.metadata=metadata;
  algo.traverse(node,this);
  return stack.poll();
}
Program: 31160
Project: 31160
Buggy source:
private int getTimestampIndexQuiet(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;
  }
}

Fixed version (ground truth):
private int getTimestampIndexQuiet(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 {
    return m.getTimestampIndex();
  }
}
Program: 31162
Project: 31162
Buggy source:
@Override public void setArg(int pos,VirtualColumn arg) throws ParserException {
  if (pos == 0) {
    lhs=arg;
  }
 else {
    set.add(arg.getStr(null).toString());
  }
}

Fixed version (ground truth):
@Override public void setArg(int pos,VirtualColumn arg) throws ParserException {
  if (pos == 0) {
    lhs=arg;
  }
 else {
    assertConstant(arg);
switch (arg.getType()) {
case ColumnType.STRING:
      CharSequence cs=arg.getFlyweightStr(null);
    set.add(cs == null ? null : cs.toString());
  break;
default :
typeError(arg.getPosition(),ColumnType.STRING);
break;
}
}
}
Program: 31163
Project: 31163
Buggy source:
@Override public void prepare(StorageFacade facade){
  lhs.prepare(facade);
  SymbolTable tab=lhs.getSymbolTable();
  for (int i=0, n=values.size(); i < n; i++) {
    int k=tab.getQuick(values.get(i));
    if (k > -1) {
      set.add(k);
    }
  }
}

Fixed version (ground truth):
@Override public void prepare(StorageFacade facade){
  lhs.prepare(facade);
  SymbolTable tab=lhs.getSymbolTable();
  for (int i=0, n=values.size(); i < n; i++) {
    set.add(tab.getQuick(values.get(i)));
  }
}
Program: 31164
Project: 31164
Buggy source:
@Override public void setArg(int pos,VirtualColumn arg) throws ParserException {
  if (pos == 0) {
    lhs=arg;
  }
 else {
    values.add(arg.getStr(null).toString());
  }
}

Fixed version (ground truth):
@Override public void setArg(int pos,VirtualColumn arg) throws ParserException {
  if (pos == 0) {
    lhs=arg;
  }
 else {
    assertConstant(arg);
switch (arg.getType()) {
case ColumnType.STRING:
      CharSequence cs=arg.getFlyweightStr(null);
    values.add(cs == null ? null : cs.toString());
  break;
default :
typeError(arg.getPosition(),ColumnType.STRING);
break;
}
}
}
Program: 31165
Project: 31165
Buggy source:
@Override public int getStrLen(Record rec){
  return getFlyweightStr(rec).length();
}

Fixed version (ground truth):
@Override public int getStrLen(Record rec){
  CharSequence cs=getFlyweightStr(rec);
  return cs == null ? -1 : cs.length();
}
Program: 31166
Project: 31166
Buggy source:
@Override public void setRhs(VirtualColumn rhs) throws ParserException {
  super.setRhs(rhs);
  CharSequence intervalStr=rhs.getFlyweightStr(null);
  IntervalCompiler.parseIntervalEx(intervalStr,0,intervalStr.length(),rhs.getPosition(),intervals);
  intervalCount=intervals.size() / 2;
}

Fixed version (ground truth):
@Override public void setRhs(VirtualColumn rhs) throws ParserException {
  super.setRhs(rhs);
  CharSequence intervalStr=rhs.getFlyweightStr(null);
  if (intervalStr != null) {
    IntervalCompiler.parseIntervalEx(intervalStr,0,intervalStr.length(),rhs.getPosition(),intervals);
  }
  intervalCount=intervals.size() / 2;
}
Program: 31167
Project: 31167
Buggy source:
@Override public int getStrLen(Record rec){
  return getFlyweightStr(rec).length();
}

Fixed version (ground truth):
@Override public int getStrLen(Record rec){
  CharSequence cs=getFlyweightStr(rec);
  return cs == null ? -1 : cs.length();
}
Program: 31169
Project: 31169
Buggy source:
@SuppressWarnings("String_Node_Str") private IntHashSet(int initialCapacity,double loadFactor){
  if (loadFactor <= 0d || loadFactor >= 1d) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.list=new IntList(initialCapacity);
  int capacity=Math.max(initialCapacity,(int)(initialCapacity / loadFactor));
  this.loadFactor=loadFactor;
  keys=new int[capacity < MIN_INITIAL_CAPACITY ? MIN_INITIAL_CAPACITY : Numbers.ceilPow2(capacity)];
  mask=keys.length - 1;
  free=this.capacity=initialCapacity;
  clear();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public IntHashSet(int initialCapacity,double loadFactor,int noEntryValue){
  this.noEntryValue=noEntryValue;
  if (loadFactor <= 0d || loadFactor >= 1d) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.list=new IntList(initialCapacity);
  int capacity=Math.max(initialCapacity,(int)(initialCapacity / loadFactor));
  this.loadFactor=loadFactor;
  keys=new int[capacity < MIN_INITIAL_CAPACITY ? MIN_INITIAL_CAPACITY : Numbers.ceilPow2(capacity)];
  mask=keys.length - 1;
  free=this.capacity=initialCapacity;
  clear();
}
Program: 31170
Project: 31170
Buggy source:
private void compileReplacePattern(VirtualColumn arg) throws ParserException {
  CharSequence pattern=arg.getFlyweightStr(null);
  if (pattern == null) {
    throw QueryError.$(arg.getPosition(),"String_Node_Str");
  }
  int pos=arg.getPosition();
  int start=0;
  int index=-1;
  int dollar=-2;
  ConcatCharSequence concat=new ConcatCharSequence();
  boolean collectIndex=false;
  int n=pattern.length();
  for (int i=0; i < n; i++) {
    char c=pattern.charAt(i);
switch (c) {
case '$':
      if (i == dollar + 1) {
        throw QueryError.$(pos + i,"String_Node_Str");
      }
    if (i > start) {
      concat.add(new FlyweightCharSequence().of(pattern,start,i - start));
    }
  collectIndex=true;
index=0;
dollar=i;
break;
default :
if (collectIndex) {
int k=c - '0';
if (k > -1 && k < 10) {
index=index * 10 + k;
}
 else {
if (i == dollar + 1) {
throw QueryError.$(pos + i,"String_Node_Str");
}
concat.add(new GroupCharSequence(index));
start=i;
collectIndex=false;
index=-1;
}
}
break;
}
}
if (collectIndex) {
if (n == dollar + 1) {
throw QueryError.$(pos + n,"String_Node_Str");
}
concat.add(new GroupCharSequence(index));
}
 else if (start < n) {
concat.add(new FlyweightCharSequence().of(pattern,start,n - start));
}
if (trivial=(concat.partCount() == 1)) {
left=new FlyweightCharSequence();
right=new FlyweightCharSequence();
concat.surroundWith(left,right);
}
this.replacePattern=concat;
}

Fixed version (ground truth):
private void compileReplacePattern(VirtualColumn arg) throws ParserException {
  CharSequence pattern=arg.getFlyweightStr(null);
  if (pattern == null) {
    throw QueryError.$(arg.getPosition(),"String_Node_Str");
  }
  int pos=arg.getPosition();
  int start=0;
  int index=-1;
  int dollar=-2;
  int dollarCount=0;
  ConcatCharSequence concat=new ConcatCharSequence();
  boolean collectIndex=false;
  int n=pattern.length();
  for (int i=0; i < n; i++) {
    char c=pattern.charAt(i);
switch (c) {
case '$':
      if (i == dollar + 1) {
        throw QueryError.$(pos + i,"String_Node_Str");
      }
    if (i > start) {
      concat.add(new FlyweightCharSequence().of(pattern,start,i - start));
    }
  collectIndex=true;
index=0;
dollar=i;
dollarCount++;
break;
default :
if (collectIndex) {
int k=c - '0';
if (k > -1 && k < 10) {
index=index * 10 + k;
}
 else {
if (i == dollar + 1) {
throw QueryError.$(pos + i,"String_Node_Str");
}
concat.add(new GroupCharSequence(index));
start=i;
collectIndex=false;
index=-1;
}
}
break;
}
}
if (collectIndex) {
if (n == dollar + 1) {
throw QueryError.$(pos + n,"String_Node_Str");
}
concat.add(new GroupCharSequence(index));
}
 else if (start < n) {
concat.add(new FlyweightCharSequence().of(pattern,start,n - start));
}
if (trivial=(dollarCount == 0)) {
left=new FlyweightCharSequence();
right=new FlyweightCharSequence();
concat.surroundWith(left,right);
}
this.replacePattern=concat;
}
Program: 31172
Project: 31172
Buggy source:
public void surroundWith(CharSequence left,CharSequence right){
  CharSequence delegate=delegates.get(0);
  delegates.ensureCapacity(3);
  delegates.extendAndSet(0,left);
  delegates.extendAndSet(1,delegate);
  delegates.extendAndSet(2,right);
  lastSeq=left;
  lastSeqLen=left.length();
}

Fixed version (ground truth):
public void surroundWith(CharSequence left,CharSequence right){
  if (delegates.size() > 0) {
    CharSequence delegate=delegates.get(0);
    delegates.ensureCapacity(3);
    delegates.extendAndSet(0,left);
    delegates.extendAndSet(1,delegate);
    delegates.extendAndSet(2,right);
  }
 else {
    delegates.ensureCapacity(2);
    delegates.extendAndSet(0,left);
    delegates.extendAndSet(1,right);
  }
  lastSeq=left;
  lastSeqLen=left.length();
}
Program: 31173
Project: 31173
Buggy source:
@Override public short getShort(int col){
  return rec().getShort(col);
}

Fixed version (ground truth):
@Override public short getShort(int col){
  return rec.getShort(col);
}
Program: 31174
Project: 31174
Buggy source:
@Override public CharSequence getFlyweightStrB(int col){
  return rec().getFlyweightStrB(col);
}

Fixed version (ground truth):
@Override public CharSequence getFlyweightStrB(int col){
  return rec.getFlyweightStrB(col);
}
Program: 31175
Project: 31175
Buggy source:
@Override public long getRowId(){
  return rec().getRowId();
}

Fixed version (ground truth):
@Override public long getRowId(){
  return rec.getRowId();
}
Program: 31176
Project: 31176
Buggy source:
@Override public long getBinLen(int col){
  return rec().getBinLen(col);
}

Fixed version (ground truth):
@Override public long getBinLen(int col){
  return rec.getBinLen(col);
}
Program: 31177
Project: 31177
Buggy source:
@Override public double getDouble(int col){
  return rec().getDouble(col);
}

Fixed version (ground truth):
@Override public double getDouble(int col){
  return rec.getDouble(col);
}
Program: 31178
Project: 31178
Buggy source:
@Override public float getFloat(int col){
  return rec().getFloat(col);
}

Fixed version (ground truth):
@Override public float getFloat(int col){
  return rec.getFloat(col);
}
Program: 31179
Project: 31179
Buggy source:
@Override public CharSequence getFlyweightStr(int col){
  return rec().getFlyweightStr(col);
}

Fixed version (ground truth):
@Override public CharSequence getFlyweightStr(int col){
  return rec.getFlyweightStr(col);
}
Program: 31180
Project: 31180
Buggy source:
@Override public long getLong(int col){
  return rec().getLong(col);
}

Fixed version (ground truth):
@Override public long getLong(int col){
  return rec.getLong(col);
}
Program: 31181
Project: 31181
Buggy source:
@Override public int getInt(int col){
  return rec().getInt(col);
}

Fixed version (ground truth):
@Override public int getInt(int col){
  return rec.getInt(col);
}
Program: 31182
Project: 31182
Buggy source:
@Override public void getStr(int col,CharSink sink){
  rec().getStr(col,sink);
}

Fixed version (ground truth):
@Override public void getStr(int col,CharSink sink){
  rec.getStr(col,sink);
}
Program: 31183
Project: 31183
Buggy source:
@Override public int getStrLen(int col){
  return rec().getStrLen(col);
}

Fixed version (ground truth):
@Override public int getStrLen(int col){
  return rec.getStrLen(col);
}
Program: 31184
Project: 31184
Buggy source:
@Override public byte get(int col){
  return rec().get(col);
}

Fixed version (ground truth):
@Override public byte get(int col){
  return rec.get(col);
}
Program: 31185
Project: 31185
Buggy source:
@Override public DirectInputStream getBin(int col){
  return rec().getBin(col);
}

Fixed version (ground truth):
@Override public DirectInputStream getBin(int col){
  return rec.getBin(col);
}
Program: 31186
Project: 31186
Buggy source:
@Override public String getSym(int col){
  return rec().getSym(col);
}

Fixed version (ground truth):
@Override public String getSym(int col){
  return rec.getSym(col);
}
Program: 31187
Project: 31187
Buggy source:
public void set_null(boolean _null){
  this._null=_null;
}

Fixed version (ground truth):
public void set_null(boolean _null){
  if (this._null != _null) {
    this.rec=_null ? NullRecord.INSTANCE : record;
    this._null=_null;
  }
}
Program: 31188
Project: 31188
Buggy source:
public NullableRecord(Record record){
  this.record=record;
}

Fixed version (ground truth):
public NullableRecord(Record record){
  this.record=this.rec=record;
}
Program: 31189
Project: 31189
Buggy source:
@Override public long getDate(int col){
  return rec().getDate(col);
}

Fixed version (ground truth):
@Override public long getDate(int col){
  return rec.getDate(col);
}
Program: 31190
Project: 31190
Buggy source:
@Override public boolean getBool(int col){
  return rec().getBool(col);
}

Fixed version (ground truth):
@Override public boolean getBool(int col){
  return rec.getBool(col);
}
Program: 31191
Project: 31191
Buggy source:
@Override public Record next(){
  record.of(recordCursor.next());
  return record;
}

Fixed version (ground truth):
@Override public Record next(){
  recordCursor.next();
  return record;
}
Program: 31192
Project: 31192
Buggy source:
public VirtualColumnRecordSource(RecordSource delegate,ObjList<VirtualColumn> virtualColumns){
  this.delegate=delegate;
  RecordMetadata dm=delegate.getMetadata();
  this.metadata=new VirtualRecordMetadata(dm,virtualColumns);
  this.record=new VirtualRecord(dm.getColumnCount(),virtualColumns);
  this.virtualColumnStorageFacade=VirtualColumnStorageFacade.INSTANCE;
  this.storageFacade=new SplitRecordStorageFacade(dm.getColumnCount());
}

Fixed version (ground truth):
public VirtualColumnRecordSource(RecordSource delegate,ObjList<VirtualColumn> virtualColumns){
  this.delegate=delegate;
  RecordMetadata dm=delegate.getMetadata();
  this.metadata=new VirtualRecordMetadata(dm,virtualColumns);
  this.record=new VirtualRecord(dm.getColumnCount(),virtualColumns,delegate.getRecord());
  this.virtualColumnStorageFacade=VirtualColumnStorageFacade.INSTANCE;
  this.storageFacade=new SplitRecordStorageFacade(dm.getColumnCount());
}
Program: 31193
Project: 31193
Buggy source:
@Override public Record newRecord(){
  return record.copy().of(delegate.newRecord());
}

Fixed version (ground truth):
@Override public Record newRecord(){
  return record.copy(delegate.newRecord());
}
Program: 31194
Project: 31194
Buggy source:
@Override public PartitionCursor prepareCursor(JournalReaderFactory factory){
  try {
    this.journal=factory.reader(metadata);
  }
 catch (  JournalException e) {
    throw new JournalRuntimeException(e);
  }
  storageFacade.of(metadata);
  partitionCount=journal.getPartitionCount();
  partitionIndex=0;
  return this;
}

Fixed version (ground truth):
@Override public PartitionCursor prepareCursor(JournalReaderFactory factory){
  try {
    this.journal=factory.reader(metadata);
  }
 catch (  JournalException e) {
    throw new JournalRuntimeException(e);
  }
  storageFacade.of(journal.getMetadata());
  partitionCount=journal.getPartitionCount();
  partitionIndex=0;
  return this;
}
Program: 31195
Project: 31195
Buggy source:
@Override public Record next(){
  long ts=masterCursor.next().getDate(masterTimestampIndex);
  Record delayed=delayedHolder.peek();
  if (delayed != null) {
    if (ts > delayed.getDate(slaveTimestampIndex)) {
      recordHolder.write(delayed);
      delayedHolder.clear();
    }
 else {
      nullableRecord.set_null(true);
      return record;
    }
  }
  while (slaveCursor.hasNext()) {
    Record slave=slaveCursor.next();
    if (ts > slave.getDate(slaveTimestampIndex)) {
      recordHolder.write(slave);
    }
 else {
      nullableRecord.set_null(recordHolder.peek() == null);
      recordHolder.clear();
      delayedHolder.write(slave);
      return record;
    }
  }
  nullableRecord.set_null(recordHolder.peek() == null);
  return record;
}

Fixed version (ground truth):
@Override public Record next(){
  long ts=masterCursor.next().getDate(masterTimestampIndex);
  Record delayed=delayedHolder.peek();
  if (delayed != null) {
    if (ts > delayed.getDate(slaveTimestampIndex)) {
      recordHolder.write(delayed);
      delayedHolder.clear();
    }
 else {
      nullableRecord.set_null(true);
      return record;
    }
  }
  while (slaveCursor.hasNext()) {
    Record slave=slaveCursor.next();
    if (ts > slave.getDate(slaveTimestampIndex)) {
      recordHolder.write(slave);
    }
 else {
      delayedHolder.write(slave);
      nullableRecord.set_null(recordHolder.peek() == null);
      recordHolder.clear();
      return record;
    }
  }
  nullableRecord.set_null(recordHolder.peek() == null);
  return record;
}
Program: 31196
Project: 31196
Buggy source:
private RecordSource createAsOfJoin(ExprNode masterTimestampNode,QueryModel model,RecordSource master,RecordSource slave) throws ParserException {
  JoinContext jc=model.getContext();
  ExprNode slaveTimestampNode=model.getTimestamp();
  RecordMetadata masterMetadata=master.getMetadata();
  RecordMetadata slaveMetadata=slave.getMetadata();
  int slaveTimestampIndex=getTimestampIndex(model,slaveTimestampNode,slaveMetadata);
  int masterTimestampIndex=getTimestampIndex(model,masterTimestampNode,masterMetadata);
  if (jc == null) {
    return new AsOfJoinRecordSource(master,masterTimestampIndex,slave,slaveTimestampIndex);
  }
 else {
    int sz=jc.aNames.size();
    CharSequenceHashSet slaveKeys=new CharSequenceHashSet();
    CharSequenceHashSet masterKeys=new CharSequenceHashSet();
    for (int i=0; i < sz; i++) {
      slaveKeys.add(jc.aNames.getQuick(i));
      masterKeys.add(jc.bNames.getQuick(i));
    }
    return new AsOfPartitionedJoinRecordSource(master,masterTimestampIndex,slave,slaveTimestampIndex,masterKeys,slaveKeys,configuration.getDbAsOfDataPage(),configuration.getDbAsOfIndexPage(),configuration.getDbAsOfRowPage());
  }
}

Fixed version (ground truth):
private RecordSource createAsOfJoin(ExprNode masterTimestampNode,QueryModel model,RecordSource master,RecordSource slave) throws ParserException {
  JoinContext jc=model.getContext();
  ExprNode slaveTimestampNode=model.getTimestamp();
  RecordMetadata masterMetadata=master.getMetadata();
  RecordMetadata slaveMetadata=slave.getMetadata();
  int slaveTimestampIndex=getTimestampIndex(model,slaveTimestampNode,slaveMetadata);
  int masterTimestampIndex=getTimestampIndex(model,masterTimestampNode,masterMetadata);
  if (jc.bIndexes.size() == 0) {
    return new AsOfJoinRecordSource(master,masterTimestampIndex,slave,slaveTimestampIndex);
  }
 else {
    int sz=jc.aNames.size();
    CharSequenceHashSet slaveKeys=new CharSequenceHashSet();
    CharSequenceHashSet masterKeys=new CharSequenceHashSet();
    for (int i=0; i < sz; i++) {
      slaveKeys.add(jc.aNames.getQuick(i));
      masterKeys.add(jc.bNames.getQuick(i));
    }
    return new AsOfPartitionedJoinRecordSource(master,masterTimestampIndex,slave,slaveTimestampIndex,masterKeys,slaveKeys,configuration.getDbAsOfDataPage(),configuration.getDbAsOfIndexPage(),configuration.getDbAsOfRowPage());
  }
}
Program: 31197
Project: 31197
Buggy source:
private boolean analyzeEquals(IntrinsicModel model,ExprNode node,RecordMetadata m) throws ParserException {
  return node.paramCount == 2 && (analyzeEquals0(model,node,node.lhs,node.rhs,m) || analyzeEquals0(model,node,node.rhs,node.lhs,m));
}

Fixed version (ground truth):
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);
}
Program: 31198
Project: 31198
Buggy source:
private boolean analyzeGreater(IntrinsicModel model,ExprNode node,int inc) throws ParserException {
  if (timestamp == null) {
    return false;
  }
  if (node.lhs.type == ExprNode.LITERAL && node.lhs.token.equals(timestamp)) {
    try {
      long lo=Dates.tryParse(quoteEraser.ofQuoted(node.rhs.token)) + inc;
      if (lo > model.intervalLo) {
        model.intervalLo=lo;
      }
      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)) {
    try {
      long hi=Dates.tryParse(quoteEraser.ofQuoted(node.lhs.token)) - inc;
      if (hi < model.intervalHi) {
        model.intervalHi=hi;
      }
      node.intrinsicValue=IntrinsicValue.TRUE;
      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 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)) {
    try {
      long lo=Dates.tryParse(quoteEraser.ofQuoted(node.rhs.token)) + inc;
      if (lo > model.intervalLo) {
        model.intervalLo=lo;
      }
      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)) {
    try {
      long hi=Dates.tryParse(quoteEraser.ofQuoted(node.lhs.token)) - inc;
      if (hi < model.intervalHi) {
        model.intervalHi=hi;
      }
      node.intrinsicValue=IntrinsicValue.TRUE;
      return true;
    }
 catch (    NumericException e) {
      throw QueryError.$(node.lhs.position,"String_Node_Str");
    }
  }
  return false;
}
Program: 31199
Project: 31199
Buggy source:
private boolean removeAndIntrinsics(IntrinsicModel model,ExprNode node,RecordMetadata m) throws ParserException {
  if (node == null) {
    return true;
  }
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);
default :
return false;
}
}

Fixed version (ground truth):
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;
}
}
Program: 31201
Project: 31201
Buggy source:
private boolean analyzeLess(IntrinsicModel model,ExprNode node,int inc) throws ParserException {
  if (timestamp == null) {
    return false;
  }
  if (node.lhs.type == ExprNode.LITERAL && node.lhs.token.equals(timestamp)) {
    try {
      long hi=Dates.tryParse(quoteEraser.ofQuoted(node.rhs.token)) - inc;
      if (hi < model.intervalHi) {
        model.intervalHi=hi;
      }
      node.intrinsicValue=IntrinsicValue.TRUE;
      timestampNodes.add(node);
      return true;
    }
 catch (    NumericException e) {
      throw QueryError.$(node.rhs.position,"String_Node_Str");
    }
  }
  if (node.rhs.type == ExprNode.LITERAL && node.rhs.token.equals(timestamp)) {
    try {
      long lo=Dates.tryParse(quoteEraser.ofQuoted(node.lhs.token)) + inc;
      if (lo > model.intervalLo) {
        model.intervalLo=lo;
      }
      node.intrinsicValue=IntrinsicValue.TRUE;
      timestampNodes.add(node);
      return true;
    }
 catch (    NumericException e) {
      throw QueryError.$(node.lhs.position,"String_Node_Str");
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean analyzeLess(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)) {
    try {
      long hi=Dates.tryParse(quoteEraser.ofQuoted(node.rhs.token)) - inc;
      if (hi < model.intervalHi) {
        model.intervalHi=hi;
      }
      node.intrinsicValue=IntrinsicValue.TRUE;
      timestampNodes.add(node);
      return true;
    }
 catch (    NumericException e) {
      throw QueryError.$(node.rhs.position,"String_Node_Str");
    }
  }
  if (node.rhs.type == ExprNode.LITERAL && node.rhs.token.equals(timestamp)) {
    try {
      long lo=Dates.tryParse(quoteEraser.ofQuoted(node.lhs.token)) + inc;
      if (lo > model.intervalLo) {
        model.intervalLo=lo;
      }
      node.intrinsicValue=IntrinsicValue.TRUE;
      timestampNodes.add(node);
      return true;
    }
 catch (    NumericException e) {
      throw QueryError.$(node.lhs.position,"String_Node_Str");
    }
  }
  return false;
}
Program: 31203
Project: 31203
Buggy source:
public MappedByteBuffer getBuffer(long offset,int size){
  if (offset > cachedBufferLo && offset + size < cachedBufferHi) {
    cachedBuffer.position((int)(offset - cachedBufferLo - 1));
  }
 else {
    cachedBuffer=getBufferInternal(offset,size);
    cachedBufferLo=offset - cachedBuffer.position() - 1;
    cachedBufferHi=cachedBufferLo + cachedBuffer.limit() + 2;
    cachedAddress=ByteBuffers.getAddress(cachedBuffer);
  }
  return cachedBuffer;
}

Fixed version (ground truth):
public MappedByteBuffer getBuffer(long offset,int size){
  if (offset > cachedBufferLo && offset + size < cachedBufferHi) {
    cachedBuffer.position((int)(offset - cachedBufferLo - 1));
  }
 else {
    cachedBuffer=getBufferInternal(offset,size);
    cachedBufferLo=offset - cachedBuffer.position() - 1;
    cachedBufferHi=cachedBufferLo + cachedBuffer.limit() + 2;
    cachedAddress=ByteBuffers.getAddress(cachedBuffer);
    cachedPointer=cachedAddress - cachedBufferLo - 1;
  }
  return cachedBuffer;
}
Program: 31204
Project: 31204
Buggy source:
public long addressOf(long offset,int size){
  if (offset > cachedBufferLo && offset + size < cachedBufferHi) {
    return cachedAddress + offset - cachedBufferLo - 1;
  }
 else {
    return allocateAddress(offset,size);
  }
}

Fixed version (ground truth):
public long addressOf(long offset,int size){
  if (offset > cachedBufferLo && offset + size < cachedBufferHi) {
    return cachedPointer + offset;
  }
 else {
    return allocateAddress(offset,size);
  }
}
Program: 31205
Project: 31205
Buggy source:
private long allocateAddress(long offset,int size){
  cachedBuffer=getBufferInternal(offset,size);
  int p=cachedBuffer.position();
  cachedBufferLo=offset - p - 1;
  cachedBufferHi=cachedBufferLo + cachedBuffer.limit() + 2;
  cachedAddress=ByteBuffers.getAddress(cachedBuffer);
  return cachedAddress + p;
}

Fixed version (ground truth):
private long allocateAddress(long offset,int size){
  cachedBuffer=getBufferInternal(offset,size);
  int p=cachedBuffer.position();
  cachedBufferLo=offset - p - 1;
  cachedBufferHi=cachedBufferLo + cachedBuffer.limit() + 2;
  cachedAddress=ByteBuffers.getAddress(cachedBuffer);
  cachedPointer=cachedAddress - cachedBufferLo - 1;
  return cachedAddress + p;
}
Program: 31206
Project: 31206
Buggy source:
public CharSequence getFlyweightStrB(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 csB.of(lo,lo + len * 2);
}

Fixed version (ground truth):
public CharSequence getFlyweightStrB(long localRowID){
  return getFlyweightStr0(localRowID,csB);
}