nus-yam/ex-repair huggingface dataset:
Program: 25342
Project: 25342
Buggy source:
public void deleteResource(GrillSessionHandle sessionid,String type,String path){
  String command="String_Node_Str" + type.toLowerCase() + "String_Node_Str"+ path;
  try {
    acquire(sessionid);
    getCliService().executeStatement(getHiveSessionHandle(sessionid),command,null);
    getSession(sessionid).removeResource(type,path);
  }
 catch (  HiveSQLException e) {
    throw new WebApplicationException(e);
  }
catch (  GrillException e) {
    throw new WebApplicationException(e);
  }
 finally {
    try {
      release(sessionid);
    }
 catch (    GrillException e) {
      throw new WebApplicationException(e);
    }
  }
}

Fixed version (ground truth):
public void deleteResource(GrillSessionHandle sessionid,String type,String path){
  String command="String_Node_Str" + type.toLowerCase() + "String_Node_Str"+ path;
  try {
    acquire(sessionid);
    getCliService().executeStatement(getHiveSessionHandle(sessionid),command,null);
    getSession(sessionid).removeResource(type,path);
  }
 catch (  HiveSQLException e) {
    throw new WebApplicationException(e);
  }
 finally {
    release(sessionid);
  }
}
Program: 25343
Project: 25343
Buggy source:
private void addResource(GrillSessionHandle sessionid,String type,String path,boolean addToSession){
  String command="String_Node_Str" + type.toLowerCase() + "String_Node_Str"+ path;
  try {
    acquire(sessionid);
    getCliService().executeStatement(getHiveSessionHandle(sessionid),command,null);
    if (addToSession) {
      getSession(sessionid).addResource(type,path);
    }
  }
 catch (  HiveSQLException e) {
    throw new WebApplicationException(e);
  }
catch (  GrillException e) {
    throw new WebApplicationException(e);
  }
 finally {
    try {
      release(sessionid);
    }
 catch (    GrillException e) {
      throw new WebApplicationException(e);
    }
  }
}

Fixed version (ground truth):
public void addResource(GrillSessionHandle sessionid,String type,String path){
  String command="String_Node_Str" + type.toLowerCase() + "String_Node_Str"+ path;
  try {
    acquire(sessionid);
    getCliService().executeStatement(getHiveSessionHandle(sessionid),command,null);
  }
 catch (  HiveSQLException e) {
    throw new WebApplicationException(e);
  }
 finally {
    release(sessionid);
  }
}
Program: 25344
Project: 25344
Buggy source:
public GrillSessionHandle openSession(String username,String password,Map<String,String> configuration) throws GrillException {
  GrillSessionHandle sessionid=super.openSession(username,password,configuration);
  String[] auxJars=getSession(sessionid).getSessionConf().getStrings(GrillConfConstants.AUX_JARS);
  if (auxJars != null) {
    LOG.info("String_Node_Str" + auxJars);
    for (    String jar : auxJars) {
      addResource(sessionid,"String_Node_Str",jar);
    }
  }
  return sessionid;
}

Fixed version (ground truth):
public GrillSessionHandle openSession(String username,String password,Map<String,String> configuration) throws GrillException {
  GrillSessionHandle sessionid=super.openSession(username,password,configuration);
  LOG.info("String_Node_Str" + sessionid + "String_Node_Str"+ username);
  String[] auxJars=getSession(sessionid).getSessionConf().getStrings(GrillConfConstants.AUX_JARS);
  if (auxJars != null) {
    LOG.info("String_Node_Str" + auxJars);
    for (    String jar : auxJars) {
      addResourceToAllServices(sessionid,"String_Node_Str",jar);
    }
  }
  return sessionid;
}
Program: 25345
Project: 25345
Buggy source:
public List<String> getAllSessionParameters(GrillSessionHandle sessionid,boolean verbose,String key) throws GrillException {
  List<String> result=new ArrayList<String>();
  acquire(sessionid);
  SessionState ss=getSession(sessionid).getSessionState();
  if (!StringUtils.isBlank(key)) {
    result.add(getSessionParam(getSession(sessionid).getSessionConf(),ss,key));
  }
 else {
    try {
      SortedMap<String,String> sortedMap=new TreeMap<String,String>();
      sortedMap.put("String_Node_Str",(ss.getIsSilent() ? "String_Node_Str" : "String_Node_Str"));
      for (      String s : ss.getHiveVariables().keySet()) {
        sortedMap.put(SetProcessor.HIVEVAR_PREFIX + s,ss.getHiveVariables().get(s));
      }
      for (      Map.Entry<String,String> entry : getSession(sessionid).getSessionConf()) {
        sortedMap.put(entry.getKey(),entry.getValue());
      }
      for (      Map.Entry<String,String> entry : sortedMap.entrySet()) {
        result.add(entry.toString());
      }
    }
 catch (    GrillException e) {
      throw new WebApplicationException(e);
    }
 finally {
      try {
        release(sessionid);
      }
 catch (      GrillException e) {
        throw new WebApplicationException(e);
      }
    }
  }
  return result;
}

Fixed version (ground truth):
public List<String> getAllSessionParameters(GrillSessionHandle sessionid,boolean verbose,String key) throws GrillException {
  List<String> result=new ArrayList<String>();
  acquire(sessionid);
  try {
    SessionState ss=getSession(sessionid).getSessionState();
    if (!StringUtils.isBlank(key)) {
      result.add(getSessionParam(getSession(sessionid).getSessionConf(),ss,key));
    }
 else {
      SortedMap<String,String> sortedMap=new TreeMap<String,String>();
      sortedMap.put("String_Node_Str",(ss.getIsSilent() ? "String_Node_Str" : "String_Node_Str"));
      for (      String s : ss.getHiveVariables().keySet()) {
        sortedMap.put(SetProcessor.HIVEVAR_PREFIX + s,ss.getHiveVariables().get(s));
      }
      for (      Map.Entry<String,String> entry : getSession(sessionid).getSessionConf()) {
        sortedMap.put(entry.getKey(),entry.getValue());
      }
      for (      Map.Entry<String,String> entry : sortedMap.entrySet()) {
        result.add(entry.toString());
      }
    }
  }
  finally {
    release(sessionid);
  }
  return result;
}
Program: 25346
Project: 25346
Buggy source:
protected void setSessionParameter(GrillSessionHandle sessionid,String key,String value,boolean addToSession){
  LOG.info("String_Node_Str" + key + "String_Node_Str"+ value);
  String command="String_Node_Str" + "String_Node_Str" + key + "String_Node_Str"+ value;
  try {
    acquire(sessionid);
    String var;
    if (key.indexOf(SetProcessor.HIVECONF_PREFIX) == 0) {
      var=key.substring(SetProcessor.HIVECONF_PREFIX.length());
    }
 else {
      var=key;
    }
    getSession(sessionid).getSessionConf().set(var,value);
    getCliService().executeStatement(getHiveSessionHandle(sessionid),command,null);
    if (addToSession) {
      getSession(sessionid).setConfig(key,value);
    }
    LOG.info("String_Node_Str" + key + "String_Node_Str"+ value);
  }
 catch (  HiveSQLException e) {
    throw new WebApplicationException(e);
  }
catch (  GrillException e) {
    throw new WebApplicationException(e);
  }
 finally {
    try {
      release(sessionid);
    }
 catch (    GrillException e) {
      throw new WebApplicationException(e);
    }
  }
}

