nus-yam/ex-repair huggingface dataset:
Program: 96117
Project: 96117
Buggy source:
@Override public ExactRelation rewriteForPointEstimate(){
  ExactRelation r=new ProjectedRelation(vc,source.rewriteForPointEstimate(),elems);
  r.setAliasName(getAlias());
  return r;
}

Fixed version (ground truth):
@Override public ExactRelation rewriteForPointEstimate(){
  ExactRelation r=new ProjectedRelation(vc,source.rewriteForPointEstimate(),elemsWithSubstitutedTables());
  r.setAliasName(getAlias());
  return r;
}
Program: 96118
Project: 96118
Buggy source:
/** 
 * Inserts extra information if extra is set to true. The extra information is: 1. partition size. 
 * @param extra
 * @return
 */
protected ExactRelation rewriteWithPartition(boolean extra){
  ExactRelation newSource=source.rewriteWithPartition();
  List<SelectElem> newElems=new ArrayList<SelectElem>();
  int index=0;
  for (  SelectElem elem : elems) {
    if (!elem.getExpr().isagg()) {
      newElems.add(elem);
    }
 else {
      Expr agg=((AggregatedRelation)newSource).getAggList().get(index++);
      newElems.add(new SelectElem(agg,elem.getAlias()));
    }
  }
  if (extra) {
    newElems.add(new SelectElem(FuncExpr.count(),partitionSizeAlias));
  }
  newElems.add(new SelectElem(newSource.partitionColumn(),partitionColumnName()));
  ExactRelation r=new ProjectedRelation(vc,newSource,newElems);
  r.setAliasName(getAlias());
  return r;
}

Fixed version (ground truth):
/** 
 * Inserts extra information if extra is set to true. The extra information is: 1. partition size. 
 * @param extra
 * @return
 */
protected ExactRelation rewriteWithPartition(boolean extra){
  ExactRelation newSource=source.rewriteWithPartition();
  List<SelectElem> newElems=new ArrayList<SelectElem>();
  Map<TableUniqueName,String> sub=source.tableSubstitution();
  int index=0;
  for (  SelectElem elem : elems) {
    if (!elem.getExpr().isagg()) {
      Expr newExpr=exprWithTableNamesSubstituted(elem.getExpr(),sub);
      SelectElem newElem=new SelectElem(newExpr,elem.getAlias());
      newElems.add(newElem);
    }
 else {
      Expr agg=((AggregatedRelation)newSource).getAggList().get(index++);
      agg=exprWithTableNamesSubstituted(agg,sub);
      newElems.add(new SelectElem(agg,elem.getAlias()));
    }
  }
  if (extra) {
    newElems.add(new SelectElem(FuncExpr.count(),partitionSizeAlias));
  }
  newElems.add(new SelectElem(newSource.partitionColumn(),partitionColumnName()));
  ExactRelation r=new ProjectedRelation(vc,newSource,newElems);
  r.setAliasName(getAlias());
  return r;
}
Program: 96119
Project: 96119
Buggy source:
@Override protected Map<TableUniqueName,String> tableSubstitution(){
  Map<TableUniqueName,String> s=ImmutableMap.of(param.originalTable,alias);
  return s;
}

Fixed version (ground truth):
/** 
 * Using this substitution pattern can handle: 1. user specified his own table alias and using it: no need for substitution since aliases are preserved. 2. user specified his own table alias but referring the raw table name: below pattern handles it. 3. user didn't specified table aliases: below pattern handles it.
 */
@Override protected Map<TableUniqueName,String> tableSubstitution(){
  Map<TableUniqueName,String> s=ImmutableMap.of(param.originalTable,alias);
  return s;
}
Program: 96120
Project: 96120
Buggy source:
public Relation call(Relation r){
  return r;
}

Fixed version (ground truth):
public Expr call(Expr expr){
  return expr;
}
Program: 96121
Project: 96121
Buggy source:
/** 
 * Makes connections to the 'data' DBMS and 'meta' DBMS.
 * @param conf
 * @throws VerdictException
 */
public VerdictContext(VerdictConf conf) throws VerdictException {
  this.conf=conf;
  dbms=Dbms.getInstance(this,conf.getDbms(),conf.getHost(),conf.getPort(),conf.getDbmsSchema(),(conf.getBoolean("String_Node_Str")) ? "String_Node_Str" : conf.getUser(),(conf.getBoolean("String_Node_Str")) ? "String_Node_Str" : conf.getPassword(),conf.get(conf.getDbms() + "String_Node_Str"));
  VerdictLogger.info((conf.getDbmsSchema() != null) ? String.format("String_Node_Str",conf.getDbms(),conf.getHost(),conf.getPort(),conf.getDbmsSchema()) : String.format("String_Node_Str",conf.getDbms(),conf.getHost(),conf.getPort()));
  metaDbms=dbms;
  meta=new VerdictMeta(this);
  if (conf.getDbmsSchema() != null) {
    meta.refreshSampleInfo(conf.getDbmsSchema());
  }
}

Fixed version (ground truth):
/** 
 * Makes connections to the 'data' DBMS and 'meta' DBMS.
 * @param conf
 * @throws VerdictException
 */
public VerdictContext(VerdictConf conf) throws VerdictException {
  this.conf=conf;
  dbms=Dbms.getInstance(this,conf.getDbms(),conf.getHost(),conf.getPort(),conf.getDbmsSchema(),(conf.getBoolean("String_Node_Str")) ? "String_Node_Str" : conf.getUser(),(conf.getBoolean("String_Node_Str")) ? "String_Node_Str" : conf.getPassword(),conf.get(conf.getDbms() + "String_Node_Str"));
  VerdictLogger.info((conf.getDbmsSchema() != null) ? String.format("String_Node_Str",conf.getDbms(),conf.getHost(),conf.getPort(),conf.getDbmsSchema()) : String.format("String_Node_Str",conf.getDbms(),conf.getHost(),conf.getPort()));
  metaDbms=dbms;
  meta=new VerdictMeta(this);
  if (conf.getDbmsSchema() != null) {
    meta.refreshSampleInfo(conf.getDbmsSchema());
  }
  this.contextId=ThreadLocalRandom.current().nextInt(0,10000);
}
Program: 96123
Project: 96123
Buggy source:
public TableUniqueName(String schemaName,String tableName){
  this.schemaName=schemaName;
  this.tableName=tableName;
}

