nus-yam/ex-repair huggingface dataset:
Program: 35195
Project: 35195
Buggy source:
private static List<InetSocketAddress> parseNodeNames(String s) throws Exception {
  List<InetSocketAddress> addrs=new ArrayList<InetSocketAddress>();
  for (  String node : s.split("String_Node_Str")) {
    String[] temp=node.split("String_Node_Str");
    String group=temp[0];
    boolean master=temp[1].equals("String_Node_Str") ? true : false;
    String ipport=temp[2];
    ArcusReplNodeAddress a=ArcusReplNodeAddress.create(group,master,ipport);
    addrs.add(a);
  }
  return addrs;
}

Fixed version (ground truth):
private static List<InetSocketAddress> parseNodeNames(String s) throws Exception {
  List<InetSocketAddress> addrs=new ArrayList<InetSocketAddress>();
  for (  String node : s.split("String_Node_Str")) {
    ArcusReplNodeAddress a=null;
    if (node.equals(CacheManager.FAKE_SERVER_NODE)) {
      a=ArcusReplNodeAddress.createFake(null);
    }
 else {
      String[] temp=node.split("String_Node_Str");
      String group=temp[0];
      boolean master=temp[1].equals("String_Node_Str") ? true : false;
      String ipport=temp[2];
      a=ArcusReplNodeAddress.create(group,master,ipport);
    }
    addrs.add(a);
  }
  return addrs;
}
Program: 35196
Project: 35196
Buggy source:
static List<InetSocketAddress> getAddresses(String s){
  List<InetSocketAddress> list=null;
  if (s.equals(CacheMonitor.FAKE_SERVER_NODE)) {
  }
 else {
    try {
      list=parseNodeNames(s);
    }
 catch (    Exception e) {
      ArcusClient.arcusLogger.error("String_Node_Str" + "String_Node_Str" + s + "String_Node_Str"+ e);
      e.printStackTrace();
      list=null;
    }
  }
  if (list == null || list.size() == 0) {
    list=new ArrayList<InetSocketAddress>(1);
    list.add((InetSocketAddress)Arcus17NodeAddress.create("String_Node_Str",false,CacheMonitor.FAKE_SERVER_NODE));
  }
  return list;
}

Fixed version (ground truth):
static List<InetSocketAddress> getAddresses(String s){
  List<InetSocketAddress> list=null;
  if (s.equals(CacheManager.FAKE_SERVER_NODE)) {
  }
 else {
    try {
      list=parseNodeNames(s);
    }
 catch (    Exception e) {
      ArcusClient.arcusLogger.error("String_Node_Str" + "String_Node_Str" + s + "String_Node_Str"+ e);
      e.printStackTrace();
      list=null;
    }
  }
  if (list == null || list.size() == 0) {
    list=new ArrayList<InetSocketAddress>(1);
    list.add((InetSocketAddress)Arcus17NodeAddress.create("String_Node_Str",false,CacheManager.FAKE_SERVER_NODE));
  }
  return list;
}
Program: 35197
Project: 35197
Buggy source:
private static List<InetSocketAddress> parseNodeNames(String s) throws Exception {
  List<InetSocketAddress> addrs=new ArrayList<InetSocketAddress>();
  for (  String node : s.split("String_Node_Str")) {
    String[] temp=node.split("String_Node_Str");
    String group=temp[0];
    boolean master=temp[1].equals("String_Node_Str") ? true : false;
    String[] temp2=temp[2].split("String_Node_Str");
    String ipport=temp2[0];
    if (!master)     ipport=CacheMonitor.FAKE_SERVER_NODE;
    Arcus17NodeAddress a=Arcus17NodeAddress.create(group,master,ipport);
    for (int i=0; i < addrs.size(); i++) {
      if (((Arcus17NodeAddress)addrs.get(i)).group.equals(group)) {
        if (master) {
          addrs.set(i,a);
        }
 else {
        }
        a=null;
        break;
      }
    }
    if (a != null) {
      addrs.add((InetSocketAddress)a);
    }
  }
  return addrs;
}

Fixed version (ground truth):
private static List<InetSocketAddress> parseNodeNames(String s) throws Exception {
  List<InetSocketAddress> addrs=new ArrayList<InetSocketAddress>();
  for (  String node : s.split("String_Node_Str")) {
    String[] temp=node.split("String_Node_Str");
    String group=temp[0];
    boolean master=temp[1].equals("String_Node_Str") ? true : false;
    String[] temp2=temp[2].split("String_Node_Str");
    String ipport=temp2[0];
    if (!master)     ipport=CacheManager.FAKE_SERVER_NODE;
    Arcus17NodeAddress a=Arcus17NodeAddress.create(group,master,ipport);
    for (int i=0; i < addrs.size(); i++) {
      if (((Arcus17NodeAddress)addrs.get(i)).group.equals(group)) {
        if (master) {
          addrs.set(i,a);
        }
 else {
        }
        a=null;
        break;
      }
    }
    if (a != null) {
      addrs.add((InetSocketAddress)a);
    }
  }
  return addrs;
}
Program: 35198
Project: 35198
Buggy source:
private void updateHash(MemcachedNode node,boolean remove){
  if (!remove) {
    config.insertNode(node);
  }
  for (int i=0; i < config.getNodeRepetitions() / 4; i++) {
    byte[] digest=HashAlgorithm.computeMd5(config.getKeyForNode(node,i));
    for (int h=0; h < 4; h++) {
      Long k=((long)(digest[3 + h * 4] & 0xFF) << 24) | ((long)(digest[2 + h * 4] & 0xFF) << 16) | ((long)(digest[1 + h * 4] & 0xFF) << 8)| (digest[h * 4] & 0xFF);
      if (remove) {
        ketamaNodes.remove(k);
      }
 else {
        ketamaNodes.put(k,node);
      }
    }
  }
  if (remove) {
    config.removeNode(node);
  }
}

Fixed version (ground truth):
void updateHash(MemcachedNode node,boolean remove){
  if (!remove) {
    config.insertNode(node);
  }
  for (int i=0; i < config.getNodeRepetitions() / 4; i++) {
    byte[] digest=HashAlgorithm.computeMd5(config.getKeyForNode(node,i));
    for (int h=0; h < 4; h++) {
      Long k=((long)(digest[3 + h * 4] & 0xFF) << 24) | ((long)(digest[2 + h * 4] & 0xFF) << 16) | ((long)(digest[1 + h * 4] & 0xFF) << 8)| (digest[h * 4] & 0xFF);
      if (remove) {
        ketamaNodes.remove(k);
      }
 else {
        ketamaNodes.put(k,node);
      }
    }
  }
  if (remove) {
    config.removeNode(node);
  }
}
Program: 35200
Project: 35200
Buggy source:
/** 
 * Asynchronous CAS operation using the default transcoder.
 * @param key the key
 * @param casId the CAS identifier (from a gets operation)
 * @param value the new value
 * @return a future that will indicate the status of the CAS
 * @throws IllegalStateException in the rare circumstance where queueis too full to accept any more requests
 */