Fixed version (ground truth):
protected void setSessionParameter(GrillSessionHandle sessionid,String key,String value,boolean addToSession){
  LOG.info("String_Node_Str" + key + "String_Node_Str"+ value);
  String command="String_Node_Str" + "String_Node_Str" + key + "String_Node_Str"+ value;
  try {
    acquire(sessionid);
    String var;
    if (key.indexOf(SetProcessor.HIVECONF_PREFIX) == 0) {
      var=key.substring(SetProcessor.HIVECONF_PREFIX.length());
    }
 else {
      var=key;
    }
    getSession(sessionid).getSessionConf().set(var,value);
    getCliService().executeStatement(getHiveSessionHandle(sessionid),command,null);
    if (addToSession) {
      getSession(sessionid).setConfig(key,value);
    }
    LOG.info("String_Node_Str" + key + "String_Node_Str"+ value);
  }
 catch (  HiveSQLException e) {
    throw new WebApplicationException(e);
  }
 finally {
    release(sessionid);
  }
}
Program: 25347
Project: 25347
Buggy source:
/** 
 * Add a resource to the session to all GrillServices running in this Grill server <p> The returned @{link APIResult} will have status SUCCEEDED <em>only if</em> the add operation was successful for all services running in this Grill server. </p>
 * @param sessionid session handle object
 * @param type The type of resource. Valid types are 'jar', 'file' and 'archive'
 * @param path path of the resource
 * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if add was successful.  {@link APIResult} with state {@link Status#PARTIAL}, if add succeeded only for some services.  {@link APIResult} with state {@link Status#FAILED}, if add has failed
 */