Fixed version (ground truth):
public TableUniqueName(String schemaName,String tableName){
  this.schemaName=(schemaName != null) ? schemaName.toLowerCase() : schemaName;
  this.tableName=(tableName != null) ? tableName.toLowerCase() : tableName;
}
Program: 96124
Project: 96124
Buggy source:
protected TableUniqueName createTempTableExlucdingNameEntry(SampleParam param,TableUniqueName metaNameTableName) throws VerdictException {
  TableUniqueName tempTableName=generateTempTableName();
  TableUniqueName originalTableName=param.originalTable;
  executeUpdate(String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",tempTableName,metaNameTableName,originalTableName.schemaName,originalTableName.tableName,param.sampleType,samplingRatioToString(param.samplingRatio),columnNameListToString(param.columnNames)));
  return tempTableName;
}

Fixed version (ground truth):
protected TableUniqueName createTempTableExlucdingNameEntry(SampleParam param,TableUniqueName metaNameTableName) throws VerdictException {
  TableUniqueName tempTableName=Relation.getTempTableName(vc);
  TableUniqueName originalTableName=param.originalTable;
  executeUpdate(String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",tempTableName,metaNameTableName,originalTableName.schemaName,originalTableName.tableName,param.sampleType,samplingRatioToString(param.samplingRatio),columnNameListToString(param.columnNames)));
  return tempTableName;
}
Program: 96125
Project: 96125
Buggy source:
protected TableUniqueName createTempTableWithRand(TableUniqueName originalTableName) throws VerdictException {
  TableUniqueName tempTableName=generateTempTableName();
  VerdictLogger.debug(this,"String_Node_Str" + tempTableName);
  executeUpdate(String.format("String_Node_Str",tempTableName,originalTableName));
  VerdictLogger.debug(this,"String_Node_Str");
  return tempTableName;
}

Fixed version (ground truth):
protected TableUniqueName createTempTableWithRand(TableUniqueName originalTableName) throws VerdictException {
  TableUniqueName tempTableName=Relation.getTempTableName(vc);
  VerdictLogger.debug(this,"String_Node_Str" + tempTableName);
  executeUpdate(String.format("String_Node_Str",tempTableName,originalTableName));
  VerdictLogger.debug(this,"String_Node_Str");
  return tempTableName;
}
Program: 96128
Project: 96128
Buggy source:
protected TableUniqueName createTempTableExlucdingSizeEntry(SampleParam param,TableUniqueName metaSizeTableName) throws VerdictException {
  TableUniqueName tempTableName=generateTempTableName();
  TableUniqueName sampleTableName=param.sampleTableName();
  executeUpdate(String.format("String_Node_Str",tempTableName,metaSizeTableName,sampleTableName.schemaName,sampleTableName.tableName));
  return tempTableName;
}

Fixed version (ground truth):
protected TableUniqueName createTempTableExlucdingSizeEntry(SampleParam param,TableUniqueName metaSizeTableName) throws VerdictException {
  TableUniqueName tempTableName=Relation.getTempTableName(vc);
  TableUniqueName sampleTableName=param.sampleTableName();
  executeUpdate(String.format("String_Node_Str",tempTableName,metaSizeTableName,sampleTableName.schemaName,sampleTableName.tableName));
  return tempTableName;
}
Program: 96129
Project: 96129
Buggy source:
public static String genTableAlias(){
  String n=String.format("String_Node_Str",alias_no);
  alias_no++;
  return n;
}

Fixed version (ground truth):
public static String genTableAlias(){
  String n=String.format("String_Node_Str",tab_alias_no);
  tab_alias_no++;
  return n;
}
Program: 96130
Project: 96130
Buggy source:
public static String genColumnAlias(){
  String n=String.format("String_Node_Str",alias_no);
  alias_no++;
  return n;
}

Fixed version (ground truth):
public static String genColumnAlias(){
  String n=String.format("String_Node_Str",col_alias_no);
  col_alias_no++;
  return n;
}
Program: 96131
Project: 96131
Buggy source:
public ColNameExpr(String col,String tab,String schema){
  this.col=col;
  this.tab=tab;
  this.schema=schema;
}

Fixed version (ground truth):
public ColNameExpr(String col,String tab,String schema){
  this.col=col.toLowerCase();
  this.tab=(tab != null) ? tab.toLowerCase() : tab;
  this.schema=(schema != null) ? schema.toLowerCase() : schema;
}
Program: 96132
Project: 96132
Buggy source:
@AfterClass public static void destroy() throws VerdictException {
  vc.destroy();
}

Fixed version (ground truth):
@AfterClass public static void destroy() throws VerdictException, SQLException {
  stmt.close();
  conn.close();
  vc.destroy();
}
Program: 96133
Project: 96133
Buggy source:
@BeforeClass public static void connect() throws VerdictException, SQLException, FileNotFoundException {
  final String host=readHost();
  final String port="String_Node_Str";
  final String schema="String_Node_Str";
  VerdictConf conf=new VerdictConf();
  conf.setDbms("String_Node_Str");
  conf.setHost(host);
  conf.setPort(port);
  conf.setDbmsSchema(schema);
  conf.set("String_Node_Str","String_Node_Str");
  vc=new VerdictContext(conf);
  String url=String.format("String_Node_Str",host,port,schema);
  Connection conn=DriverManager.getConnection(url);
  stmt=conn.createStatement();
}

Fixed version (ground truth):
@BeforeClass public static void connect() throws VerdictException, SQLException, FileNotFoundException {
  final String host=readHost();
  final String port="String_Node_Str";
  final String schema="String_Node_Str";
  VerdictConf conf=new VerdictConf();
  conf.setDbms("String_Node_Str");
  conf.setHost(host);
  conf.setPort(port);
  conf.setDbmsSchema(schema);
  conf.set("String_Node_Str","String_Node_Str");
  vc=new VerdictContext(conf);
  String url=String.format("String_Node_Str",host,port,schema);
  conn=DriverManager.getConnection(url);
  stmt=conn.createStatement();
}
Program: 96134
Project: 96134
Buggy source:
@BeforeClass public static void connect() throws VerdictException, SQLException, FileNotFoundException {
  final String host=readHost();
  final String port="String_Node_Str";
  final String schema="String_Node_Str";
  VerdictConf conf=new VerdictConf();
  conf.setDbms("String_Node_Str");
  conf.setHost(host);
  conf.setPort(port);
  conf.setDbmsSchema(schema);
  conf.set("String_Node_Str","String_Node_Str");
  vc=new VerdictContext(conf);
  String url=String.format("String_Node_Str",host,port,schema);
  Connection conn=DriverManager.getConnection(url);
  stmt=conn.createStatement();
}

Fixed version (ground truth):
@BeforeClass public static void connect() throws VerdictException, SQLException, FileNotFoundException {
  final String host=readHost();
  final String port="String_Node_Str";
  final String schema="String_Node_Str";
  VerdictConf conf=new VerdictConf();
  conf.setDbms("String_Node_Str");
  conf.setHost(host);
  conf.setPort(port);
  conf.setDbmsSchema(schema);
  conf.set("String_Node_Str","String_Node_Str");
  vc=new VerdictContext(conf);
  String url=String.format("String_Node_Str",host,port,schema);
  conn=DriverManager.getConnection(url);
  stmt=conn.createStatement();
}
Program: 96136
Project: 96136
Buggy source:
@Override public ExactRelation rewriteForPointEstimate(){
  List<SelectElem> scaled=new ArrayList<SelectElem>();
  List<TableUniqueName> stratifiedSampleTables=source.accumulateStratifiedSamples();
  for (  SelectElem e : elems) {
    scaled.add(new SelectElem(transformForSingleFunction(e.getExpr(),stratifiedSampleTables),e.getAlias()));
  }
  ExactRelation r=new AggregatedRelation(vc,source.rewriteForPointEstimate(),scaled);
  r.setAliasName(getAliasName());
  return r;
}

Fixed version (ground truth):
@Override public ExactRelation rewriteForPointEstimate(){
  ExactRelation newSource=source.rewriteForPointEstimate();
  List<SelectElem> scaled=new ArrayList<SelectElem>();
  List<ColNameExpr> samplingProbColumns=newSource.accumulateSamplingProbColumns();
  for (  SelectElem e : elems) {
    scaled.add(new SelectElem(transformForSingleFunction(e.getExpr(),samplingProbColumns),e.getAlias()));
  }
  ExactRelation r=new AggregatedRelation(vc,newSource,scaled);
  r.setAliasName(getAliasName());
  return r;
}
Program: 96138
Project: 96138
Buggy source:
public Expr call(Expr expr){
  if (expr instanceof FuncExpr) {
    FuncExpr f=(FuncExpr)expr;
    FuncExpr s=(FuncExpr)exprWithTableNamesSubstituted(expr,sub);
    double samplingProb=source.samplingProbabilityFor(f);
    if (f.getFuncName().equals(FuncExpr.FuncName.COUNT)) {
      Expr est=FuncExpr.sum(scaleForSampling(samplingProb,stratifiedSampleTables));
      return FuncExpr.round(est);
    }
 else     if (f.getFuncName().equals(FuncExpr.FuncName.COUNT_DISTINCT)) {
      String dbname=vc.getDbms().getName();
      if (dbname.equals("String_Node_Str")) {
        return FuncExpr.round(BinaryOpExpr.from(new FuncExpr(FuncExpr.FuncName.IMPALA_APPROX_COUNT_DISTINCT,s.getUnaryExpr()),ConstantExpr.from(1.0 / samplingProb),"String_Node_Str"));
      }
 else {
        return FuncExpr.round(BinaryOpExpr.from(s,ConstantExpr.from(1.0 / samplingProb),"String_Node_Str"));
      }
    }
 else     if (f.getFuncName().equals(FuncExpr.FuncName.SUM)) {
      Expr est=scaleForSampling(samplingProb,stratifiedSampleTables);
      est=FuncExpr.sum(BinaryOpExpr.from(s.getUnaryExpr(),est,"String_Node_Str"));
      return est;
    }
 else     if (f.getFuncName().equals(FuncExpr.FuncName.AVG)) {
      Expr scale=scaleForSampling(samplingProb,stratifiedSampleTables);
      Expr sumEst=FuncExpr.sum(BinaryOpExpr.from(s.getUnaryExpr(),scale,"String_Node_Str"));
      Expr countEst=countNotNull(s.getUnaryExpr(),scale);
      return BinaryOpExpr.from(sumEst,countEst,"String_Node_Str");
    }
 else {
      return s;
    }
  }
 else {
    return expr;
  }
}

Fixed version (ground truth):
public Expr call(Expr expr){
  if (expr instanceof FuncExpr) {
    FuncExpr f=(FuncExpr)expr;
    FuncExpr s=(FuncExpr)exprWithTableNamesSubstituted(expr,sub);
    double samplingProb=source.samplingProbabilityFor(f);
    if (f.getFuncName().equals(FuncExpr.FuncName.COUNT)) {
      Expr est=FuncExpr.sum(scaleForSampling(samplingProb,samplingProbCols));
      return FuncExpr.round(est);
    }
 else     if (f.getFuncName().equals(FuncExpr.FuncName.COUNT_DISTINCT)) {
      String dbname=vc.getDbms().getName();
      if (dbname.equals("String_Node_Str")) {
        return FuncExpr.round(BinaryOpExpr.from(new FuncExpr(FuncExpr.FuncName.IMPALA_APPROX_COUNT_DISTINCT,s.getUnaryExpr()),ConstantExpr.from(1.0 / samplingProb),"String_Node_Str"));
      }
 else {
        return FuncExpr.round(BinaryOpExpr.from(s,ConstantExpr.from(1.0 / samplingProb),"String_Node_Str"));
      }
    }
 else     if (f.getFuncName().equals(FuncExpr.FuncName.SUM)) {
      Expr est=scaleForSampling(samplingProb,samplingProbCols);
      est=FuncExpr.sum(BinaryOpExpr.from(s.getUnaryExpr(),est,"String_Node_Str"));
      return est;
    }
 else     if (f.getFuncName().equals(FuncExpr.FuncName.AVG)) {
      Expr scale=scaleForSampling(samplingProb,samplingProbCols);
      Expr sumEst=FuncExpr.sum(BinaryOpExpr.from(s.getUnaryExpr(),scale,"String_Node_Str"));
      Expr countEst=countNotNull(s.getUnaryExpr(),scale);
      return BinaryOpExpr.from(sumEst,countEst,"String_Node_Str");
    }
 else {
      return s;
    }
  }
 else {
    return expr;
  }
}
Program: 96139
Project: 96139
Buggy source:
private Expr scaleForSampling(double samplingProb,List<TableUniqueName> stratifiedSampleTables){
  Expr scale=ConstantExpr.from(1.0 / samplingProb);
  for (  TableUniqueName t : stratifiedSampleTables) {
    scale=BinaryOpExpr.from(scale,new ColNameExpr(vc.samplingProbColName(),t.tableName),"String_Node_Str");
  }
  return scale;
}

Fixed version (ground truth):
private Expr scaleForSampling(double samplingProb,List<ColNameExpr> samplingProbCols){
  Expr scale=ConstantExpr.from(1.0 / samplingProb);
  for (  ColNameExpr c : samplingProbCols) {
    scale=BinaryOpExpr.from(scale,c,"String_Node_Str");
  }
  return scale;
}
Program: 96140
Project: 96140
Buggy source:
/** 
 * This relation must include partition numbers, and the answers must be scaled properly. Note that   {@link ApproxRelation#rewriteWithSubsampledErrorBounds()}is used only for the statement including final error bounds; all internal manipulations must be performed by this method.
 * @return
 */
protected ExactRelation rewriteWithPartition(){
  ExactRelation newSource=partitionedSource();
  List<SelectElem> scaledElems=new ArrayList<SelectElem>();
  List<TableUniqueName> stratifiedSampleTables=source.accumulateStratifiedSamples();
  List<ColNameExpr> groupby=new ArrayList<ColNameExpr>();
  if (source instanceof ApproxGroupedRelation) {
    groupby.addAll(((ApproxGroupedRelation)source).getGroupby());
  }
  for (  SelectElem e : elems) {
    Expr scaled=transformForSingleFunctionWithPartitionSize(e.getExpr(),stratifiedSampleTables,groupby,newSource.partitionColumn());
    scaledElems.add(new SelectElem(scaled,e.getAlias()));
  }
  scaledElems.add(new SelectElem(FuncExpr.count(),partitionSizeAlias));
  ExactRelation r=new AggregatedRelation(vc,newSource,scaledElems);
  return r;
}

Fixed version (ground truth):
/** 
 * This relation must include partition numbers, and the answers must be scaled properly. Note that   {@link ApproxRelation#rewriteWithSubsampledErrorBounds()}is used only for the statement including final error bounds; all internal manipulations must be performed by this method.
 * @return
 */
protected ExactRelation rewriteWithPartition(){
  ExactRelation newSource=partitionedSource();
  List<SelectElem> scaledElems=new ArrayList<SelectElem>();
  List<ColNameExpr> samplingProbCols=newSource.accumulateSamplingProbColumns();
  List<ColNameExpr> groupby=new ArrayList<ColNameExpr>();
  if (source instanceof ApproxGroupedRelation) {
    groupby.addAll(((ApproxGroupedRelation)source).getGroupby());
  }
  for (  SelectElem e : elems) {
    Expr scaled=transformForSingleFunctionWithPartitionSize(e.getExpr(),samplingProbCols,groupby,newSource.partitionColumn());
    scaledElems.add(new SelectElem(scaled,e.getAlias()));
  }
  scaledElems.add(new SelectElem(FuncExpr.count(),partitionSizeAlias));
  ExactRelation r=new AggregatedRelation(vc,newSource,scaledElems);
  return r;
}
Program: 96141
Project: 96141
Buggy source:
public ApproxFilteredRelation(VerdictContext vc,ApproxRelation source,Cond cond){
  super(vc);
  this.source=source;
  this.cond=cond;
}

Fixed version (ground truth):
public ApproxFilteredRelation(VerdictContext vc,ApproxRelation source,Cond cond){
  super(vc);
  this.source=source;
  this.cond=cond;
  this.alias=source.alias;
}
Program: 96142
Project: 96142
Buggy source:
@Override public ExactRelation rewriteWithPartition(){
  Pair<Cond,List<ApproxRelation>> modifiedCondWithRelToJoin=transformCondWithPartitionedRelations(cond,tableSubstitution());
  Cond modifiedCond=modifiedCondWithRelToJoin.getLeft();
  List<ApproxRelation> relToJoin=modifiedCondWithRelToJoin.getRight();
  ExactRelation joinedSource=source.rewriteWithPartition();
  for (  ApproxRelation a : relToJoin) {
    List<Pair<Expr,Expr>> joinCol=Arrays.asList(Pair.<Expr,Expr>of(source.partitionColumn(),new ColNameExpr(partitionColumnName(),a.sourceTableName())));
    joinedSource=JoinedRelation.from(vc,joinedSource,a.rewriteWithPartition(),joinCol);
  }
  ExactRelation r=new FilteredRelation(vc,joinedSource,modifiedCond);
  r.setAliasName(getAliasName());
  return r;
}

Fixed version (ground truth):
@Override public ExactRelation rewriteWithPartition(){
  Pair<Cond,List<ApproxRelation>> modifiedCondWithRelToJoin=transformCondWithPartitionedRelations(cond,tableSubstitution());
  Cond modifiedCond=modifiedCondWithRelToJoin.getLeft();
  List<ApproxRelation> relToJoin=modifiedCondWithRelToJoin.getRight();
  ExactRelation joinedSource=source.rewriteWithPartition();
  for (  ApproxRelation a : relToJoin) {
    List<Pair<Expr,Expr>> joinCol=Arrays.asList(Pair.<Expr,Expr>of(joinedSource.partitionColumn(),new ColNameExpr(partitionColumnName(),a.sourceTableName())));
    joinedSource=JoinedRelation.from(vc,joinedSource,a.rewriteWithPartition(),joinCol);
  }
  ExactRelation r=new FilteredRelation(vc,joinedSource,modifiedCond);
  r.setAliasName(getAliasName());
  return r;
}
Program: 96143
Project: 96143
Buggy source:
public ApproxGroupedRelation(VerdictContext vc,ApproxRelation source,List<ColNameExpr> groupby){
  super(vc);
  this.source=source;
  this.groupby=groupby;
}

Fixed version (ground truth):
public ApproxGroupedRelation(VerdictContext vc,ApproxRelation source,List<ColNameExpr> groupby){
  super(vc);
  this.source=source;
  this.groupby=groupby;
  this.alias=source.alias;
}
Program: 96144
Project: 96144
Buggy source:
/** 
 * @param vc
 * @param source1
 * @param source2
 * @param joinCols An empty joinCols indicates CROSS JOIN
 */
public ApproxJoinedRelation(VerdictContext vc,ApproxRelation source1,ApproxRelation source2,List<Pair<Expr,Expr>> joinCols){
  super(vc);
  this.source1=source1;
  this.source2=source2;
  if (joinCols == null) {
    this.joinCols=new ArrayList<Pair<Expr,Expr>>();
  }
 else {
    this.joinCols=joinCols;
  }
}

Fixed version (ground truth):
/** 
 * @param vc
 * @param source1
 * @param source2
 * @param joinCols An empty joinCols indicates CROSS JOIN
 */
public ApproxJoinedRelation(VerdictContext vc,ApproxRelation source1,ApproxRelation source2,List<Pair<Expr,Expr>> joinCols){
  super(vc);
  this.source1=source1;
  this.source2=source2;
  if (joinCols == null) {
    this.joinCols=new ArrayList<Pair<Expr,Expr>>();
  }
 else {
    this.joinCols=joinCols;
  }
  this.alias=null;
}
Program: 96145
Project: 96145
Buggy source:
public ApproxLimitedRelation(VerdictContext vc,ApproxRelation source,long limit){
  super(vc);
  this.source=source;
  this.limit=limit;
}

Fixed version (ground truth):
public ApproxLimitedRelation(VerdictContext vc,ApproxRelation source,long limit){
  super(vc);
  this.source=source;
  this.limit=limit;
  this.alias=source.alias;
}
Program: 96146
Project: 96146
Buggy source:
public ApproxOrderedRelation(VerdictContext vc,ApproxRelation source,List<OrderByExpr> orderby){
  super(vc);
  this.source=source;
  this.orderby=orderby;
}

Fixed version (ground truth):
public ApproxOrderedRelation(VerdictContext vc,ApproxRelation source,List<OrderByExpr> orderby){
  super(vc);
  this.source=source;
  this.orderby=orderby;
  this.alias=source.alias;
}
Program: 96147
Project: 96147
Buggy source:
public FilteredRelation(VerdictContext vc,ExactRelation source,Cond cond){
  super(vc);
  this.source=source;
  this.cond=cond;
}

Fixed version (ground truth):
public FilteredRelation(VerdictContext vc,ExactRelation source,Cond cond){
  super(vc);
  this.source=source;
  this.cond=cond;
  this.alias=source.alias;
}
Program: 96148
Project: 96148
Buggy source:
@Override public String visitSelect_list_elem(VerdictSQLParser.Select_list_elemContext ctx){
  select_list_elem_num++;
  String newSelectListElem=null;
  Pair<String,Alias> colName2Alias=null;
  if (ctx.getText().equals("String_Node_Str")) {
    newSelectListElem="String_Node_Str";
  }
 else {
    StringBuilder elem=new StringBuilder();
    elem.append(visit(ctx.expression()));
    SelectStatementBaseRewriter baseRewriter=new SelectStatementBaseRewriter(queryString);
    String colName=baseRewriter.visit(ctx.expression());
    if (ctx.column_alias() != null) {
      Alias alias=new Alias(colName,ctx.column_alias().getText());
      elem.append(String.format("String_Node_Str",alias));
      colName2Alias=Pair.of(colName,alias);
    }
 else {
      Alias alias=Alias.genAlias(depth,colName);
      elem.append(String.format("String_Node_Str",alias));
      colName2Alias=Pair.of(baseRewriter.visit(ctx.expression()),alias);
    }
    newSelectListElem=elem.toString();
  }
  colName2Aliases.add(Pair.of(colName2Alias.getKey(),colName2Alias.getValue()));
  return newSelectListElem;
}

Fixed version (ground truth):
@Override public String visitSelect_list_elem(VerdictSQLParser.Select_list_elemContext ctx){
  select_list_elem_num++;
  String newSelectListElem=null;
  Pair<String,Alias> colName2Alias=null;
  if (ctx.getText().equals("String_Node_Str")) {
    newSelectListElem="String_Node_Str";
  }
 else {
    StringBuilder elem=new StringBuilder();
    SelectStatementBaseRewriter baseRewriter=new SelectStatementBaseRewriter(queryString);
    String tabColName=baseRewriter.visit(ctx.expression());
    String tabName=NameHelpers.tabNameOfColName(tabColName);
    TableUniqueName tabUniqueName=NameHelpers.tabUniqueNameOfColName(vc,tabColName);
    String colName=NameHelpers.colNameOfColName(tabColName);
    if (tableAliases.containsKey(tabUniqueName)) {
      tabName=tableAliases.get(tabUniqueName).toString();
    }
    for (    Map.Entry<String,Map<String,Alias>> e : derivedTableColName2Aliases.entrySet()) {
      String derivedTabName=e.getKey();
      if (tabName.length() > 0 && !tabName.equals(derivedTabName)) {
        continue;
      }
      if (e.getValue().containsKey(colName)) {
        Alias alias=e.getValue().get(colName);
        if (alias.autoGenerated()) {
          colName=alias.toString();
        }
      }
    }
    if (tabName.length() > 0) {
      elem.append(String.format("String_Node_Str",tabName,colName));
    }
 else {
      elem.append(colName);
    }
    if (ctx.column_alias() != null) {
      Alias alias=new Alias(colName,ctx.column_alias().getText());
      elem.append(String.format("String_Node_Str",alias));
      colName2Alias=Pair.of(colName,alias);
    }
 else {
      Alias alias=Alias.genAlias(depth,colName);
      elem.append(String.format("String_Node_Str",alias));
      colName2Alias=Pair.of(baseRewriter.visit(ctx.expression()),alias);
    }
    newSelectListElem=elem.toString();
  }
  colName2Aliases.add(Pair.of(colName2Alias.getKey(),colName2Alias.getValue()));
  return newSelectListElem;
}
Program: 96149
Project: 96149
Buggy source:
@Override public String visitGroup_by_item(VerdictSQLParser.Group_by_itemContext ctx){
  String groupName=ctx.getText();
  Alias alias=new Alias(groupName,groupName);
  for (  Pair<String,Alias> e : colName2Aliases) {
    if (e.getKey().equals(groupName)) {
      alias=e.getValue();
      break;
    }
  }
  if (isFirstGroup) {
    isFirstGroup=false;
    return alias.toString();
  }
 else {
    return "String_Node_Str" + alias;
  }
}

Fixed version (ground truth):
@Override public String visitGroup_by_item(VerdictSQLParser.Group_by_itemContext ctx){
  String groupName=ctx.getText();
  Alias alias=new Alias(groupName,groupName);
  for (  Pair<String,Alias> e : colName2Aliases) {
    if (NameHelpers.colNameOfColName(e.getKey()).equals(groupName)) {
      alias=e.getValue();
      break;
    }
  }
  if (isFirstGroup) {
    isFirstGroup=false;
    return alias.toString();
  }
 else {
    return "String_Node_Str" + alias;
  }
}
Program: 96150
Project: 96150
Buggy source:
public AnalyticSelectStatementRewriter(VerdictContext vc,String queryString){
  super(queryString);
  this.vc=vc;
  this.e=null;
  aggColumnIndicator=new ArrayList<Boolean>();
  colName2Aliases=new ArrayList<Pair<String,Alias>>();
  meanColIndex2ErrColIndex=new HashMap<Integer,Integer>();
}

Fixed version (ground truth):
public AnalyticSelectStatementRewriter(VerdictContext vc,String queryString){
  super(queryString);
  this.vc=vc;
  this.e=null;
  aggColumnIndicator=new ArrayList<Boolean>();
  colName2Aliases=new ArrayList<Pair<String,Alias>>();
  meanColIndex2ErrColIndex=new HashMap<Integer,Integer>();
  derivedTableColName2Aliases=new HashMap<String,Map<String,Alias>>();
}
Program: 96151
Project: 96151
Buggy source:
protected Pair<String,AnalyticSelectStatementRewriter> rewriteQuery() throws VerdictException {
  VerdictSQLLexer l=new VerdictSQLLexer(CharStreams.fromString(queryString));
  VerdictSQLParser p=new VerdictSQLParser(new CommonTokenStream(l));
  AnalyticSelectStatementRewriter queryRewriter=new BootstrapSelectStatementRewriter(vc,queryString);
  String rewrittenQuery=queryRewriter.visit(p.select_statement());
  if (queryRewriter.getException() != null) {
    throw queryRewriter.getException();
  }
  return Pair.of(rewrittenQuery,queryRewriter);
}

Fixed version (ground truth):
protected Pair<String,AnalyticSelectStatementRewriter> rewriteQuery() throws VerdictException {
  VerdictSQLLexer l=new VerdictSQLLexer(CharStreams.fromString(queryString));
  VerdictSQLParser p=new VerdictSQLParser(new CommonTokenStream(l));
  AnalyticSelectStatementRewriter queryRewriter=null;
  if (vc.getConf().get("String_Node_Str").equals("String_Node_Str")) {
    queryRewriter=new BootstrapSelectStatementRewriter(vc,queryString);
  }
 else {
    queryRewriter=new AnalyticSelectStatementRewriter(vc,queryString);
  }
  String rewrittenQuery=queryRewriter.visit(p.select_statement());
  if (queryRewriter.getException() != null) {
    throw queryRewriter.getException();
  }
  return Pair.of(rewrittenQuery,queryRewriter);
}
Program: 96152
Project: 96152
Buggy source:
@Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder,int position){
  int viewType=getItemViewType(position);
switch (viewType) {
case VIEW_TYPE_ITEM:
    CommentViewHolder cvh=(CommentViewHolder)viewHolder;
  MyComment comment=(MyComment)getItemAt(position);
cvh.authorTextView.setText(comment.author);
cvh.commentTextView.setText(comment.comment);
if (comment.getIndentation() == 0) {
cvh.colorBand.setVisibility(View.GONE);
}
 else {
cvh.colorBand.setVisibility(View.VISIBLE);
cvh.setColorBandColor(comment.getIndentation());
int leftPadding=Utils.getPaddingPixels(mContext,mPaddingDP) * (comment.getIndentation() - 1);
cvh.setPaddingLeft(leftPadding);
}
if (comment.isGroup()) {
cvh.hiddenCommentsCountTextView.setVisibility(View.VISIBLE);
cvh.hiddenCommentsCountTextView.setText(Integer.toString(comment.getGroupSize()));
}
 else {
cvh.hiddenCommentsCountTextView.setVisibility(View.GONE);
}
break;
case VIEW_TYPE_CONTENT:
ContentViewHolder contentVH=(ContentViewHolder)viewHolder;
MyContent content=(MyContent)getItemAt(position);
contentVH.contentTextView.setText(content.content);
break;
default :
throw new IllegalStateException("String_Node_Str");
}
}

Fixed version (ground truth):
@Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder,int position){
  int viewType=getItemViewType(position);
switch (viewType) {
case VIEW_TYPE_ITEM:
    CommentViewHolder cvh=(CommentViewHolder)viewHolder;
  MyComment comment=(MyComment)getItemAt(position);
cvh.authorTextView.setText(comment.author);
cvh.commentTextView.setText(comment.comment);
if (comment.getIndentation() == 0) {
cvh.colorBand.setVisibility(View.GONE);
cvh.setPaddingLeft(0);
}
 else {
cvh.colorBand.setVisibility(View.VISIBLE);
cvh.setColorBandColor(comment.getIndentation());
int leftPadding=Utils.getPaddingPixels(mContext,mPaddingDP) * (comment.getIndentation() - 1);
cvh.setPaddingLeft(leftPadding);
}
if (comment.isGroup()) {
cvh.hiddenCommentsCountTextView.setVisibility(View.VISIBLE);
cvh.hiddenCommentsCountTextView.setText(Integer.toString(comment.getGroupSize()));
}
 else {
cvh.hiddenCommentsCountTextView.setVisibility(View.GONE);
}
break;
case VIEW_TYPE_CONTENT:
ContentViewHolder contentVH=(ContentViewHolder)viewHolder;
MyContent content=(MyContent)getItemAt(position);
contentVH.contentTextView.setText(content.content);
break;
default :
throw new IllegalStateException("String_Node_Str");
}
}
Program: 96154
Project: 96154
Buggy source:
@Override public String getCommitFromTag(String tag){
  try (Git git=openRepository()){
    Repository repo=git.getRepository();
    Iterable<RevCommit> commits=git.log().add(repo.resolve(tag)).call();
    for (    RevCommit commit : commits) {
      return commit.getName().toString();
    }
    throw new RuntimeException("String_Node_Str" + tag);
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + tag,e);
  }
}