public Future<CASResponse> asyncCAS(String key,long casId,Object value){
  return asyncCAS(key,casId,value,transcoder);
}

Fixed version (ground truth):
/** 
 * Asynchronous CAS operation using the default transcoder with expiration.
 * @param key the key
 * @param casId the CAS identifier (from a gets operation)
 * @param exp the expiration of this object
 * @param value the new value
 * @return a future that will indicate the status of the CAS
 * @throws IllegalStateException in the rare circumstance where queue is toofull to accept any more requests
 */
@Override public Future<CASResponse> asyncCAS(String key,long casId,int exp,Object value){
  return asyncCAS(key,casId,exp,value,transcoder);
}
Program: 35201
Project: 35201
Buggy source:
/** 
 * Perform a synchronous CAS operation with the default transcoder.
 * @param key the key
 * @param casId the CAS identifier (from a gets operation)
 * @param value the new value
 * @return a CASResponse
 * @throws OperationTimeoutException if the global operation timeout isexceeded
 * @throws IllegalStateException in the rare circumstance where queueis too full to accept any more requests
 */
public CASResponse cas(String key,long casId,Object value){
  return cas(key,casId,value,transcoder);
}

Fixed version (ground truth):
/** 
 * Perform a synchronous CAS operation with the default transcoder.
 * @param key the key
 * @param casId the CAS identifier (from a gets operation)
 * @param exp the expiration of this object
 * @param value the new value
 * @return a CASResponse
 * @throws OperationTimeoutException if the global operation timeout is exceeded
 * @throws IllegalStateException in the rare circumstance where queue is too full to accept any more requests
 */
@Override public CASResponse cas(String key,long casId,int exp,Object value){
  return cas(key,casId,exp,value,transcoder);
}
Program: 35202
Project: 35202
Buggy source:
Future<CASResponse> asyncCAS(String key,long casId,Object value);

Fixed version (ground truth):
<T>Future<CASResponse> asyncCAS(String key,long casId,int exp,T value,Transcoder<T> tc);
Program: 35203
Project: 35203
Buggy source:
CASResponse cas(String key,long casId,Object value) throws OperationTimeoutException ;

Fixed version (ground truth):
<T>CASResponse cas(String key,long casId,T value,Transcoder<T> tc);
Program: 35204
Project: 35204
Buggy source:
private String getClientInfo(){
  String path="String_Node_Str";
  try {
    SimpleDateFormat simpleDateFormat=new SimpleDateFormat("String_Node_Str");
    Date currentTime=new Date();
    if (arcus17)     path=REPL_CLIENT_INFO_PATH;
 else     path=ARCUS_BASE_CLIENT_INFO_PATH;
    path=path + serviceCode + "String_Node_Str"+ InetAddress.getLocalHost().getHostName()+ "String_Node_Str"+ InetAddress.getLocalHost().getHostAddress()+ "String_Node_Str"+ this.poolSize+ "String_Node_Str"+ ArcusClient.VERSION+ "String_Node_Str"+ simpleDateFormat.format(currentTime)+ "String_Node_Str"+ zk.getSessionId();
  }
 catch (  UnknownHostException e) {
    return null;
  }
  return path;
}

Fixed version (ground truth):
private String getClientInfo(){
  String path="String_Node_Str";
  try {
    SimpleDateFormat simpleDateFormat=new SimpleDateFormat("String_Node_Str");
    Date currentTime=new Date();
    if (arcus17)     path=REPL_CLIENT_INFO_PATH;
 else     path=ARCUS_BASE_CLIENT_INFO_ZPATH;
    path=path + serviceCode + "String_Node_Str"+ InetAddress.getLocalHost().getHostName()+ "String_Node_Str"+ InetAddress.getLocalHost().getHostAddress()+ "String_Node_Str"+ this.poolSize+ "String_Node_Str"+ ArcusClient.VERSION+ "String_Node_Str"+ simpleDateFormat.format(currentTime)+ "String_Node_Str"+ zk.getSessionId();
  }
 catch (  UnknownHostException e) {
    return null;
  }
  return path;
}
Program: 35207
Project: 35207
Buggy source:
@Override protected void onPostExecute(ArrayList<BasePost> posts){
  super.onPostExecute(posts);
  MyPostsAdapter myPostsAdapter=new MyPostsAdapter(mContext,posts,mListView);
  mListView.setAdapter(myPostsAdapter);
}

Fixed version (ground truth):
@Override protected void onPostExecute(ArrayList<BasePost> posts){
  super.onPostExecute(posts);
  myPostsAdapter=new MyPostsAdapter(mContext,posts,mListView);
  mListView.setAdapter(myPostsAdapter);
}
Program: 35209
Project: 35209
Buggy source:
@Override protected void onPostExecute(ArrayList<BasePost> posts){
  super.onPostExecute(posts);
  MyPostsAdapter myPostsAdapter=new MyPostsAdapter(mContext,posts,mListView);
  mListView.setAdapter(myPostsAdapter);
}

Fixed version (ground truth):
@Override protected void onPostExecute(ArrayList<BasePost> posts){
  super.onPostExecute(posts);
  myPostsAdapter=new MyPostsAdapter(mContext,posts,mListView);
  mListView.setAdapter(myPostsAdapter);
}
Program: 35210
Project: 35210
Buggy source:
@Override protected Integer doInBackground(String... params){
  int statusCode=0;
  String noticetrimstr;
  String content="String_Node_Str";
  if (posts.get(Integer.valueOf(params[2]) - 1).content.startsWith("String_Node_Str")) {
    content=posts.get(Integer.valueOf(params[2]) - 1).content.substring("String_Node_Str".length());
  }
  noticetrimstr="String_Node_Str" + posts.get(Integer.valueOf(params[2]) - 1).pid + "String_Node_Str"+ posts.get(Integer.valueOf(params[2]) - 1).tid+ "String_Node_Str"+ posts.get(Integer.valueOf(params[2]) - 1).author+ posts.get(Integer.valueOf(params[2]) - 1).time+ "String_Node_Str"+ content+ "String_Node_Str";
  HashMap<String,String> datas=new HashMap<String,String>();
  datas.put("String_Node_Str",params[1]);
  datas.put("String_Node_Str",formhash);
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str",noticetrimstr);
  Connection.Response res=Request.execute(params[0],"String_Node_Str",datas,(Map<String,String>)Athority.getSharedPreference().getAll(),Connection.Method.POST);
  statusCode=res.statusCode();
  return statusCode;
}