@PUT @Path("String_Node_Str") @Consumes({MediaType.MULTIPART_FORM_DATA}) @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_PLAIN}) public APIResult addResource(@FormDataParam("String_Node_Str") GrillSessionHandle sessionid,@FormDataParam("String_Node_Str") String type,@FormDataParam("String_Node_Str") String path){
  int numAdded=0;
  for (  GrillService service : GrillServices.get().getGrillServices()) {
    try {
      service.addResource(sessionid,type,path);
      numAdded++;
    }
 catch (    GrillException e) {
      LOG.error("String_Node_Str" + service,e);
      if (numAdded != 0) {
        return new APIResult(Status.PARTIAL,"String_Node_Str" + service.getName());
      }
 else {
        return new APIResult(Status.FAILED,"String_Node_Str");
      }
    }
  }
  return new APIResult(Status.SUCCEEDED,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Add a resource to the session to all GrillServices running in this Grill server <p> The returned @{link APIResult} will have status SUCCEEDED <em>only if</em> the add operation was successful for all services running in this Grill server. </p>
 * @param sessionid session handle object
 * @param type The type of resource. Valid types are 'jar', 'file' and 'archive'
 * @param path path of the resource
 * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if add was successful.  {@link APIResult} with state {@link Status#PARTIAL}, if add succeeded only for some services.  {@link APIResult} with state {@link Status#FAILED}, if add has failed
 */
@PUT @Path("String_Node_Str") @Consumes({MediaType.MULTIPART_FORM_DATA}) @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_PLAIN}) public APIResult addResource(@FormDataParam("String_Node_Str") GrillSessionHandle sessionid,@FormDataParam("String_Node_Str") String type,@FormDataParam("String_Node_Str") String path){
  int numAdded=sessionService.addResourceToAllServices(sessionid,type,path);
  if (numAdded == 0) {
    return new APIResult(Status.FAILED,"String_Node_Str");
  }
 else   if (numAdded != GrillServices.get().getGrillServices().size()) {
    return new APIResult(Status.PARTIAL,"String_Node_Str");
  }
  return new APIResult(Status.SUCCEEDED,"String_Node_Str");
}
Program: 25348
Project: 25348
Buggy source:
public static BasicDataSource getDataSourceFromConf(HiveConf conf){
  BasicDataSource tmp=new BasicDataSource();
  tmp.setDriverClassName(conf.get(GrillConfConstants.GRILL_SERVER_USER_RESOLVER_DB_DRIVER_NAME));
  tmp.setUrl(conf.get(GrillConfConstants.GRILL_SERVER_USER_RESOLVER_DB_JDBC_URL));
  tmp.setUsername(conf.get(GrillConfConstants.GRILL_SERVER_USER_RESOLVER_DB_JDBC_USERNAME));
  tmp.setPassword(conf.get(GrillConfConstants.GRILL_SERVER_USER_RESOLVER_DB_JDBC_PASSWORD));
  return tmp;
}

Fixed version (ground truth):
public static BasicDataSource getDataSourceFromConf(HiveConf conf){
  BasicDataSource tmp=new BasicDataSource();
  tmp.setDriverClassName(conf.get(GrillConfConstants.GRILL_SERVER_USER_RESOLVER_DB_DRIVER_NAME));
  tmp.setUrl(conf.get(GrillConfConstants.GRILL_SERVER_USER_RESOLVER_DB_JDBC_URL));
  tmp.setUsername(conf.get(GrillConfConstants.GRILL_SERVER_USER_RESOLVER_DB_JDBC_USERNAME));
  tmp.setPassword(conf.get(GrillConfConstants.GRILL_SERVER_USER_RESOLVER_DB_JDBC_PASSWORD,"String_Node_Str"));
  return tmp;
}
Program: 25349
Project: 25349
Buggy source:
public UserConfigLoaderException(String message,Throwable cause,boolean enableSuppression,boolean writableStackTrace){
  super(message,cause,enableSuppression,writableStackTrace);
}

Fixed version (ground truth):
public UserConfigLoaderException(String message,Throwable cause){
  super(message,cause);
}
Program: 25350
Project: 25350
Buggy source:
@CliCommand(value="String_Node_Str",help="String_Node_Str") public String explainQuery(@CliOption(key={"String_Node_Str","String_Node_Str"},mandatory=true,help="String_Node_Str") String sql,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") String location) throws UnsupportedEncodingException {
  QueryPlan plan=getClient().getQueryPlan(sql);
  return plan.getPlanString();
}

Fixed version (ground truth):
@CliCommand(value="String_Node_Str",help="String_Node_Str") public String explainQuery(@CliOption(key={"String_Node_Str","String_Node_Str"},mandatory=true,help="String_Node_Str") String sql,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") String location) throws UnsupportedEncodingException {
  QueryPlan plan=getClient().getQueryPlan(sql);
  if (plan.isHasError() == true) {
    return plan.getErrorMsg();
  }
  return plan.getPlanString();
}
Program: 25351
Project: 25351
Buggy source:
public QueryPlan toQueryPlan() throws UnsupportedEncodingException {
  return new QueryPlan(numJoins,numGbys,numSels,numSelDi,numHaving,numObys,numAggrExprs,numFilters,tablesQueried,hasSubQuery,execMode != null ? execMode.name() : null,scanMode != null ? scanMode.name() : null,tableWeights,joinWeight,gbyWeight,filterWeight,havingWeight,obyWeight,selectWeight,null,URLEncoder.encode(getPlan(),"String_Node_Str"),getCost());
}

Fixed version (ground truth):
public QueryPlan toQueryPlan() throws UnsupportedEncodingException {
  return new QueryPlan(numJoins,numGbys,numSels,numSelDi,numHaving,numObys,numAggrExprs,numFilters,tablesQueried,hasSubQuery,execMode != null ? execMode.name() : null,scanMode != null ? scanMode.name() : null,tableWeights,joinWeight,gbyWeight,filterWeight,havingWeight,obyWeight,selectWeight,null,URLEncoder.encode(getPlan(),"String_Node_Str"),getCost(),false,null);
}
Program: 25352
Project: 25352
Buggy source:
@Override public QueryPlan explain(GrillSessionHandle sessionHandle,String query,GrillConf grillConf) throws GrillException {
  try {
    LOG.info("String_Node_Str" + sessionHandle.toString() + "String_Node_Str"+ query);
    acquire(sessionHandle);
    Configuration qconf=getGrillConf(sessionHandle,grillConf);
    accept(query,qconf,SubmitOp.EXPLAIN);
    Map<GrillDriver,String> driverQueries=RewriteUtil.rewriteQuery(query,drivers.values(),qconf);
    GrillDriver selectedDriver=driverSelector.select(drivers.values(),driverQueries,conf);
    return selectedDriver.explain(driverQueries.get(selectedDriver),qconf).toQueryPlan();
  }
 catch (  UnsupportedEncodingException e) {
    throw new GrillException(e);
  }
 finally {
    release(sessionHandle);
  }
}

Fixed version (ground truth):
@Override public QueryPlan explain(GrillSessionHandle sessionHandle,String query,GrillConf grillConf) throws GrillException {
  try {
    LOG.info("String_Node_Str" + sessionHandle.toString() + "String_Node_Str"+ query);
    acquire(sessionHandle);
    Configuration qconf=getGrillConf(sessionHandle,grillConf);
    accept(query,qconf,SubmitOp.EXPLAIN);
    Map<GrillDriver,String> driverQueries=RewriteUtil.rewriteQuery(query,drivers.values(),qconf);
    GrillDriver selectedDriver=driverSelector.select(drivers.values(),driverQueries,conf);
    return selectedDriver.explain(driverQueries.get(selectedDriver),qconf).toQueryPlan();
  }
 catch (  GrillException e) {
    QueryPlan plan;
    if (e.getCause().getMessage() != null)     plan=new QueryPlan(true,e.getCause().getMessage());
 else     plan=new QueryPlan(true,e.getMessage());
    return plan;
  }
catch (  UnsupportedEncodingException e) {
    throw new GrillException(e);
  }
 finally {
    release(sessionHandle);
  }
}
Program: 25353
Project: 25353
Buggy source:
public GrillClientSingletonWrapper getClientWrapper(){
  return GrillClientSingletonWrapper.INSTANCE;
}

Fixed version (ground truth):
public static GrillClientSingletonWrapper getClientWrapper(){
  return GrillClientSingletonWrapper.INSTANCE;
}
Program: 25354
Project: 25354
Buggy source:
public BaseGrillCommand(){
  mapper=new ObjectMapper();
  pp=new DefaultPrettyPrinter();
  pp.indentObjectsWith(new Indenter(){
    @Override public void writeIndentation(    JsonGenerator jg,    int level) throws IOException, JsonGenerationException {
      if (level > 2) {
        jg.writeRaw("String_Node_Str");
      }
 else {
        jg.writeRaw("String_Node_Str");
      }
    }
    @Override public boolean isInline(){
      return false;
    }
  }
);
  isConnectionActive=true;
}

Fixed version (ground truth):
public BaseGrillCommand(){
  getClient();
  mapper=new ObjectMapper();
  pp=new DefaultPrettyPrinter();
  pp.indentObjectsWith(new Indenter(){
    @Override public void writeIndentation(    JsonGenerator jg,    int level) throws IOException, JsonGenerationException {
      if (level > 2) {
        jg.writeRaw("String_Node_Str");
      }
 else {
        jg.writeRaw("String_Node_Str");
      }
    }
    @Override public boolean isInline(){
      return false;
    }
  }
);
  isConnectionActive=true;
}
Program: 25355
Project: 25355
Buggy source:
public GrillClient getClient(){
  return getClientWrapper().getClient();
}

Fixed version (ground truth):
public static GrillClient getClient(){
  return getClientWrapper().getClient();
}
Program: 25356
Project: 25356
Buggy source:
protected synchronized void closeClientConnection(){
  if (isConnectionActive) {
    LOG.debug("String_Node_Str");
    getClient().closeConnection();
    isConnectionActive=false;
  }
}

Fixed version (ground truth):
protected static synchronized void closeClientConnection(){
  if (isConnectionActive) {
    LOG.debug("String_Node_Str");
    getClient().closeConnection();
    isConnectionActive=false;
  }
}
Program: 25357
Project: 25357
Buggy source:
public void constructQuery(String selecttree,String fromtree,String wheretree,String groupbytree,String havingtree,String orderbytree,String limit){
  String finalJoinClause="String_Node_Str";
  if (joinCondition != null)   finalJoinClause=factTable.concat("String_Node_Str").concat(factAlias).concat(joinCondition.toString());
 else   finalJoinClause=factTable.concat("String_Node_Str").concat(factAlias);
  rewrittenQuery.append("String_Node_Str").append(selecttree).append("String_Node_Str");
  if (factInLineQuery.length() != 0)   rewrittenQuery.append(finalJoinClause.replaceFirst(factTable,factInLineQuery.toString()));
 else   rewrittenQuery.append(finalJoinClause);
  if (wheretree != null)   rewrittenQuery.append("String_Node_Str").append(wheretree);
  if (groupbytree != null)   rewrittenQuery.append("String_Node_Str").append(groupbytree);
  if (havingtree != null)   rewrittenQuery.append("String_Node_Str").append(havingtree);
  if (orderbytree != null)   rewrittenQuery.append("String_Node_Str").append(orderbytree);
  if (limit != null)   rewrittenQuery.append("String_Node_Str").append(limit);
}

Fixed version (ground truth):
private void constructQuery(String selecttree,String fromtree,String wheretree,String groupbytree,String havingtree,String orderbytree,String limit,String jointree){
  String finalJoinClause="String_Node_Str";
  String factNameAndAlias=getFactNameAlias(fromAST);
  if (joinCondition != null)   finalJoinClause=factNameAndAlias.concat("String_Node_Str").concat(joinCondition.toString());
 else   finalJoinClause=factNameAndAlias;
  rewrittenQuery.append("String_Node_Str").append(selecttree).append("String_Node_Str");
  if (factInLineQuery.length() != 0)   rewrittenQuery.append(finalJoinClause.replaceFirst(factNameAndAlias.substring(0,factNameAndAlias.indexOf(' ')),factInLineQuery.toString()));
 else   rewrittenQuery.append(finalJoinClause);
  if (wheretree != null)   rewrittenQuery.append("String_Node_Str").append(wheretree);
  if (groupbytree != null)   rewrittenQuery.append("String_Node_Str").append(groupbytree);
  if (havingtree != null)   rewrittenQuery.append("String_Node_Str").append(havingtree);
  if (orderbytree != null)   rewrittenQuery.append("String_Node_Str").append(orderbytree);
  if (limit != null)   rewrittenQuery.append("String_Node_Str").append(limit);
}
Program: 25360
Project: 25360
Buggy source:
public void getFactNameAlias(String query){
  Pattern p=Pattern.compile("String_Node_Str");
  Matcher m=p.matcher(query.toLowerCase());
  if (m.find()) {
    String fromClause=m.group(1);
    String[] keys=fromClause.split("String_Node_Str");
    factTable=keys[1];
    factAlias=keys[2];
  }
}

Fixed version (ground truth):
public String getFactNameAlias(ASTNode fromAST){
  String factTable;
  String factAlias;
  ArrayList<String> allTables=getFirstChildFromFromString(fromAST);
  String[] keys=allTables.get(0).trim().split("String_Node_Str");
  if (keys.length == 2) {
    factTable=keys[0];
    factAlias=keys[1];
    return factTable + "String_Node_Str" + factAlias;
  }
 else   factTable=keys[0];
  return factTable;
}
Program: 25361
Project: 25361
Buggy source:
@Override public synchronized String rewrite(Configuration conf,String query) throws GrillException {
  this.query=query;
  this.conf=conf;
  StringBuilder mergedQuery=new StringBuilder();
  rewrittenQuery.setLength(0);
  String queryReplacedUdf="String_Node_Str";
  reset();
  try {
    if (query.toLowerCase().matches("String_Node_Str")) {
      String finalRewrittenQuery="String_Node_Str";
      String[] queries=query.toLowerCase().split("String_Node_Str");
      for (int i=0; i < queries.length; i++) {
        LOG.info("String_Node_Str" + i + "String_Node_Str"+ queries[i]);
        getFactNameAlias(queries[i]);
        ast=HQLParser.parseHQL(queries[i]);
        buildQuery();
        mergedQuery=rewrittenQuery.append("String_Node_Str");
        finalRewrittenQuery=mergedQuery.toString().substring(0,mergedQuery.lastIndexOf("String_Node_Str"));
        reset();
      }
      queryReplacedUdf=replaceUDFForDB(finalRewrittenQuery);
      LOG.info("String_Node_Str" + query);
      LOG.info("String_Node_Str" + queryReplacedUdf);
    }
 else {
      ast=HQLParser.parseHQL(query);
      getFactNameAlias(query);
      buildQuery();
      queryReplacedUdf=replaceUDFForDB(rewrittenQuery.toString());
      LOG.info("String_Node_Str" + query);
      LOG.info("String_Node_Str" + queryReplacedUdf);
    }
  }
 catch (  ParseException e) {
    e.printStackTrace();
  }
  return queryReplacedUdf;
}

Fixed version (ground truth):
@Override public synchronized String rewrite(Configuration conf,String query) throws GrillException {
  this.query=query;
  this.conf=conf;
  StringBuilder mergedQuery=new StringBuilder();
  rewrittenQuery.setLength(0);
  String queryReplacedUdf="String_Node_Str";
  fromTables.clear();
  reset();
  try {
    if (query.toLowerCase().matches("String_Node_Str")) {
      String finalRewrittenQuery="String_Node_Str";
      String[] queries=query.toLowerCase().split("String_Node_Str");
      for (int i=0; i < queries.length; i++) {
        LOG.info("String_Node_Str" + i + "String_Node_Str"+ queries[i]);
        ast=HQLParser.parseHQL(queries[i]);
        buildQuery();
        mergedQuery=rewrittenQuery.append("String_Node_Str");
        finalRewrittenQuery=mergedQuery.toString().substring(0,mergedQuery.lastIndexOf("String_Node_Str"));
        reset();
      }
      queryReplacedUdf=replaceUDFForDB(finalRewrittenQuery);
      LOG.info("String_Node_Str" + query);
      LOG.info("String_Node_Str" + queryReplacedUdf);
    }
 else {
      ast=HQLParser.parseHQL(query);
      buildQuery();
      queryReplacedUdf=replaceUDFForDB(rewrittenQuery.toString());
      LOG.info("String_Node_Str" + query);
      LOG.info("String_Node_Str" + queryReplacedUdf);
    }
  }
 catch (  ParseException e) {
    e.printStackTrace();
  }
  return queryReplacedUdf;
}
Program: 25362
Project: 25362
Buggy source:
public void reset(){
  factInLineQuery.setLength(0);
  factKeys.setLength(0);
  aggColumn.clear();
  factTable="String_Node_Str";
  factAlias="String_Node_Str";
  allSubQueries.setLength(0);
  rightFilter.clear();
  joinCondition.setLength(0);
  selectTree=fromTree=joinTree=whereTree=groupByTree=havingTree=orderByTree=null;
  selectAST=fromAST=joinAST=whereAST=groupByAST=havingAST=orderByAST=null;
  limit=null;
}

Fixed version (ground truth):
public void reset(){
  factInLineQuery.setLength(0);
  factKeys.setLength(0);
  aggColumn.clear();
  allSubQueries.setLength(0);
  rightFilter.clear();
  joinCondition.setLength(0);
  selectTree=fromTree=joinTree=whereTree=groupByTree=havingTree=orderByTree=null;
  selectAST=fromAST=joinAST=whereAST=groupByAST=havingAST=orderByAST=null;
  limit=null;
  fromTables.clear();
}
Program: 25363
Project: 25363
Buggy source:
@Test public void testNoRewrite() throws ParseException, SemanticException, GrillException {
  SessionState.start(new HiveConf(ColumnarSQLRewriter.class));
  HiveConf conf=new HiveConf();
  ColumnarSQLRewriter qtest=new ColumnarSQLRewriter();
  String query="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  String actual=qtest.rewrite(conf,query);
  String expected="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  compareQueries(expected,actual);
  String query2="String_Node_Str";
  String actual2=qtest.rewrite(conf,query2);
  String expected2="String_Node_Str";
  compareQueries(expected2,actual2);
  String query3="String_Node_Str";
  String actual3=qtest.rewrite(conf,query3);
  String expected3="String_Node_Str";
  compareQueries(expected3,actual3);
}

Fixed version (ground truth):
@Test public void testNoRewrite() throws ParseException, SemanticException, GrillException {
  SessionState.start(new HiveConf(ColumnarSQLRewriter.class));
  HiveConf conf=new HiveConf();
  ColumnarSQLRewriter qtest=new ColumnarSQLRewriter();
  String query="String_Node_Str";
  String actual=qtest.rewrite(conf,query);
  String expected="String_Node_Str";
  compareQueries(expected,actual);
  String query2="String_Node_Str";
  String actual2=qtest.rewrite(conf,query2);
  String expected2="String_Node_Str";
  compareQueries(expected2,actual2);
  String query3="String_Node_Str";
  String actual3=qtest.rewrite(conf,query3);
  String expected3="String_Node_Str";
  compareQueries(expected3,actual3);
  String query4="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  String actual4=qtest.rewrite(conf,query4);
  String expected4="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  compareQueries(expected4,actual4);
}
Program: 25364
Project: 25364
Buggy source:
static Configuration getFinalQueryConf(GrillDriver driver,Configuration queryConf){
  Configuration conf=new Configuration(driver.getConf());
  for (  Map.Entry<String,String> entry : queryConf) {
    if (entry.getKey().equals("String_Node_Str")) {
      CubeGrillDriver.LOG.warn("String_Node_Str" + entry.getValue() + "String_Node_Str");
      continue;
    }
    conf.set(entry.getKey(),entry.getValue());
  }
  return conf;
}

Fixed version (ground truth):
public static Configuration getFinalQueryConf(GrillDriver driver,Configuration queryConf){
  Configuration conf=new Configuration(driver.getConf());
  for (  Map.Entry<String,String> entry : queryConf) {
    if (entry.getKey().equals("String_Node_Str")) {
      CubeGrillDriver.LOG.warn("String_Node_Str" + entry.getValue() + "String_Node_Str");
      continue;
    }
    conf.set(entry.getKey(),entry.getValue());
  }
  return conf;
}
Program: 25365
Project: 25365
Buggy source:
private GrillResultSet getResultset(QueryHandle queryHandle) throws GrillException {
  if (!allQueries.containsKey(queryHandle)) {
    FinishedGrillQuery query=grillServerDao.getQuery(queryHandle.toString());
    if (query != null) {
      if (query.getResult() == null) {
        throw new NotFoundException("String_Node_Str" + queryHandle);
      }
      try {
        Class<GrillResultSetMetadata> mdKlass=(Class<GrillResultSetMetadata>)Class.forName(query.getMetadataClass());
        return new GrillPersistentResult(mapper.readValue(query.getMetadata(),mdKlass),query.getResult(),query.getRows());
      }
 catch (      Exception e) {
        throw new GrillException(e);
      }
    }
    throw new NotFoundException("String_Node_Str" + queryHandle);
  }
  GrillResultSet resultSet=resultSets.get(queryHandle);
  if (resultSet == null) {
    QueryContext ctx=allQueries.get(queryHandle);
    if (ctx.isPersistent() && ctx.getQueryOutputFormatter() != null) {
      resultSets.put(queryHandle,new GrillPersistentResult(ctx.getQueryOutputFormatter().getMetadata(),ctx.getQueryOutputFormatter().getFinalOutputPath().toString(),ctx.getQueryOutputFormatter().getNumRows()));
    }
 else     if (allQueries.get(queryHandle).isResultAvailableInDriver()) {
      resultSet=allQueries.get(queryHandle).getSelectedDriver().fetchResultSet(allQueries.get(queryHandle));
      resultSets.put(queryHandle,resultSet);
    }
 else {
      throw new NotFoundException("String_Node_Str" + queryHandle);
    }
  }
  return resultSets.get(queryHandle);
}

Fixed version (ground truth):
private GrillResultSet getResultset(QueryHandle queryHandle) throws GrillException {
  QueryContext ctx=allQueries.get(queryHandle);
  if (ctx == null) {
    return getResultsetFromDAO(queryHandle);
  }
 else {
synchronized (ctx) {
      if (ctx.isFinishedQueryPersisted()) {
        return getResultsetFromDAO(queryHandle);
      }
      GrillResultSet resultSet=resultSets.get(queryHandle);
      if (resultSet == null) {
        if (ctx.isPersistent() && ctx.getQueryOutputFormatter() != null) {
          resultSets.put(queryHandle,new GrillPersistentResult(ctx.getQueryOutputFormatter().getMetadata(),ctx.getQueryOutputFormatter().getFinalOutputPath().toString(),ctx.getQueryOutputFormatter().getNumRows()));
        }
 else         if (allQueries.get(queryHandle).isResultAvailableInDriver()) {
          resultSet=allQueries.get(queryHandle).getSelectedDriver().fetchResultSet(allQueries.get(queryHandle));
          resultSets.put(queryHandle,resultSet);
        }
 else {
          throw new NotFoundException("String_Node_Str" + queryHandle);
        }
      }
    }
    return resultSets.get(queryHandle);
  }
}
Program: 25366
Project: 25366
Buggy source:
QueryCompletionListenerImpl(){
}

Fixed version (ground truth):
QueryCompletionListenerImpl(QueryHandle handle){
  this.handle=handle;
}
Program: 25367
Project: 25367
Buggy source:
@Override public void onCompletion(QueryHandle handle){
synchronized (this) {
    succeeded=true;
    LOG.info("String_Node_Str");
    this.notify();
  }
}

Fixed version (ground truth):
@Override public void onCompletion(QueryHandle handle){
synchronized (this) {
    succeeded=true;
    LOG.info("String_Node_Str" + handle + "String_Node_Str");
    this.notify();
  }
}
Program: 25368
Project: 25368
Buggy source:
private QueryHandleWithResultSet executeTimeoutInternal(GrillSessionHandle sessionHandle,QueryContext ctx,long timeoutMillis,Configuration conf) throws GrillException {
  QueryHandle handle=executeAsyncInternal(sessionHandle,ctx,conf);
  QueryHandleWithResultSet result=new QueryHandleWithResultSet(handle);
  while (getQueryContext(sessionHandle,handle).getStatus().getStatus().equals(QueryStatus.Status.QUEUED)) {
    try {
      Thread.sleep(10);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  QueryCompletionListener listener=new QueryCompletionListenerImpl();
  getQueryContext(sessionHandle,handle).getSelectedDriver().registerForCompletionNotification(handle,timeoutMillis,listener);
  try {
synchronized (listener) {
      listener.wait(timeoutMillis);
    }
  }
 catch (  InterruptedException e) {
    LOG.info("String_Node_Str");
  }
  if (getQueryContext(sessionHandle,handle).getStatus().isFinished()) {
    result.setResult(getResultset(handle).toQueryResult());
  }
  return result;
}

Fixed version (ground truth):
private QueryHandleWithResultSet executeTimeoutInternal(GrillSessionHandle sessionHandle,QueryContext ctx,long timeoutMillis,Configuration conf) throws GrillException {
  QueryHandle handle=executeAsyncInternal(sessionHandle,ctx,conf);
  QueryHandleWithResultSet result=new QueryHandleWithResultSet(handle);
  while (getQueryContext(sessionHandle,handle).getStatus().getStatus().equals(QueryStatus.Status.QUEUED)) {
    try {
      Thread.sleep(10);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  QueryCompletionListener listener=new QueryCompletionListenerImpl(handle);
  getQueryContext(sessionHandle,handle).getSelectedDriver().registerForCompletionNotification(handle,timeoutMillis,listener);
  try {
synchronized (listener) {
      listener.wait(timeoutMillis);
    }
  }
 catch (  InterruptedException e) {
    LOG.info("String_Node_Str");
  }
  if (getQueryContext(sessionHandle,handle).getStatus().isFinished()) {
    result.setResult(getResultset(handle).toQueryResult());
  }
  return result;
}
Program: 25369
Project: 25369
Buggy source:
@Override public void onError(QueryHandle handle,String error){
synchronized (this) {
    succeeded=false;
    LOG.info("String_Node_Str");
    this.notify();
  }
}

Fixed version (ground truth):
@Override public void onError(QueryHandle handle,String error){
synchronized (this) {
    succeeded=false;
    LOG.info("String_Node_Str" + handle + "String_Node_Str");
    this.notify();
  }
}
Program: 25370
Project: 25370
Buggy source:
@Test public void testQueryCommands() throws Exception {
  client=new GrillClient();
  client.setConnectionParam("String_Node_Str","String_Node_Str");
  setup(client);
  GrillQueryCommands qCom=new GrillQueryCommands();
  qCom.setClient(client);
  testExecuteSyncQuery(qCom);
  testExecuteAsyncQuery(qCom);
  testExplainQuery(qCom);
  testPreparedQuery(qCom);
}

Fixed version (ground truth):
@Test public void testQueryCommands() throws Exception {
  client=new GrillClient();
  client.setConnectionParam("String_Node_Str","String_Node_Str");
  setup(client);
  GrillQueryCommands qCom=new GrillQueryCommands();
  qCom.setClient(client);
  testExecuteSyncQuery(qCom);
  testExecuteAsyncQuery(qCom);
  testExplainQuery(qCom);
  testPreparedQuery(qCom);
  testShowPersistentResultSet(qCom);
}
Program: 25371
Project: 25371
Buggy source:
public InMemoryQueryResult getResultSet(GrillQuery query){
  if (query.getStatus().getStatus() != QueryStatus.Status.SUCCESSFUL) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  Client client=ClientBuilder.newClient();
  try {
    WebTarget target=getQueryWebTarget(client);
    return target.path(query.getQueryHandle().toString()).path("String_Node_Str").queryParam("String_Node_Str",connection.getSessionHandle()).request().get(InMemoryQueryResult.class);
  }
 catch (  Exception e) {
    throw new IllegalStateException("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
public QueryResult getResultSet(GrillQuery query){
  if (query.getStatus().getStatus() != QueryStatus.Status.SUCCESSFUL) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  Client client=ClientBuilder.newClient();
  try {
    WebTarget target=getQueryWebTarget(client);
    return target.path(query.getQueryHandle().toString()).path("String_Node_Str").queryParam("String_Node_Str",connection.getSessionHandle()).request().get(QueryResult.class);
  }
 catch (  Exception e) {
    throw new IllegalStateException("String_Node_Str" + e.getMessage());
  }
}
Program: 25372
Project: 25372
Buggy source:
public GrillJdbcResultSet(InMemoryQueryResult result,QueryResultSetMetadata metadata,GrillJdbcStatement statement){
  this.result=result;
  this.metadata=metadata;
  this.statement=statement;
  colNames=new ArrayList<String>();
  colTypes=new ArrayList<ResultColumnType>();
  for (  ResultColumn col : metadata.getColumns()) {
    colNames.add(col.getName());
    colTypes.add(col.getType());
  }
  iterators=result.getRows().iterator();
}

Fixed version (ground truth):
public GrillJdbcResultSet(QueryResult result,QueryResultSetMetadata metadata,GrillJdbcStatement statement){
  this.result=result;
  this.metadata=metadata;
  this.statement=statement;
  colNames=new ArrayList<String>();
  colTypes=new ArrayList<ResultColumnType>();
  for (  ResultColumn col : metadata.getColumns()) {
    colNames.add(col.getName());
    colTypes.add(col.getType());
  }
  if (result instanceof InMemoryQueryResult) {
    iterators=((InMemoryQueryResult)result).getRows().iterator();
  }
 else {
    iterators=null;
  }
}
Program: 25373
Project: 25373
Buggy source:
@Override public boolean next() throws SQLException {
  if (closed) {
    throw new SQLException("String_Node_Str");
  }
  if (iterators.hasNext()) {
    currentRow=iterators.next();
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean next() throws SQLException {
  if (closed) {
    throw new SQLException("String_Node_Str");
  }
  if (iterators != null && iterators.hasNext()) {
    currentRow=iterators.next();
    return true;
  }
  return false;
}
Program: 25377
Project: 25377
Buggy source:
@CliCommand(value="String_Node_Str",help="String_Node_Str") public String getQueries(@CliOption(key={"String_Node_Str","String_Node_Str"},mandatory=true,help="String_Node_Str") String sql,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") String location){
  QueryPlan plan=client.getQueryPlan(sql);
  return plan.getPlanString();
}

Fixed version (ground truth):
@CliCommand(value="String_Node_Str",help="String_Node_Str") public String getQueries(@CliOption(key={"String_Node_Str","String_Node_Str"},mandatory=true,help="String_Node_Str") String sql,@CliOption(key={"String_Node_Str"},mandatory=false,help="String_Node_Str") String location) throws UnsupportedEncodingException {
  QueryPlan plan=client.getQueryPlan(sql);
  return plan.getPlanString();
}
Program: 25378
Project: 25378
Buggy source:
public QueryPlan toQueryPlan(){
  return new QueryPlan(numJoins,numGbys,numSels,numSelDi,numHaving,numObys,numAggrExprs,numFilters,tablesQueried,hasSubQuery,execMode.name(),scanMode.name(),tableWeights,joinWeight,gbyWeight,filterWeight,havingWeight,obyWeight,selectWeight,null,getPlan(),getCost());
}

Fixed version (ground truth):
public QueryPlan toQueryPlan() throws UnsupportedEncodingException {
  return new QueryPlan(numJoins,numGbys,numSels,numSelDi,numHaving,numObys,numAggrExprs,numFilters,tablesQueried,hasSubQuery,execMode.name(),scanMode.name(),tableWeights,joinWeight,gbyWeight,filterWeight,havingWeight,obyWeight,selectWeight,null,URLEncoder.encode(getPlan(),"String_Node_Str"),getCost());
}
Program: 25379
Project: 25379
Buggy source:
@Override public QueryPlan explain(GrillSessionHandle sessionHandle,String query,GrillConf GrillConf) throws GrillException {
  try {
    LOG.info("String_Node_Str" + sessionHandle.toString() + "String_Node_Str"+ query);
    acquire(sessionHandle);
    Configuration qconf=getGrillConf(sessionHandle,GrillConf);
    accept(query,qconf,SubmitOp.EXPLAIN);
    Map<GrillDriver,String> driverQueries=RewriteUtil.rewriteQuery(query,drivers);
    return driverSelector.select(drivers,driverQueries,conf).explain(query,qconf).toQueryPlan();
  }
  finally {
    release(sessionHandle);
  }
}

Fixed version (ground truth):
@Override public QueryPlan explain(GrillSessionHandle sessionHandle,String query,GrillConf grillConf) throws GrillException {
  try {
    LOG.info("String_Node_Str" + sessionHandle.toString() + "String_Node_Str"+ query);
    acquire(sessionHandle);
    Configuration qconf=getGrillConf(sessionHandle,grillConf);
    accept(query,qconf,SubmitOp.EXPLAIN);
    Map<GrillDriver,String> driverQueries=RewriteUtil.rewriteQuery(query,drivers);
    return driverSelector.select(drivers,driverQueries,conf).explain(query,qconf).toQueryPlan();
  }
 catch (  UnsupportedEncodingException e) {
    throw new GrillException(e);
  }
 finally {
    release(sessionHandle);
  }
}
Program: 25380
Project: 25380
Buggy source:
@Override public QueryPlan explainAndPrepare(GrillSessionHandle sessionHandle,String query,GrillConf GrillConf) throws GrillException {
  try {
    LOG.info("String_Node_Str" + sessionHandle.toString() + "String_Node_Str"+ query);
    acquire(sessionHandle);
    Configuration qconf=getGrillConf(sessionHandle,GrillConf);
    accept(query,qconf,SubmitOp.EXPLAIN_AND_PREPARE);
    PreparedQueryContext prepared=new PreparedQueryContext(query,null,qconf);
    rewriteAndSelect(prepared);
    preparedQueries.put(prepared.getPrepareHandle(),prepared);
    preparedQueryQueue.add(prepared);
    QueryPlan plan=prepared.getSelectedDriver().explainAndPrepare(prepared).toQueryPlan();
    plan.setPrepareHandle(prepared.getPrepareHandle());
    return plan;
  }
  finally {
    release(sessionHandle);
  }
}

Fixed version (ground truth):
@Override public QueryPlan explainAndPrepare(GrillSessionHandle sessionHandle,String query,GrillConf GrillConf) throws GrillException {
  try {
    LOG.info("String_Node_Str" + sessionHandle.toString() + "String_Node_Str"+ query);
    acquire(sessionHandle);
    Configuration qconf=getGrillConf(sessionHandle,GrillConf);
    accept(query,qconf,SubmitOp.EXPLAIN_AND_PREPARE);
    PreparedQueryContext prepared=new PreparedQueryContext(query,null,qconf);
    rewriteAndSelect(prepared);
    preparedQueries.put(prepared.getPrepareHandle(),prepared);
    preparedQueryQueue.add(prepared);
    QueryPlan plan=prepared.getSelectedDriver().explainAndPrepare(prepared).toQueryPlan();
    plan.setPrepareHandle(prepared.getPrepareHandle());
    return plan;
  }
 catch (  UnsupportedEncodingException e) {
    throw new GrillException(e);
  }
 finally {
    release(sessionHandle);
  }
}
Program: 25381
Project: 25381
Buggy source:
public GrillSessionImpl(TProtocolVersion protocol,String username,String password,HiveConf serverConf,Map<String,String> sessionConf){
  super(protocol,username,password,serverConf,sessionConf);
}

Fixed version (ground truth):
public GrillSessionImpl(TProtocolVersion protocol,String username,String password,HiveConf serverConf,Map<String,String> sessionConf,String ipAddress){
  super(protocol,username,password,serverConf,sessionConf,ipAddress);
}
Program: 25382
Project: 25382
Buggy source:
private void updateFinishedQuery(QueryContext ctx){
  launchedQueries.remove(ctx);
  finishedQueries.add(new FinishedQuery(ctx));
}

Fixed version (ground truth):
private void updateFinishedQuery(QueryContext ctx,QueryStatus before){
  if (before.getStatus().equals(Status.QUEUED)) {
    acceptedQueries.remove(ctx);
  }
 else {
    launchedQueries.remove(ctx);
  }
  finishedQueries.add(new FinishedQuery(ctx));
}
Program: 25383
Project: 25383
Buggy source:
@Override public boolean cancelQuery(GrillSessionHandle sessionHandle,QueryHandle queryHandle) throws GrillException {
  try {
    acquire(sessionHandle);
    QueryContext ctx=getQueryContext(sessionHandle,queryHandle);
    if (ctx.getStatus().getStatus().equals(QueryStatus.Status.LAUNCHED)) {
      boolean ret=ctx.getSelectedDriver().cancelQuery(queryHandle);
      if (!ret) {
        return false;
      }
    }
 else {
      acceptedQueries.remove(ctx);
    }
    QueryStatus before=ctx.getStatus();
    ctx.setStatus(new QueryStatus(0.0,Status.CANCELED,"String_Node_Str",false,null,null));
    fireStatusChangeEvent(ctx,ctx.getStatus(),before);
    updateFinishedQuery(ctx);
    return true;
  }
  finally {
    release(sessionHandle);
  }
}

Fixed version (ground truth):
@Override public boolean cancelQuery(GrillSessionHandle sessionHandle,QueryHandle queryHandle) throws GrillException {
  try {
    acquire(sessionHandle);
    QueryContext ctx=getQueryContext(sessionHandle,queryHandle);
    if (ctx.getStatus().isFinished()) {
      return false;
    }
synchronized (ctx) {
      if (ctx.getStatus().getStatus().equals(QueryStatus.Status.LAUNCHED) || ctx.getStatus().getStatus().equals(QueryStatus.Status.RUNNING)) {
        boolean ret=ctx.getSelectedDriver().cancelQuery(queryHandle);
        if (!ret) {
          return false;
        }
      }
      setCancelledStatus(ctx,"String_Node_Str");
    }
    return true;
  }
  finally {
    release(sessionHandle);
  }
}
Program: 25384
Project: 25384
Buggy source:
private void setFailedStatus(QueryContext ctx,String statusMsg,String reason) throws GrillException {
  QueryStatus before=ctx.getStatus();
  ctx.setStatus(new QueryStatus(0.0f,QueryStatus.Status.FAILED,statusMsg,false,null,reason));
  fireStatusChangeEvent(ctx,ctx.getStatus(),before);
  updateFinishedQuery(ctx);
}

Fixed version (ground truth):
private void setFailedStatus(QueryContext ctx,String statusMsg,String reason) throws GrillException {
  QueryStatus before=ctx.getStatus();
  ctx.setStatus(new QueryStatus(0.0f,QueryStatus.Status.FAILED,statusMsg,false,null,reason));
  updateFinishedQuery(ctx,before);
  fireStatusChangeEvent(ctx,ctx.getStatus(),before);
}
Program: 25385
Project: 25385
Buggy source:
private QueryHandle executeAsyncInternal(GrillSessionHandle sessionHandle,QueryContext ctx,Configuration qconf) throws GrillException {
  ctx.setGrillSessionIdentifier(sessionHandle.getPublicId().toString());
  QueryStatus before=ctx.getStatus();
  acceptedQueries.add(ctx);
  ctx.setStatus(new QueryStatus(0.0,QueryStatus.Status.QUEUED,"String_Node_Str",false,null,null));
  allQueries.put(ctx.getQueryHandle(),ctx);
  fireStatusChangeEvent(ctx,ctx.getStatus(),before);
  LOG.info("String_Node_Str" + ctx.getQueryHandle().getHandleId());
  return ctx.getQueryHandle();
}

Fixed version (ground truth):
private QueryHandle executeAsyncInternal(GrillSessionHandle sessionHandle,QueryContext ctx,Configuration qconf) throws GrillException {
  ctx.setGrillSessionIdentifier(sessionHandle.getPublicId().toString());
  QueryStatus before=ctx.getStatus();
  ctx.setStatus(new QueryStatus(0.0,QueryStatus.Status.QUEUED,"String_Node_Str",false,null,null));
  acceptedQueries.add(ctx);
  allQueries.put(ctx.getQueryHandle(),ctx);
  fireStatusChangeEvent(ctx,ctx.getStatus(),before);
  LOG.info("String_Node_Str" + ctx.getQueryHandle().getHandleId());
  return ctx.getQueryHandle();
}
Program: 25386
Project: 25386
Buggy source:
private void updateStatus(final QueryHandle handle) throws GrillException {
  QueryContext ctx=allQueries.get(handle);
  if (ctx != null) {
synchronized (ctx) {
      QueryStatus before=ctx.getStatus();
      if (!ctx.getStatus().getStatus().equals(QueryStatus.Status.QUEUED) && !ctx.getStatus().isFinished()) {
        ctx.setStatus(ctx.getSelectedDriver().getStatus(ctx.getQueryHandle()));
      }
      if (ctx.getStatus().isFinished()) {
        updateFinishedQuery(ctx);
      }
      fireStatusChangeEvent(ctx,ctx.getStatus(),before);
    }
  }
}

Fixed version (ground truth):
private void updateStatus(final QueryHandle handle) throws GrillException {
  QueryContext ctx=allQueries.get(handle);
  if (ctx != null) {
synchronized (ctx) {
      QueryStatus before=ctx.getStatus();
      if (!ctx.getStatus().getStatus().equals(QueryStatus.Status.QUEUED) && !ctx.getStatus().isFinished()) {
        ctx.setStatus(ctx.getSelectedDriver().getStatus(ctx.getQueryHandle()));
        if (ctx.getStatus().isFinished()) {
          updateFinishedQuery(ctx,before);
        }
        fireStatusChangeEvent(ctx,ctx.getStatus(),before);
      }
    }
  }
}
Program: 25389
Project: 25389
Buggy source:
public APIResult(Status status,String message){
  super();
  this.status=status;
  this.message=message;
  requestId=NDC.peek();
  try {
    UUID.fromString(requestId);
  }
 catch (  IllegalArgumentException e) {
    requestId=null;
  }
}

Fixed version (ground truth):
public APIResult(Status status,String message){
  super();
  this.status=status;
  this.message=message;
}