Fixed version (ground truth):
@Override public String getCommitFromTag(String tag){
  try (Git git=openRepository()){
    Repository repo=git.getRepository();
    Iterable<RevCommit> commits=git.log().add(getActualRefObjectId(repo.findRef(tag),repo)).call();
    for (    RevCommit commit : commits) {
      return commit.getName().toString();
    }
    throw new RuntimeException("String_Node_Str" + tag);
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + tag,e);
  }
}
Program: 96155
Project: 96155
Buggy source:
@Test public void getCommitsBetween2Revisions(){
  TestVisitor visitor=new TestVisitor();
  String from="String_Node_Str";
  String to="String_Node_Str";
  new RepositoryMining().in(GitRepository.singleProject(path)).through(Commits.betweenTags(from,to)).process(visitor).mine();
  Assert.assertEquals(3,visitor.getVisitedHashes().size());
  Assert.assertEquals("String_Node_Str",visitor.getVisitedHashes().get(0));
  Assert.assertEquals("String_Node_Str",visitor.getVisitedHashes().get(1));
  Assert.assertEquals("String_Node_Str",visitor.getVisitedHashes().get(2));
}

Fixed version (ground truth):
@Test public void getCommitsBetween2Revisions(){
  TestVisitor visitor=new TestVisitor();
  String from="String_Node_Str";
  String to="String_Node_Str";
  new RepositoryMining().in(GitRepository.singleProject(path)).through(Commits.betweenTags(from,to)).process(visitor).mine();
  Assert.assertEquals(5,visitor.getVisitedHashes().size());
  Assert.assertEquals("String_Node_Str",visitor.getVisitedHashes().get(0));
  Assert.assertEquals("String_Node_Str",visitor.getVisitedHashes().get(1));
  Assert.assertEquals("String_Node_Str",visitor.getVisitedHashes().get(2));
  Assert.assertEquals("String_Node_Str",visitor.getVisitedHashes().get(3));
  Assert.assertEquals("String_Node_Str",visitor.getVisitedHashes().get(4));
}
Program: 96156
Project: 96156
Buggy source:
@Override public synchronized void write(Object... line){
  boolean first=true;
  for (  Object o : line) {
    if (!first)     ps.print("String_Node_Str");
    String field=o.toString();
    field=StringEscapeUtils.escapeCsv(field);
    ps.print(field);
    first=false;
  }
  ps.println();
  ps.flush();
}