Fixed version (ground truth):
@Override protected Integer doInBackground(String... params){
  int statusCode=0;
  String noticetrimstr;
  String content="String_Node_Str";
  if (posts.get(Integer.valueOf(params[2]) - 1).content.startsWith("String_Node_Str")) {
    content=posts.get(Integer.valueOf(params[2]) - 1).content.substring("String_Node_Str".length());
  }
 else {
    content=posts.get(Integer.valueOf(params[2]) - 1).content;
  }
  noticetrimstr="String_Node_Str" + posts.get(Integer.valueOf(params[2]) - 1).pid + "String_Node_Str"+ posts.get(Integer.valueOf(params[2]) - 1).tid+ "String_Node_Str"+ posts.get(Integer.valueOf(params[2]) - 1).author+ posts.get(Integer.valueOf(params[2]) - 1).time+ "String_Node_Str"+ content+ "String_Node_Str";
  HashMap<String,String> datas=new HashMap<String,String>();
  datas.put("String_Node_Str",params[1]);
  datas.put("String_Node_Str",formhash);
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str",noticetrimstr);
  Connection.Response res=Request.execute(params[0],"String_Node_Str",datas,(Map<String,String>)Athority.getSharedPreference().getAll(),Connection.Method.POST);
  statusCode=res.statusCode();
  return statusCode;
}
Program: 35212
Project: 35212
Buggy source:
@Override protected ArrayList<BasePost> doInBackground(String... params){
  ArrayList<BasePost> posts=new ArrayList<BasePost>();
  Document doc=null;
  Connection.Response response=Request.execute(String.format(Api.MY_POSTS,uid),Api.USER_AGENT,(Map<String,String>)Athority.getSharedPreference().getAll(),Connection.Method.GET);
  try {
    doc=response.parse();
    Elements bm_cs=doc.getElementsByClass("String_Node_Str");
    String str_tid="String_Node_Str";
    String title="String_Node_Str";
    String time="String_Node_Str";
    String comment_count="String_Node_Str";
    int haveimg=0;
    int tid=0;
    String author=Athority.getSharedPreference().getString("String_Node_Str","String_Node_Str");
    BasePost post;
    for (    Element bm_c : bm_cs) {
      Elements as=bm_c.getElementsByTag("String_Node_Str");
      for (      Element a : as) {
        String start="String_Node_Str";
        String len="String_Node_Str";
        String url=a.attr("String_Node_Str");
        str_tid=url.substring(start.length() - 1,url.length() - len.length() + 1);
        tid=Integer.valueOf(str_tid);
        title=a.text();
      }
      Elements xg1s=bm_c.getElementsByClass("String_Node_Str");
      comment_count=xg1s.text().substring("String_Node_Str".length());
      post=new Post(0,tid,0,title,"String_Node_Str",time,haveimg,Integer.valueOf(comment_count),author,null);
      posts.add(post);
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return posts;
}

Fixed version (ground truth):
@Override protected ArrayList<BasePost> doInBackground(String... params){
  ArrayList<BasePost> posts=new ArrayList<BasePost>();
  Document doc=null;
  Connection.Response response=Request.execute(String.format(Api.MY_POSTS,uid),Api.USER_AGENT,(Map<String,String>)Athority.getSharedPreference().getAll(),Connection.Method.GET);
  try {
    doc=response.parse();
    Elements bm_cs=doc.getElementsByClass("String_Node_Str");
    String str_tid="String_Node_Str";
    String title="String_Node_Str";
    String time="String_Node_Str";
    String comment_count="String_Node_Str";
    int haveimg=0;
    int tid=0;
    String author=Athority.getSharedPreference().getString("String_Node_Str","String_Node_Str");
    BasePost post;
    for (    Element bm_c : bm_cs) {
      Elements as=bm_c.getElementsByTag("String_Node_Str");
      for (      Element a : as) {
        String start="String_Node_Str";
        String len="String_Node_Str";
        String url=a.attr("String_Node_Str");
        str_tid=url.substring(start.length() - 1,url.length() - len.length() + 1);
        tid=Integer.valueOf(str_tid);
        title=a.text();
      }
      Elements xg1s=bm_c.getElementsByClass("String_Node_Str");
      if (xg1s.text().length() != 0) {
        comment_count=xg1s.text().substring("String_Node_Str".length());
      }
 else {
        comment_count="String_Node_Str";
      }
      post=new Post(0,tid,0,title,"String_Node_Str",time,haveimg,Integer.valueOf(comment_count),author,null);
      posts.add(post);
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return posts;
}
Program: 35213
Project: 35213
Buggy source:
@Override protected void onPostExecute(ArrayList<BasePost> posts){
  super.onPostExecute(posts);
  myPostsAdapter=new MyPostsAdapter(mContext,posts,mListView);
  mListView.setAdapter(myPostsAdapter);
}

Fixed version (ground truth):
@Override protected void onPostExecute(ArrayList<BasePost> posts){
  super.onPostExecute(posts);
  if (posts.size() == 1) {
    posts.clear();
  }
  myPostsAdapter=new MyPostsAdapter(mContext,posts,mListView);
  mListView.setAdapter(myPostsAdapter);
}
Program: 35214
Project: 35214
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (mDrawerToggle.onOptionsItemSelected(item)) {
    return true;
  }
switch (item.getItemId()) {
case R.id.changeAcount:
    startActivity(new Intent(this,LoginActivity.class));
  finish();
return true;
case R.id.personalcenter:
startActivity(new Intent(this,PersonalCenterActivity.class));
return true;
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (mDrawerToggle.onOptionsItemSelected(item)) {
    return true;
  }
switch (item.getItemId()) {
case R.id.changeAcount:
    Athority.addOther(Athority.HAVE_UID,"String_Node_Str");
  startActivity(new Intent(this,LoginActivity.class));
finish();
return true;
case R.id.personalcenter:
startActivity(new Intent(this,PersonalCenterActivity.class));
return true;
default :
return super.onOptionsItemSelected(item);
}
}
Program: 35215
Project: 35215
Buggy source:
@Override protected Integer doInBackground(String... params){
  int statusCode=0;
  String noticetrimstr;
  String content="String_Node_Str";
  if (posts.get(Integer.valueOf(params[2]) - 1).content.startsWith("String_Node_Str")) {
    content=posts.get(Integer.valueOf(params[2]) - 1).content.substring("String_Node_Str".length());
  }
 else {
    content=posts.get(Integer.valueOf(params[2]) - 1).content;
  }
  noticetrimstr="String_Node_Str" + posts.get(Integer.valueOf(params[2]) - 1).pid + "String_Node_Str"+ posts.get(Integer.valueOf(params[2]) - 1).tid+ "String_Node_Str"+ posts.get(Integer.valueOf(params[2]) - 1).author+ posts.get(Integer.valueOf(params[2]) - 1).time+ "String_Node_Str"+ content+ "String_Node_Str";
  HashMap<String,String> datas=new HashMap<String,String>();
  datas.put("String_Node_Str",params[1]);
  datas.put("String_Node_Str",formhash);
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str",noticetrimstr);
  Connection.Response res=Request.execute(params[0],"String_Node_Str",datas,(Map<String,String>)Athority.getSharedPreference().getAll(),Connection.Method.POST);
  statusCode=res.statusCode();
  return statusCode;
}

Fixed version (ground truth):
@Override protected Integer doInBackground(String... params){
  int statusCode=0;
  String noticetrimstr;
  String content="String_Node_Str";
  if (posts.get(Integer.valueOf(params[2]) - 1).content.startsWith("String_Node_Str")) {
    content=posts.get(Integer.valueOf(params[2]) - 1).content.substring("String_Node_Str".length());
  }
 else {
    String[] temp=posts.get(Integer.valueOf(params[2]) - 1).content.split("String_Node_Str");
    content=temp[1];
  }
  noticetrimstr="String_Node_Str" + posts.get(Integer.valueOf(params[2]) - 1).pid + "String_Node_Str"+ posts.get(Integer.valueOf(params[2]) - 1).tid+ "String_Node_Str"+ posts.get(Integer.valueOf(params[2]) - 1).author+ posts.get(Integer.valueOf(params[2]) - 1).time+ "String_Node_Str"+ content+ "String_Node_Str";
  HashMap<String,String> datas=new HashMap<String,String>();
  datas.put("String_Node_Str",params[1]);
  datas.put("String_Node_Str",formhash);
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str","String_Node_Str");
  datas.put("String_Node_Str",noticetrimstr);
  Connection.Response res=Request.execute(params[0],"String_Node_Str",datas,(Map<String,String>)Athority.getSharedPreference().getAll(),Connection.Method.POST);
  statusCode=res.statusCode();
  return statusCode;
}
Program: 35216
Project: 35216
Buggy source:
private Timer start(final boolean periodic,TimeOfWeek time,final Handler<Timer> handler){
  final TimerData data=new TimerData();
  final Timer timer=new Timer();
  final SchedulerLogic logic=new SchedulerLogic(time.getTimeZone(),new Date(),time.getWeekMs(),time.aheadBehavior(),time.backBehavior());
  final Handler<java.lang.Long> timerCB=new Handler<java.lang.Long>(){
    public void handle(    Long vertxTimerId){
      handler.handle(timer);
      if (periodic) {
        Date d=logic.next();
        data.vertxTimerId=vertx.setTimer(Utils.getMsUntilDate(logic.next()),this);
      }
 else {
        timers.remove(timer);
      }
    }
  }
;
  data.vertxTimerId=vertx.setTimer(Utils.getMsUntilDate(logic.next()),timerCB);
  timers.put(timer,data);
  return timer;
}

Fixed version (ground truth):
private Timer start(final boolean periodic,TimeOfWeek time,final Handler<Timer> handler){
  final TimerData data=new TimerData();
  final Timer timer=new Timer();
  final SchedulerLogic logic=new SchedulerLogic(time.getTimeZone(),new Date(),time.getWeekMs(),time.aheadBehavior(),time.backBehavior());
  final Handler<java.lang.Long> timerCB=new Handler<java.lang.Long>(){
    public void handle(    Long vertxTimerId){
      if (periodic) {
        timer.next=logic.next();
        handler.handle(timer);
        data.vertxTimerId=vertx.setTimer(Utils.getMsUntilDate(timer.next),this);
      }
 else {
        timer.next=null;
        handler.handle(timer);
        timers.remove(timer);
      }
    }
  }
;
  timer.next=logic.next();
  data.vertxTimerId=vertx.setTimer(Utils.getMsUntilDate(timer.next),timerCB);
  timers.put(timer,data);
  return timer;
}
Program: 35217
Project: 35217
Buggy source:
public void handle(Long vertxTimerId){
  handler.handle(timer);
  if (periodic) {
    Date d=logic.next();
    data.vertxTimerId=vertx.setTimer(Utils.getMsUntilDate(logic.next()),this);
  }
 else {
    timers.remove(timer);
  }
}

Fixed version (ground truth):
public void handle(Long vertxTimerId){
  if (periodic) {
    timer.next=logic.next();
    handler.handle(timer);
    data.vertxTimerId=vertx.setTimer(Utils.getMsUntilDate(timer.next),this);
  }
 else {
    timer.next=null;
    handler.handle(timer);
    timers.remove(timer);
  }
}
Program: 35218
Project: 35218
Buggy source:
@PreDestroy public void closeAll(){
  for (  RMISampleProvider sensor : sensorMap.values()) {
    try {
      sensor.close();
    }
 catch (    RemoteException e) {
      L.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@PreDestroy public void closeAll(){
  for (  String port : sensorMap.keySet()) {
    try {
      L.info("String_Node_Str",port);
      sensorMap.get(port).close();
      sensorMap.remove(port);
    }
 catch (    RemoteException e) {
      L.error("String_Node_Str",port,e);
    }
  }
}
Program: 35219
Project: 35219
Buggy source:
private double rangeSearchKNN(Node<T> node,double[] center,ArrayList<KDEntryDist<T>> candidates,int k,int depth,double maxRange){
  int pos=depth % dims;
  if (node.getLo() != null && (center[pos] < node.getKey()[pos] || node.getHi() == null)) {
    maxRange=rangeSearchKNN(node.getLo(),center,candidates,k,depth + 1,maxRange);
    if (center[pos] + maxRange >= node.getKey()[pos]) {
      maxRange=addCandidate(node,center,candidates,k,maxRange);
    }
    if (node.getHi() != null) {
      maxRange=rangeSearchKNN(node.getHi(),center,candidates,k,depth + 1,maxRange);
    }
  }
 else   if (node.getHi() != null) {
    maxRange=rangeSearchKNN(node.getHi(),center,candidates,k,depth + 1,maxRange);
    if (center[pos] <= node.getKey()[pos] + maxRange) {
      maxRange=addCandidate(node,center,candidates,k,maxRange);
    }
    if (node.getLo() != null) {
      maxRange=rangeSearchKNN(node.getLo(),center,candidates,k,depth + 1,maxRange);
    }
  }
 else {
    maxRange=addCandidate(node,center,candidates,k,maxRange);
  }
  return maxRange;
}

Fixed version (ground truth):
private double rangeSearchKNN(Node<T> node,double[] center,ArrayList<KDEntryDist<T>> candidates,int k,int depth,double maxRange){
  int pos=depth % dims;
  if (node.getLo() != null && (center[pos] < node.getKey()[pos] || node.getHi() == null)) {
    maxRange=rangeSearchKNN(node.getLo(),center,candidates,k,depth + 1,maxRange);
    if (center[pos] + maxRange >= node.getKey()[pos]) {
      maxRange=addCandidate(node,center,candidates,k,maxRange);
      if (node.getHi() != null) {
        maxRange=rangeSearchKNN(node.getHi(),center,candidates,k,depth + 1,maxRange);
      }
    }
  }
 else   if (node.getHi() != null) {
    maxRange=rangeSearchKNN(node.getHi(),center,candidates,k,depth + 1,maxRange);
    if (center[pos] <= node.getKey()[pos] + maxRange) {
      maxRange=addCandidate(node,center,candidates,k,maxRange);
      if (node.getLo() != null) {
        maxRange=rangeSearchKNN(node.getLo(),center,candidates,k,depth + 1,maxRange);
      }
    }
  }
 else {
    maxRange=addCandidate(node,center,candidates,k,maxRange);
  }
  return maxRange;
}
Program: 35220
Project: 35220
Buggy source:
@SuppressWarnings("String_Node_Str") QEntry<T> update(QNode<T> parent,double[] keyOld,double[] keyNew,int maxNodeSize,boolean[] requiresReinsert,int currentDepth,int maxDepth){
  if (values == null) {
    QNode<T> sub=findSubNode(keyOld);
    if (sub == null) {
      return null;
    }
    QEntry<T> ret=sub.update(this,keyOld,keyNew,maxNodeSize,requiresReinsert,currentDepth + 1,maxDepth);
    if (ret != null && requiresReinsert[0] && QUtil.isPointEnclosed(ret.point(),center,radius / QUtil.EPS_MUL)) {
      requiresReinsert[0]=false;
      Object r=this;
      while (r instanceof QNode) {
        r=((QNode<T>)r).tryPut(ret,maxNodeSize,currentDepth++ > maxDepth);
      }
    }
    return ret;
  }
  for (int i=0; i < values.size(); i++) {
    QEntry<T> e=values.get(i);
    if (QUtil.isPointEqual(e.point(),keyOld)) {
      values.remove(i);
      e.setKey(keyNew);
      if (QUtil.isPointEnclosed(keyNew,center,radius / QUtil.EPS_MUL)) {
        values.add(e);
        requiresReinsert[0]=false;
      }
 else {
        requiresReinsert[0]=true;
        if (parent != null) {
          parent.checkAndMergeLeafNodes(maxNodeSize);
        }
      }
      return e;
    }
  }
  requiresReinsert[0]=false;
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") QEntry<T> update(QNode<T> parent,double[] keyOld,double[] keyNew,int maxNodeSize,boolean[] requiresReinsert,int currentDepth,int maxDepth){
  if (values == null) {
    QNode<T> sub=findSubNode(keyOld);
    if (sub == null) {
      return null;
    }
    QEntry<T> ret=sub.update(this,keyOld,keyNew,maxNodeSize,requiresReinsert,currentDepth + 1,maxDepth);
    if (ret != null && requiresReinsert[0] && QUtil.isPointEnclosed(ret.point(),center,radius)) {
      requiresReinsert[0]=false;
      Object r=this;
      while (r instanceof QNode) {
        r=((QNode<T>)r).tryPut(ret,maxNodeSize,currentDepth++ > maxDepth);
      }
    }
    return ret;
  }
  for (int i=0; i < values.size(); i++) {
    QEntry<T> e=values.get(i);
    if (QUtil.isPointEqual(e.point(),keyOld)) {
      values.remove(i);
      e.setKey(keyNew);
      if (QUtil.isPointEnclosed(keyNew,center,radius)) {
        values.add(e);
        requiresReinsert[0]=false;
      }
 else {
        requiresReinsert[0]=true;
        if (parent != null) {
          parent.checkAndMergeLeafNodes(maxNodeSize);
        }
      }
      return e;
    }
  }
  requiresReinsert[0]=false;
  return null;
}
Program: 35221
Project: 35221
Buggy source:
/** 
 * Reinsert the key.
 * @param oldKey old key
 * @param newKey new key
 * @return the value associated with the key or 'null' if the key was not found.
 */
@Override @SuppressWarnings("String_Node_Str") public T update(double[] oldKey,double[] newKey){
  if (root == null) {
    return null;
  }
  boolean[] requiresReinsert=new boolean[]{false};
  QEntry<T> e=root.update(null,oldKey,newKey,maxNodeSize,requiresReinsert,0,MAX_DEPTH);
  if (e == null) {
    System.err.println("String_Node_Str" + Arrays.toString(newKey));
    return null;
  }
  if (requiresReinsert[0]) {
    System.err.println("String_Node_Str" + Arrays.toString(newKey));
    ensureCoverage(e);
    Object r=root;
    int depth=0;
    while (r instanceof QNode) {
      r=((QNode<T>)r).tryPut(e,maxNodeSize,depth++ > MAX_DEPTH);
    }
  }
  return e.value();
}

Fixed version (ground truth):
/** 
 * Reinsert the key.
 * @param oldKey old key
 * @param newKey new key
 * @return the value associated with the key or 'null' if the key was not found.
 */
@Override @SuppressWarnings("String_Node_Str") public T update(double[] oldKey,double[] newKey){
  if (root == null) {
    return null;
  }
  boolean[] requiresReinsert=new boolean[]{false};
  QEntry<T> e=root.update(null,oldKey,newKey,maxNodeSize,requiresReinsert,0,MAX_DEPTH);
  if (e == null) {
    if (DEBUG) {
      System.err.println("String_Node_Str" + Arrays.toString(oldKey) + "String_Node_Str"+ Arrays.toString(newKey));
    }
    return null;
  }
  if (requiresReinsert[0]) {
    if (DEBUG) {
      System.err.println("String_Node_Str" + Arrays.toString(oldKey) + "String_Node_Str"+ Arrays.toString(newKey));
    }
    ensureCoverage(e);
    Object r=root;
    int depth=0;
    while (r instanceof QNode) {
      r=((QNode<T>)r).tryPut(e,maxNodeSize,depth++ > MAX_DEPTH);
    }
  }
  return e.value();
}
Program: 35222
Project: 35222
Buggy source:
/** 
 * Remove a key.
 * @param key key to remove
 * @return the value associated with the key or 'null' if the key was not found
 */
@Override public T remove(double[] key){
  if (root == null) {
    System.err.println("String_Node_Str" + Arrays.toString(key));
    return null;
  }
  QEntry<T> e=root.remove(null,key,maxNodeSize);
  if (e == null) {
    System.err.println("String_Node_Str" + Arrays.toString(key));
    return null;
  }
  size--;
  return e.value();
}

Fixed version (ground truth):
/** 
 * Remove a key.
 * @param key key to remove
 * @return the value associated with the key or 'null' if the key was not found
 */
@Override public T remove(double[] key){
  if (root == null) {
    if (DEBUG) {
      System.err.println("String_Node_Str" + Arrays.toString(key));
    }
    return null;
  }
  QEntry<T> e=root.remove(null,key,maxNodeSize);
  if (e == null) {
    if (DEBUG) {
      System.err.println("String_Node_Str" + Arrays.toString(key));
    }
    return null;
  }
  size--;
  return e.value();
}
Program: 35223
Project: 35223
Buggy source:
private void initializeRoot(double[] key){
  double lo=Double.MAX_VALUE;
  double hi=-Double.MAX_VALUE;
  for (int d=0; d < dims; d++) {
    lo=lo > key[d] ? key[d] : lo;
    hi=hi < key[d] ? key[d] : hi;
  }
  if (lo == 0 && hi == 0) {
    hi=1.0;
  }
  double maxDistOrigin=Math.abs(hi) > Math.abs(lo) ? hi : lo;
  maxDistOrigin=Math.abs(maxDistOrigin);
  double[] center=new double[dims];
  for (int d=0; d < dims; d++) {
    center[d]=key[d] > 0 ? maxDistOrigin : -maxDistOrigin;
  }
  root=new QNode<>(center,maxDistOrigin);
}

Fixed version (ground truth):
private void initializeRoot(double[] key){
  double lo=Double.MAX_VALUE;
  double hi=-Double.MAX_VALUE;
  for (int d=0; d < dims; d++) {
    lo=lo > key[d] ? key[d] : lo;
    hi=hi < key[d] ? key[d] : hi;
  }
  if (lo == 0 && hi == 0) {
    hi=1.0;
  }
  double maxDistOrigin=Math.abs(hi) > Math.abs(lo) ? hi : lo;
  maxDistOrigin=Math.abs(maxDistOrigin);
  maxDistOrigin*=QUtil.EPS_MUL * QUtil.EPS_MUL;
  double[] center=new double[dims];
  for (int d=0; d < dims; d++) {
    center[d]=key[d] > 0 ? maxDistOrigin : -maxDistOrigin;
  }
  root=new QNode<>(center,maxDistOrigin);
}
Program: 35224
Project: 35224
Buggy source:
@SuppressWarnings("String_Node_Str") QEntry<T> update(QNode<T> parent,double[] keyOld,double[] keyNew,int maxNodeSize,boolean[] requiresReinsert,int currentDepth,int maxDepth){
  if (values == null) {
    int pos=calcSubPosition(keyOld);
    QNode<T> sub=subs[pos];
    if (sub == null) {
      return null;
    }
    QEntry<T> ret=sub.update(this,keyOld,keyNew,maxNodeSize,requiresReinsert,currentDepth + 1,maxDepth);
    if (ret != null && requiresReinsert[0] && QUtil.isPointEnclosed(ret.point(),center,radius)) {
      requiresReinsert[0]=false;
      Object r=this;
      while (r instanceof QNode) {
        r=((QNode<T>)r).tryPut(ret,maxNodeSize,currentDepth++ > maxDepth);
      }
    }
    return ret;
  }
  for (int i=0; i < values.size(); i++) {
    QEntry<T> e=values.get(i);
    if (QUtil.isPointEqual(e.point(),keyOld)) {
      values.remove(i);
      e.setKey(keyNew);
      if (QUtil.isPointEnclosed(keyNew,center,radius)) {
        values.add(e);
        requiresReinsert[0]=false;
      }
 else {
        requiresReinsert[0]=true;
        if (parent != null) {
          parent.checkAndMergeLeafNodes(maxNodeSize);
        }
      }
      return e;
    }
  }
  requiresReinsert[0]=false;
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") QEntry<T> update(QNode<T> parent,double[] keyOld,double[] keyNew,int maxNodeSize,boolean[] requiresReinsert,int currentDepth,int maxDepth){
  if (values == null) {
    int pos=calcSubPosition(keyOld);
    QNode<T> sub=subs[pos];
    if (sub == null) {
      return null;
    }
    QEntry<T> ret=sub.update(this,keyOld,keyNew,maxNodeSize,requiresReinsert,currentDepth + 1,maxDepth);
    if (ret != null && requiresReinsert[0] && QUtil.isPointEnclosed(ret.point(),center,radius / QUtil.EPS_MUL)) {
      requiresReinsert[0]=false;
      Object r=this;
      while (r instanceof QNode) {
        r=((QNode<T>)r).tryPut(ret,maxNodeSize,currentDepth++ > maxDepth);
      }
    }
    return ret;
  }
  for (int i=0; i < values.size(); i++) {
    QEntry<T> e=values.get(i);
    if (QUtil.isPointEqual(e.point(),keyOld)) {
      values.remove(i);
      e.setKey(keyNew);
      if (QUtil.isPointEnclosed(keyNew,center,radius / QUtil.EPS_MUL)) {
        values.add(e);
        requiresReinsert[0]=false;
      }
 else {
        requiresReinsert[0]=true;
        if (parent != null) {
          parent.checkAndMergeLeafNodes(maxNodeSize);
        }
      }
      return e;
    }
  }
  requiresReinsert[0]=false;
  return null;
}
Program: 35226
Project: 35226
Buggy source:
private QRNode<T> createSubForEntry(QREntry<T> e){
  double[] centerSub=new double[center.length];
  double[] pMin=e.lower();
  double radiusSub=radius / 2.0;
  for (int d=0; d < center.length; d++) {
    if (pMin[d] >= center[d]) {
      centerSub[d]=center[d] + radiusSub;
    }
 else {
      centerSub[d]=center[d] - radiusSub;
    }
  }
  return new QRNode<>(centerSub,radiusSub);
}

Fixed version (ground truth):
private QRNode<T> createSubForEntry(QREntry<T> e){
  double[] centerSub=new double[center.length];
  double[] pMin=e.lower();
  double radiusSub=radius / 2.0;
  for (int d=0; d < center.length; d++) {
    if (pMin[d] >= center[d]) {
      centerSub[d]=center[d] + radiusSub;
    }
 else {
      centerSub[d]=center[d] - radiusSub;
    }
  }
  QRNode<T> n=new QRNode<>(centerSub,radiusSub);
  subs.add(n);
  return n;
}
Program: 35227
Project: 35227
Buggy source:
@SuppressWarnings("String_Node_Str") QRNode<T> tryPut(QREntry<T> e,int maxNodeSize,boolean enforceLeaf){
  if (QuadTreeKD0.DEBUG && !e.enclosedBy(center,radius)) {
    throw new IllegalStateException("String_Node_Str" + e + "String_Node_Str"+ Arrays.toString(center)+ "String_Node_Str"+ radius);
  }
  QRNode<T> sub1=findSubNode(e.lower(),e.upper());
  if (sub1 != null && sub1 != this) {
    return getOrCreateSubR(e);
  }
  if (values == null) {
    values=new ArrayList<>();
  }
  if (values.size() < maxNodeSize || enforceLeaf || e.isExact(values.get(0)) || subs != null) {
    values.add(e);
    return null;
  }
  ArrayList<QREntry<T>> vals=values;
  values=null;
  subs=new ArrayList<>();
  for (int i=0; i < vals.size(); i++) {
    QREntry<T> e2=vals.get(i);
    QRNode<T> sub2=findSubNode(e2.lower(),e2.upper());
    if (sub2 == this) {
      if (values == null) {
        values=new ArrayList<>();
      }
      values.add(e2);
      continue;
    }
    QRNode<T> sub=getOrCreateSubR(e2);
    while (sub != null) {
      sub=(QRNode<T>)sub.tryPut(e2,maxNodeSize,false);
    }
  }
  return getOrCreateSubR(e);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") QRNode<T> tryPut(QREntry<T> e,int maxNodeSize,boolean enforceLeaf){
  if (QuadTreeKD0.DEBUG && !e.enclosedBy(center,radius)) {
    throw new IllegalStateException("String_Node_Str" + e + "String_Node_Str"+ Arrays.toString(center)+ "String_Node_Str"+ radius);
  }
  QRNode<T> sub1=findSubNode(e.lower(),e.upper());
  if (subs != null && sub1 != this) {
    if (sub1 == null) {
      sub1=createSubForEntry(e);
    }
    return sub1;
  }
  if (values == null) {
    values=new ArrayList<>();
  }
  if (values.size() < maxNodeSize || enforceLeaf || e.isExact(values.get(0)) || subs != null) {
    values.add(e);
    return null;
  }
  ArrayList<QREntry<T>> vals=values;
  vals.add(e);
  values=null;
  subs=new ArrayList<>();
  for (int i=0; i < vals.size(); i++) {
    QREntry<T> e2=vals.get(i);
    QRNode<T> sub=findSubNode(e2.lower(),e2.upper());
    if (sub == this) {
      if (values == null) {
        values=new ArrayList<>();
      }
      values.add(e2);
      continue;
    }
    if (sub == null) {
      sub=createSubForEntry(e2);
    }
    while (sub != null) {
      sub=(QRNode<T>)sub.tryPut(e2,maxNodeSize,false);
    }
  }
  return null;
}
Program: 35229
Project: 35229
Buggy source:
/** 
 * The subnode position has reverse ordering of the point's dimension ordering. Dimension 0 of a point is the highest ordered bit in the position.
 * @param p point
 * @return subnode position
 */
private QRNode<T> findSubNode(double[] pMin,double[] pMax){
  if (subs != null) {
    for (int i=0; i < subs.size(); i++) {
      QRNode<T> n=subs.get(i);
      if (QUtil.isRectEnclosed(pMin,pMax,n.center,n.radius)) {
        return n;
      }
    }
  }
  if (QUtil.isPointEnclosed(center,pMin,pMax)) {
    return this;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * The subnode position has reverse ordering of the point's dimension ordering. Dimension 0 of a point is the highest ordered bit in the position.
 * @param p point
 * @return subnode position
 */
private QRNode<T> findSubNode(double[] pMin,double[] pMax){
  if (subs != null) {
    for (int i=0; i < subs.size(); i++) {
      QRNode<T> n=subs.get(i);
      if (QUtil.isRectEnclosed(pMin,pMax,n.center,n.radius)) {
        return n;
      }
    }
  }
  for (int i=0; i < center.length; i++) {
    if (pMin[i] < center[i] && pMax[i] >= center[i]) {
      return this;
    }
  }
  return null;
}
Program: 35230
Project: 35230
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) QRNode<T> tryPut(QREntry<T> e,int maxNodeSize,boolean enforceLeaf){
  if (QuadTreeKD.DEBUG && !e.enclosedBy(center,radius)) {
    throw new IllegalStateException("String_Node_Str" + e + "String_Node_Str"+ Arrays.toString(center)+ "String_Node_Str"+ radius);
  }
  int pos=calcSubPositionR(e.lower(),e.upper());
  if (subs != null && pos != OVERLAP_WITH_CENTER) {
    return getOrCreateSubR(pos);
  }
  if (values == null) {
    values=new ArrayList<>();
  }
  if (values.size() < maxNodeSize || enforceLeaf || e.isExact(values.get(0)) || subs != null) {
    values.add(e);
    return null;
  }
  ArrayList<QREntry<T>> vals=values;
  values=null;
  subs=new QRNode[1 << center.length];
  for (int i=0; i < vals.size(); i++) {
    QREntry<T> e2=vals.get(i);
    int pos2=calcSubPositionR(e2.lower(),e2.upper());
    if (pos2 == OVERLAP_WITH_CENTER) {
      if (values == null) {
        values=new ArrayList<>();
      }
      values.add(e2);
      continue;
    }
    QRNode<T> sub=getOrCreateSubR(pos2);
    while (sub != null) {
      sub=(QRNode<T>)sub.tryPut(e2,maxNodeSize,false);
    }
  }
  if (pos == OVERLAP_WITH_CENTER) {
    if (values == null) {
      values=new ArrayList<>();
    }
    values.add(e);
    return null;
  }
  return getOrCreateSubR(pos);
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) QRNode<T> tryPut(QREntry<T> e,int maxNodeSize,boolean enforceLeaf){
  if (QuadTreeKD.DEBUG && !e.enclosedBy(center,radius)) {
    throw new IllegalStateException("String_Node_Str" + e + "String_Node_Str"+ Arrays.toString(center)+ "String_Node_Str"+ radius);
  }
  int pos=calcSubPositionR(e.lower(),e.upper());
  if (subs != null && pos != OVERLAP_WITH_CENTER) {
    return getOrCreateSubR(pos);
  }
  if (values == null) {
    values=new ArrayList<>();
  }
  if (values.size() < maxNodeSize || enforceLeaf || e.isExact(values.get(0)) || subs != null) {
    values.add(e);
    return null;
  }
  ArrayList<QREntry<T>> vals=values;
  vals.add(e);
  values=null;
  subs=new QRNode[1 << center.length];
  for (int i=0; i < vals.size(); i++) {
    QREntry<T> e2=vals.get(i);
    int pos2=calcSubPositionR(e2.lower(),e2.upper());
    if (pos2 == OVERLAP_WITH_CENTER) {
      if (values == null) {
        values=new ArrayList<>();
      }
      values.add(e2);
      continue;
    }
    QRNode<T> sub=getOrCreateSubR(pos2);
    while (sub != null) {
      sub=(QRNode<T>)sub.tryPut(e2,maxNodeSize,false);
    }
  }
  return null;
}
Program: 35232
Project: 35232
Buggy source:
public static void main(String[] args){
  final int DIM=3;
  final int N=1 * 1000 * 1000;
  TestStats s0=new TestStats(TST.CUBE,INDEX.RSTAR,N,DIM,false,1.0);
  s0.setSeed(0);
  TestRunner test=new TestRunner(s0);
  TestStats s=test.run();
  System.out.println(s);
}

Fixed version (ground truth):
public static void main(String[] args){
  final int DIM=3;
  final int N=1 * 1000 * 1000;
  TestStats s0=new TestStats(TST.CUBE,INDEX.QUAD,N,DIM,true,1.0);
  s0.cfgPointQueryRepeat=1000 * 1000;
  s0.setSeed(0);
  TestRunner test=new TestRunner(s0);
  TestStats s=test.run();
  System.out.println(s);
}
Program: 35233
Project: 35233
Buggy source:
private boolean checkMatch(long[] keyTemplate,int currentDepth){
  int i;
  boolean loMatch=false;
  boolean hiMatch=false;
  for (i=0; (i + 1) * 64 <= currentDepth; i++) {
    if ((!loMatch && minOrig[i] > keyTemplate[i]) || (!hiMatch && keyTemplate[i] > maxOrig[i])) {
      return false;
    }
    if (minOrig[i] < keyTemplate[i]) {
      loMatch=true;
      if (loMatch && hiMatch) {
        break;
      }
    }
    if (keyTemplate[i] < maxOrig[i]) {
      hiMatch=true;
      if (loMatch && hiMatch) {
        break;
      }
    }
  }
  if ((i + 1) * 64 != currentDepth + 1) {
    int toIgnore=((i + 1) * 64) - currentDepth;
    long mask=(-1L) << toIgnore;
    if (!loMatch && (minOrig[i] & mask) > (keyTemplate[i] & mask)) {
      return false;
    }
    if (!hiMatch && (keyTemplate[i] & mask) > (maxOrig[i] & mask)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean checkMatch(long[] keyTemplate,int startBit,int currentDepth){
  int i;
  int iStart=startBit >>> BITS_LOG_64;
  boolean loMatch=iStart == 0 ? false : loEnclosed[iStart - 1];
  boolean hiMatch=iStart == 0 ? false : hiEnclosed[iStart - 1];
  for (i=iStart; i < (currentDepth + 1) >>> BITS_LOG_64; i++) {
    if ((!loMatch && minOrig[i] > keyTemplate[i]) || (!hiMatch && keyTemplate[i] > maxOrig[i])) {
      return false;
    }
    if (minOrig[i] < keyTemplate[i]) {
      loMatch=true;
      if (loMatch && hiMatch) {
        break;
      }
    }
    if (keyTemplate[i] < maxOrig[i]) {
      hiMatch=true;
      if (loMatch && hiMatch) {
        break;
      }
    }
    loEnclosed[i]=loMatch;
    hiEnclosed[i]=hiMatch;
  }
  if (loMatch && hiMatch) {
    for (; i < (currentDepth + 1) >>> BITS_LOG_64; i++) {
      loEnclosed[i]=loMatch;
      hiEnclosed[i]=hiMatch;
    }
    return true;
  }
  int toCheck=(currentDepth + 1) & BITS_MASK_6;
  if (toCheck != 0) {
    long mask=~((-1L) >>> toCheck);
    if (!loMatch && (minOrig[i] & mask) > (keyTemplate[i] & mask)) {
      return false;
    }
    if (!hiMatch && (keyTemplate[i] & mask) > (maxOrig[i] & mask)) {
      return false;
    }
  }
  return true;
}
Program: 35234
Project: 35234
Buggy source:
@SuppressWarnings("String_Node_Str") public QueryIteratorKD(CritBit<V> cb,long[] minOrig,long[] maxOrig,int DIM,int DEPTH){
  this.stack=new Node[DIM * DEPTH];
  this.readHigherNext=new byte[DIM * DEPTH];
  this.keyOrigTemplate=new long[DIM];
  this.minOrig=minOrig;
  this.maxOrig=maxOrig;
  this.DIM=DIM;
  this.DIM_INV_16=1 + ((1 << 16) + 1) / DIM;
  this.DEPTH=DEPTH;
  this.DEPTH_OFFS=64 - DEPTH;
  if (cb.rootKey != null) {
    readPostFixAndSplit(cb.rootKey,0,keyOrigTemplate);
    checkMatchOrigKDFullIntoNextVal(keyOrigTemplate,cb.rootVal);
    return;
  }
  if (cb.root == null) {
    return;
  }
  Node<V> n=cb.root;
  readAndSplitInfix(n,keyOrigTemplate);
  if (!checkMatchOrigKD(keyOrigTemplate,n.posDiff)) {
    return;
  }
  stack[++stackTop]=cb.root;
  findNext();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public QueryIteratorKD(CritBit<V> cb,long[] minOrig,long[] maxOrig,int DIM,int DEPTH){
  this.stack=new Node[DIM * DEPTH];
  this.readHigherNext=new byte[DIM * DEPTH];
  this.keyOrigTemplate=new long[DIM];
  this.minOrig=minOrig;
  this.maxOrig=maxOrig;
  this.DIM=DIM;
  this.DIM_INV_16=1 + ((1 << 16) + 1) / DIM;
  this.DEPTH=DEPTH;
  this.DEPTH_OFFS=64 - DEPTH;
  if (cb.rootKey != null) {
    readPostFixAndSplit(cb.rootKey,0,keyOrigTemplate);
    checkMatchOrigKDFullIntoNextVal(keyOrigTemplate,cb.rootVal);
    return;
  }
  if (cb.root == null) {
    return;
  }
  Node<V> n=cb.root;
  readAndSplitInfix(n,keyOrigTemplate);
  if (n.posDiff > 0 && !checkMatchOrigKD(keyOrigTemplate,n.posDiff - 1)) {
    return;
  }
  stack[++stackTop]=cb.root;
  findNext();
}
Program: 35235
Project: 35235
Buggy source:
private boolean checkMatchOrigKD(long[] keyOrigTemplate,int currentDepth){
  int commonDepth=getDepthAcrossDims(currentDepth);
  int openBits=DEPTH - commonDepth;
  long minMask=(-1L) << openBits;
  long maxMask=~minMask;
  int kLimit=currentDepth - DIM * commonDepth;
  if (kLimit == 0) {
    for (int k=0; k < DIM; k++) {
      if (minOrig[k] > (keyOrigTemplate[k] | maxMask) || (keyOrigTemplate[k] & minMask) > maxOrig[k]) {
        return false;
      }
    }
    return true;
  }
  for (int k=kLimit; k < DIM; k++) {
    if (minOrig[k] > (keyOrigTemplate[k] | maxMask) || (keyOrigTemplate[k] & minMask) > maxOrig[k]) {
      return false;
    }
  }
  maxMask>>>=1;
  minMask=~maxMask;
  for (int k=0; k < kLimit; k++) {
    if (minOrig[k] > (keyOrigTemplate[k] | maxMask) || (keyOrigTemplate[k] & minMask) > maxOrig[k]) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean checkMatchOrigKD(long[] keyOrigTemplate,int currentDepth){
  int commonBits=(currentDepth + 1) / DIM;
  int openBits=DEPTH - commonBits;
  long minMask=(-1L) << openBits;
  long maxMask=~minMask;
  int kLimit=(currentDepth + 1) - DIM * commonBits;
  if (kLimit == 0) {
    for (int k=0; k < DIM; k++) {
      if (minOrig[k] > (keyOrigTemplate[k] | maxMask) || (keyOrigTemplate[k] & minMask) > maxOrig[k]) {
        return false;
      }
    }
    return true;
  }
  for (int k=kLimit; k < DIM; k++) {
    if (minOrig[k] > (keyOrigTemplate[k] | maxMask) || (keyOrigTemplate[k] & minMask) > maxOrig[k]) {
      return false;
    }
  }
  maxMask>>>=1;
  minMask=~maxMask;
  for (int k=0; k < kLimit; k++) {
    if (minOrig[k] > (keyOrigTemplate[k] | maxMask) || (keyOrigTemplate[k] & minMask) > maxOrig[k]) {
      return false;
    }
  }
  return true;
}