Fixed version (ground truth):
@Override public synchronized void write(Object... line){
  boolean first=true;
  for (  Object o : line) {
    if (!first)     ps.print("String_Node_Str");
    if (o == null)     ps.print("String_Node_Str");
 else {
      String field=o.toString();
      field=StringEscapeUtils.escapeCsv(field);
      ps.print(field);
    }
    first=false;
  }
  ps.println();
  ps.flush();
}
Program: 96157
Project: 96157
Buggy source:
private List<DiffEntry> diffsForTheCommit(Repository repo,RevCommit commit) throws IOException, AmbiguousObjectException, IncorrectObjectTypeException {
  AnyObjectId hash=repo.resolve(commit.getName());
  AnyObjectId parent=commit.getParentCount() > 0 ? repo.resolve(commit.getParent(0).getName()) : null;
  DiffFormatter df=new DiffFormatter(DisabledOutputStream.INSTANCE);
  df.setRepository(repo);
  df.setDiffComparator(RawTextComparator.DEFAULT);
  df.setDetectRenames(true);
  List<DiffEntry> diffs=null;
  if (parent == null) {
    RevWalk rw=new RevWalk(repo);
    diffs=df.scan(new EmptyTreeIterator(),new CanonicalTreeParser(null,rw.getObjectReader(),commit.getTree()));
    rw.release();
  }
 else {
    diffs=df.scan(hash,parent);
  }
  df.release();
  return diffs;
}

Fixed version (ground truth):
private List<DiffEntry> diffsForTheCommit(Repository repo,RevCommit commit) throws IOException, AmbiguousObjectException, IncorrectObjectTypeException {
  AnyObjectId currentCommit=repo.resolve(commit.getName());
  AnyObjectId parentCommit=commit.getParentCount() > 0 ? repo.resolve(commit.getParent(0).getName()) : null;
  DiffFormatter df=new DiffFormatter(DisabledOutputStream.INSTANCE);
  df.setRepository(repo);
  df.setDiffComparator(RawTextComparator.DEFAULT);
  df.setDetectRenames(true);
  List<DiffEntry> diffs=null;
  if (parentCommit == null) {
    RevWalk rw=new RevWalk(repo);
    diffs=df.scan(new EmptyTreeIterator(),new CanonicalTreeParser(null,rw.getObjectReader(),commit.getTree()));
    rw.release();
  }
 else {
    diffs=df.scan(parentCommit,currentCommit);
  }
  df.release();
  return diffs;
}
Program: 96159
Project: 96159
Buggy source:
public WishlistComponentCursor queryWishlistComponent(long wc_id,long item_id){
  String[] wcColumns=null;
  String wcSelection="String_Node_Str" + S.COLUMN_WISHLIST_COMPONENT_WISHLIST_ID + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ S.COLUMN_WISHLIST_COMPONENT_COMPONENT_ID+ "String_Node_Str";
  String[] wcSelectionArgs=new String[]{String.valueOf(wc_id),String.valueOf(item_id)};
  String wcGroupBy=null;
  String wcHaving=null;
  String wcOrderBy=null;
  String wcLimit=null;
  SQLiteQueryBuilder qb=builderWishlistComponent();
  Cursor cursor=qb.query(getReadableDatabase(),wcColumns,wcSelection,wcSelectionArgs,wcGroupBy,wcHaving,wcOrderBy,wcLimit);
  return new WishlistComponentCursor(cursor);
}

Fixed version (ground truth):
public WishlistComponentCursor queryWishlistComponent(long wc_id,long item_id){
  String[] wcColumns=null;
  String wcSelection="String_Node_Str" + S.COLUMN_WISHLIST_COMPONENT_WISHLIST_ID + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ S.COLUMN_WISHLIST_COMPONENT_COMPONENT_ID+ "String_Node_Str";
  String[] wcSelectionArgs=new String[]{String.valueOf(wc_id),String.valueOf(item_id)};
  String wcGroupBy=null;
  String wcHaving=null;
  String wcOrderBy=null;
  String wcLimit=null;
  SQLiteQueryBuilder qb=builderWishlistComponent();
  Cursor cursor=qb.query(getWritableDatabase(),wcColumns,wcSelection,wcSelectionArgs,wcGroupBy,wcHaving,wcOrderBy,wcLimit);
  return new WishlistComponentCursor(cursor);
}
Program: 96161
Project: 96161
Buggy source:
public WishlistComponentCursor queryWishlistComponents(long id){
  String[] wcColumns=null;
  String wcSelection="String_Node_Str" + S.COLUMN_WISHLIST_COMPONENT_WISHLIST_ID + "String_Node_Str";
  String[] wcSelectionArgs=new String[]{String.valueOf(id)};
  String wcGroupBy=null;
  String wcHaving=null;
  String wcOrderBy="String_Node_Str" + S.COLUMN_WISHLIST_COMPONENT_COMPONENT_ID + "String_Node_Str";
  String wcLimit=null;
  SQLiteQueryBuilder qb=builderWishlistComponent();
  Cursor cursor=qb.query(getReadableDatabase(),wcColumns,wcSelection,wcSelectionArgs,wcGroupBy,wcHaving,wcOrderBy,wcLimit);
  return new WishlistComponentCursor(cursor);
}

Fixed version (ground truth):
public WishlistComponentCursor queryWishlistComponents(long id){
  String[] wcColumns=null;
  String wcSelection="String_Node_Str" + S.COLUMN_WISHLIST_COMPONENT_WISHLIST_ID + "String_Node_Str";
  String[] wcSelectionArgs=new String[]{String.valueOf(id)};
  String wcGroupBy=null;
  String wcHaving=null;
  String wcOrderBy="String_Node_Str" + S.COLUMN_WISHLIST_COMPONENT_COMPONENT_ID + "String_Node_Str";
  String wcLimit=null;
  SQLiteQueryBuilder qb=builderWishlistComponent();
  Cursor cursor=qb.query(getWritableDatabase(),wcColumns,wcSelection,wcSelectionArgs,wcGroupBy,wcHaving,wcOrderBy,wcLimit);
  return new WishlistComponentCursor(cursor);
}
Program: 96163
Project: 96163
Buggy source:
public WishlistComponentCursor queryWishlistComponentId(long id){
  String[] wcColumns=null;
  String wcSelection="String_Node_Str" + S.COLUMN_WISHLIST_COMPONENT_ID + "String_Node_Str";
  String[] wcSelectionArgs=new String[]{String.valueOf(id)};
  String wcGroupBy=null;
  String wcHaving=null;
  String wcOrderBy=null;
  String wcLimit=null;
  SQLiteQueryBuilder qb=builderWishlistComponent();
  Cursor cursor=qb.query(getReadableDatabase(),wcColumns,wcSelection,wcSelectionArgs,wcGroupBy,wcHaving,wcOrderBy,wcLimit);
  return new WishlistComponentCursor(cursor);
}

Fixed version (ground truth):
public WishlistComponentCursor queryWishlistComponentId(long id){
  String[] wcColumns=null;
  String wcSelection="String_Node_Str" + S.COLUMN_WISHLIST_COMPONENT_ID + "String_Node_Str";
  String[] wcSelectionArgs=new String[]{String.valueOf(id)};
  String wcGroupBy=null;
  String wcHaving=null;
  String wcOrderBy=null;
  String wcLimit=null;
  SQLiteQueryBuilder qb=builderWishlistComponent();
  Cursor cursor=qb.query(getWritableDatabase(),wcColumns,wcSelection,wcSelectionArgs,wcGroupBy,wcHaving,wcOrderBy,wcLimit);
  return new WishlistComponentCursor(cursor);
}
Program: 96164
Project: 96164
Buggy source:
public WishlistDataCursor queryWishlistDataId(long id){
  String[] wdColumns=null;
  String wdSelection="String_Node_Str" + S.COLUMN_WISHLIST_DATA_ID + "String_Node_Str";
  String[] wdSelectionArgs=new String[]{String.valueOf(id)};
  String wdGroupBy=null;
  String wdHaving=null;
  String wdOrderBy=null;
  String wdLimit=null;
  SQLiteQueryBuilder qb=builderWishlistData();
  Cursor cursor=qb.query(getReadableDatabase(),wdColumns,wdSelection,wdSelectionArgs,wdGroupBy,wdHaving,wdOrderBy,wdLimit);
  return new WishlistDataCursor(cursor);
}

Fixed version (ground truth):
public WishlistDataCursor queryWishlistDataId(long id){
  String[] wdColumns=null;
  String wdSelection="String_Node_Str" + S.COLUMN_WISHLIST_DATA_ID + "String_Node_Str";
  String[] wdSelectionArgs=new String[]{String.valueOf(id)};
  String wdGroupBy=null;
  String wdHaving=null;
  String wdOrderBy=null;
  String wdLimit=null;
  SQLiteQueryBuilder qb=builderWishlistData();
  Cursor cursor=qb.query(getWritableDatabase(),wdColumns,wdSelection,wdSelectionArgs,wdGroupBy,wdHaving,wdOrderBy,wdLimit);
  return new WishlistDataCursor(cursor);
}
Program: 96165
Project: 96165
Buggy source:
public WishlistDataCursor queryWishlistData(long wd_id,long item_id,String path){
  String[] wdColumns=null;
  String wdSelection="String_Node_Str" + S.COLUMN_WISHLIST_DATA_WISHLIST_ID + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ S.COLUMN_WISHLIST_DATA_ITEM_ID+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ S.COLUMN_WISHLIST_DATA_PATH+ "String_Node_Str";
  String[] wdSelectionArgs=new String[]{String.valueOf(wd_id),String.valueOf(item_id),path};
  String wdGroupBy=null;
  String wdHaving=null;
  String wdOrderBy=null;
  String wdLimit=null;
  SQLiteQueryBuilder qb=builderWishlistData();
  Cursor cursor=qb.query(getReadableDatabase(),wdColumns,wdSelection,wdSelectionArgs,wdGroupBy,wdHaving,wdOrderBy,wdLimit);
  return new WishlistDataCursor(cursor);
}

Fixed version (ground truth):
public WishlistDataCursor queryWishlistData(long wd_id,long item_id,String path){
  String[] wdColumns=null;
  String wdSelection="String_Node_Str" + S.COLUMN_WISHLIST_DATA_WISHLIST_ID + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ S.COLUMN_WISHLIST_DATA_ITEM_ID+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ S.COLUMN_WISHLIST_DATA_PATH+ "String_Node_Str";
  String[] wdSelectionArgs=new String[]{String.valueOf(wd_id),String.valueOf(item_id),path};
  String wdGroupBy=null;
  String wdHaving=null;
  String wdOrderBy=null;
  String wdLimit=null;
  SQLiteQueryBuilder qb=builderWishlistData();
  Cursor cursor=qb.query(getWritableDatabase(),wdColumns,wdSelection,wdSelectionArgs,wdGroupBy,wdHaving,wdOrderBy,wdLimit);
  return new WishlistDataCursor(cursor);
}
Program: 96168
Project: 96168
Buggy source:
/** 
 * Resets the container to its default state.
 */
private void onArmorRemoved(){
  text.setText("String_Node_Str");
  icon.setImageBitmap(fetchIcon(1));
}

Fixed version (ground truth):
/** 
 * Resets the container to its default state.
 */
private void onArmorRemoved(){
  text.setText("String_Node_Str");
  icon.setImageBitmap(fetchIcon(1));
  updateDecorationsView();
}
Program: 96170
Project: 96170
Buggy source:
/** 
 * Refreshes the contents of the piece container based on the   {@code ASBSession}. 
 */
public void updateContents(){
  updateArmorPiece();
  updateDecorationsPreview();
  decorationView.update();
}

Fixed version (ground truth):
/** 
 * Refreshes the contents of the piece container based on the   {@code ASBSession}.
 */
public void updateContents(){
  updateArmorPiece();
  updateDecorationsPreview();
  decorationView.update();
}
Program: 96172
Project: 96172
Buggy source:
@Override public Loader<Cursor> onCreateLoader(int id,Bundle args){
  return new MonsterAilmentCursorLoader(getActivity(),args.getLong(ARG_MONSTER_ID));
}

Fixed version (ground truth):
@Override public Loader<Monster> onCreateLoader(int id,Bundle args){
  return new MonsterLoader(getActivity(),args.getLong(ARG_MONSTER_ID));
}
Program: 96173
Project: 96173
Buggy source:
@Override public void onLoadFinished(Loader<Cursor> loader,Cursor cursor){
  MonsterDamageFragment.MonsterAilmentsCursorAdapter adapter=new MonsterDamageFragment.MonsterAilmentsCursorAdapter(getActivity(),(MonsterAilmentCursor)cursor);
  for (int i=0; i < adapter.getCount(); i++) {
    LinearLayout v=(LinearLayout)adapter.getView(i,null,null);
    mAilmentsLinearLayout.addView(v);
  }
  updateUI();
}

Fixed version (ground truth):
@Override public void onLoadFinished(Loader<Monster> loader,Monster run){
  mMonster=run;
  LoaderManager lm=getLoaderManager();
  Bundle args=new Bundle();
  args.putLong(ARG_MONSTER_ID,run.getId());
  updateUI();
}
Program: 96174
Project: 96174
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_monster_damage,container,false);
  mMonsterLabelTextView=(TextView)view.findViewById(R.id.detail_monster_label);
  mMonsterIconImageView=(ImageView)view.findViewById(R.id.detail_monster_image);
  mCutImageView=(ImageView)view.findViewById(R.id.cut);
  mImpactImageView=(ImageView)view.findViewById(R.id.impact);
  mShotImageView=(ImageView)view.findViewById(R.id.shot);
  mKOImageView=(ImageView)view.findViewById(R.id.ko);
  mFireImageView=(ImageView)view.findViewById(R.id.fire);
  mWaterImageView=(ImageView)view.findViewById(R.id.water);
  mIceImageView=(ImageView)view.findViewById(R.id.ice);
  mThunderImageView=(ImageView)view.findViewById(R.id.thunder);
  mDragonImageView=(ImageView)view.findViewById(R.id.dragon);
  mWeaponDamageTL=(LinearLayout)view.findViewById(R.id.weapon_damage);
  mElementalDamageTL=(LinearLayout)view.findViewById(R.id.elemental_damage);
  mDividerView=view.findViewById(R.id.divider);
  mAilmentsLinearLayout=(LinearLayout)view.findViewById(R.id.ailments_list);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_monster_damage,container,false);
  mMonsterLabelTextView=(TextView)view.findViewById(R.id.detail_monster_label);
  mMonsterIconImageView=(ImageView)view.findViewById(R.id.detail_monster_image);
  mCutImageView=(ImageView)view.findViewById(R.id.cut);
  mImpactImageView=(ImageView)view.findViewById(R.id.impact);
  mShotImageView=(ImageView)view.findViewById(R.id.shot);
  mKOImageView=(ImageView)view.findViewById(R.id.ko);
  mFireImageView=(ImageView)view.findViewById(R.id.fire);
  mWaterImageView=(ImageView)view.findViewById(R.id.water);
  mIceImageView=(ImageView)view.findViewById(R.id.ice);
  mThunderImageView=(ImageView)view.findViewById(R.id.thunder);
  mDragonImageView=(ImageView)view.findViewById(R.id.dragon);
  mWeaponDamageTL=(LinearLayout)view.findViewById(R.id.weapon_damage);
  mElementalDamageTL=(LinearLayout)view.findViewById(R.id.elemental_damage);
  mDividerView=view.findViewById(R.id.divider);
  return view;
}
Program: 96175
Project: 96175
Buggy source:
@Override public void onLoaderReset(Loader<Cursor> loader){
}

Fixed version (ground truth):
@Override public void onLoaderReset(Loader<Monster> loader){
}