nus-yam/ex-repair huggingface dataset:
Program: 196635
Project: 196635
Buggy source:
final void dumpDbInfo(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  pw.println("String_Node_Str");
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpDbInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}

Fixed version (ground truth):
final void dumpDbInfo(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,false,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  pw.println("String_Node_Str");
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpDbInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}
Program: 196637
Project: 196637
Buggy source:
ArrayList<ProcessRecord> collectProcesses(PrintWriter pw,int start,String[] args){
  ArrayList<ProcessRecord> procs;
synchronized (this) {
    if (args != null && args.length > start && args[start].charAt(0) != '-') {
      procs=new ArrayList<ProcessRecord>();
      int pid=-1;
      try {
        pid=Integer.parseInt(args[start]);
      }
 catch (      NumberFormatException e) {
      }
      for (int i=mLruProcesses.size() - 1; i >= 0; i--) {
        ProcessRecord proc=mLruProcesses.get(i);
        if (proc.pid == pid) {
          procs.add(proc);
        }
 else         if (proc.processName.equals(args[start])) {
          procs.add(proc);
        }
      }
      if (procs.size() <= 0) {
        return null;
      }
    }
 else {
      procs=new ArrayList<ProcessRecord>(mLruProcesses);
    }
  }
  return procs;
}

Fixed version (ground truth):
ArrayList<ProcessRecord> collectProcesses(PrintWriter pw,int start,boolean allPkgs,String[] args){
  ArrayList<ProcessRecord> procs;
synchronized (this) {
    if (args != null && args.length > start && args[start].charAt(0) != '-') {
      procs=new ArrayList<ProcessRecord>();
      int pid=-1;
      try {
        pid=Integer.parseInt(args[start]);
      }
 catch (      NumberFormatException e) {
      }
      for (int i=mLruProcesses.size() - 1; i >= 0; i--) {
        ProcessRecord proc=mLruProcesses.get(i);
        if (proc.pid == pid) {
          procs.add(proc);
        }
 else         if (allPkgs && proc.pkgList != null && proc.pkgList.containsKey(args[start])) {
          procs.add(proc);
        }
 else         if (proc.processName.equals(args[start])) {
          procs.add(proc);
        }
      }
      if (procs.size() <= 0) {
        return null;
      }
    }
 else {
      procs=new ArrayList<ProcessRecord>(mLruProcesses);
    }
  }
  return procs;
}
Program: 196638
Project: 196638
Buggy source:
final void dumpGraphicsHardwareUsage(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpGfxInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}

Fixed version (ground truth):
final void dumpGraphicsHardwareUsage(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,false,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpGfxInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}
Program: 196640
Project: 196640
Buggy source:
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}

Fixed version (ground truth):
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    cancelFadeAnimations();
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}
Program: 196641
Project: 196641
Buggy source:
private void fadeBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}

Fixed version (ground truth):
private void fadeBackground(){
  mBackgroundNormal.animate().cancel();
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}
Program: 196643
Project: 196643
Buggy source:
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}

Fixed version (ground truth):
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    cancelFadeAnimations();
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}
Program: 196644
Project: 196644
Buggy source:
private void fadeBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}

Fixed version (ground truth):
private void fadeBackground(){
  mBackgroundNormal.animate().cancel();
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}
Program: 196645
Project: 196645
Buggy source:
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}

Fixed version (ground truth):
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    cancelFadeAnimations();
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}
Program: 196646
Project: 196646
Buggy source:
private void fadeBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}

Fixed version (ground truth):
private void fadeBackground(){
  mBackgroundNormal.animate().cancel();
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}
Program: 196650
Project: 196650
Buggy source:
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}

Fixed version (ground truth):
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    cancelFadeAnimations();
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}
Program: 196651
Project: 196651
Buggy source:
private void fadeBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}

Fixed version (ground truth):
private void fadeBackground(){
  mBackgroundNormal.animate().cancel();
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}
Program: 196652
Project: 196652
Buggy source:
@Override public void onBluetoothPairedDevicesChanged(){
  mUiHandler.post(new Runnable(){
    @Override public void run(){
      mDetailAdapter.updateItems();
    }
  }
);
}

Fixed version (ground truth):
@Override public void onBluetoothPairedDevicesChanged(){
  mUiHandler.post(new Runnable(){
    @Override public void run(){
      mDetailAdapter.updateItems();
    }
  }
);
  refreshState();
}
Program: 196653
Project: 196653
Buggy source:
@Override public void onBluetoothPairedDevicesChanged(){
  mUiHandler.post(new Runnable(){
    @Override public void run(){
      mDetailAdapter.updateItems();
    }
  }
);
}

Fixed version (ground truth):
@Override public void onBluetoothPairedDevicesChanged(){
  mUiHandler.post(new Runnable(){
    @Override public void run(){
      mDetailAdapter.updateItems();
    }
  }
);
  refreshState();
}
Program: 196654
Project: 196654
Buggy source:
@Override public void onBluetoothPairedDevicesChanged(){
  mUiHandler.post(new Runnable(){
    @Override public void run(){
      mDetailAdapter.updateItems();
    }
  }
);
}

Fixed version (ground truth):
@Override public void onBluetoothPairedDevicesChanged(){
  mUiHandler.post(new Runnable(){
    @Override public void run(){
      mDetailAdapter.updateItems();
    }
  }
);
  refreshState();
}
Program: 196655
Project: 196655
Buggy source:
@Override public void onBluetoothPairedDevicesChanged(){
  mUiHandler.post(new Runnable(){
    @Override public void run(){
      mDetailAdapter.updateItems();
    }
  }
);
}

Fixed version (ground truth):
@Override public void onBluetoothPairedDevicesChanged(){
  mUiHandler.post(new Runnable(){
    @Override public void run(){
      mDetailAdapter.updateItems();
    }
  }
);
  refreshState();
}
Program: 196656
Project: 196656
Buggy source:
/** 
 * Called from Parcel.readException() when the exception is EX_STRICT_MODE_VIOLATIONS, we here read back all the encoded violations.
 */
static void readAndHandleBinderCallViolations(Parcel p){
  StringWriter sw=new StringWriter();
  PrintWriter pw=new FastPrintWriter(sw,false,256);
  new LogStackTrace().printStackTrace(pw);
  pw.flush();
  String ourStack=sw.toString();
  int policyMask=getThreadPolicyMask();
  boolean currentlyGathering=(policyMask & PENALTY_GATHER) != 0;
  int numViolations=p.readInt();
  for (int i=0; i < numViolations; ++i) {
    if (LOG_V)     Log.d(TAG,"String_Node_Str" + i);
    ViolationInfo info=new ViolationInfo(p,!currentlyGathering);
    if (info.crashInfo.stackTrace.length() > 10000) {
      while (i < numViolations) {
        info=new ViolationInfo(p,!currentlyGathering);
        i++;
      }
      clearGatheredViolations();
      Slog.wtfStack(TAG,"String_Node_Str" + numViolations + "String_Node_Str"+ Integer.toHexString(policyMask)+ "String_Node_Str"+ info.crashInfo.stackTrace.substring(256));
      return;
    }
    info.crashInfo.stackTrace+="String_Node_Str" + ourStack;
    BlockGuard.Policy policy=BlockGuard.getThreadPolicy();
    if (policy instanceof AndroidBlockGuardPolicy) {
      ((AndroidBlockGuardPolicy)policy).handleViolationWithTimingAttempt(info);
    }
  }
}

Fixed version (ground truth):
/** 
 * Called from Parcel.readException() when the exception is EX_STRICT_MODE_VIOLATIONS, we here read back all the encoded violations.
 */
static void readAndHandleBinderCallViolations(Parcel p){
  StringWriter sw=new StringWriter();
  PrintWriter pw=new FastPrintWriter(sw,false,256);
  new LogStackTrace().printStackTrace(pw);
  pw.flush();
  String ourStack=sw.toString();
  int policyMask=getThreadPolicyMask();
  boolean currentlyGathering=(policyMask & PENALTY_GATHER) != 0;
  int numViolations=p.readInt();
  for (int i=0; i < numViolations; ++i) {
    if (LOG_V)     Log.d(TAG,"String_Node_Str" + i);
    ViolationInfo info=new ViolationInfo(p,!currentlyGathering);
    if (info.crashInfo.stackTrace != null && info.crashInfo.stackTrace.length() > 10000) {
      while (i < numViolations) {
        info=new ViolationInfo(p,!currentlyGathering);
        i++;
      }
      clearGatheredViolations();
      Slog.wtfStack(TAG,"String_Node_Str" + numViolations + "String_Node_Str"+ Integer.toHexString(policyMask)+ "String_Node_Str"+ info.crashInfo.stackTrace.substring(256));
      return;
    }
    info.crashInfo.stackTrace+="String_Node_Str" + ourStack;
    BlockGuard.Policy policy=BlockGuard.getThreadPolicy();
    if (policy instanceof AndroidBlockGuardPolicy) {
      ((AndroidBlockGuardPolicy)policy).handleViolationWithTimingAttempt(info);
    }
  }
}
Program: 196657
Project: 196657
Buggy source:
/** 
 * Called from Parcel.readException() when the exception is EX_STRICT_MODE_VIOLATIONS, we here read back all the encoded violations.
 */
static void readAndHandleBinderCallViolations(Parcel p){
  StringWriter sw=new StringWriter();
  PrintWriter pw=new FastPrintWriter(sw,false,256);
  new LogStackTrace().printStackTrace(pw);
  pw.flush();
  String ourStack=sw.toString();
  int policyMask=getThreadPolicyMask();
  boolean currentlyGathering=(policyMask & PENALTY_GATHER) != 0;
  int numViolations=p.readInt();
  for (int i=0; i < numViolations; ++i) {
    if (LOG_V)     Log.d(TAG,"String_Node_Str" + i);
    ViolationInfo info=new ViolationInfo(p,!currentlyGathering);
    if (info.crashInfo.stackTrace.length() > 10000) {
      while (i < numViolations) {
        info=new ViolationInfo(p,!currentlyGathering);
        i++;
      }
      clearGatheredViolations();
      Slog.wtfStack(TAG,"String_Node_Str" + numViolations + "String_Node_Str"+ Integer.toHexString(policyMask)+ "String_Node_Str"+ info.crashInfo.stackTrace.substring(256));
      return;
    }
    info.crashInfo.stackTrace+="String_Node_Str" + ourStack;
    BlockGuard.Policy policy=BlockGuard.getThreadPolicy();
    if (policy instanceof AndroidBlockGuardPolicy) {
      ((AndroidBlockGuardPolicy)policy).handleViolationWithTimingAttempt(info);
    }
  }
}

Fixed version (ground truth):
/** 
 * Called from Parcel.readException() when the exception is EX_STRICT_MODE_VIOLATIONS, we here read back all the encoded violations.
 */
static void readAndHandleBinderCallViolations(Parcel p){
  StringWriter sw=new StringWriter();
  PrintWriter pw=new FastPrintWriter(sw,false,256);
  new LogStackTrace().printStackTrace(pw);
  pw.flush();
  String ourStack=sw.toString();
  int policyMask=getThreadPolicyMask();
  boolean currentlyGathering=(policyMask & PENALTY_GATHER) != 0;
  int numViolations=p.readInt();
  for (int i=0; i < numViolations; ++i) {
    if (LOG_V)     Log.d(TAG,"String_Node_Str" + i);
    ViolationInfo info=new ViolationInfo(p,!currentlyGathering);
    if (info.crashInfo.stackTrace != null && info.crashInfo.stackTrace.length() > 10000) {
      while (i < numViolations) {
        info=new ViolationInfo(p,!currentlyGathering);
        i++;
      }
      clearGatheredViolations();
      Slog.wtfStack(TAG,"String_Node_Str" + numViolations + "String_Node_Str"+ Integer.toHexString(policyMask)+ "String_Node_Str"+ info.crashInfo.stackTrace.substring(256));
      return;
    }
    info.crashInfo.stackTrace+="String_Node_Str" + ourStack;
    BlockGuard.Policy policy=BlockGuard.getThreadPolicy();
    if (policy instanceof AndroidBlockGuardPolicy) {
      ((AndroidBlockGuardPolicy)policy).handleViolationWithTimingAttempt(info);
    }
  }
}
Program: 196658
Project: 196658
Buggy source:
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper=mOpenHelpers.get(userHandle);
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}

Fixed version (ground truth):
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper;
synchronized (this) {
    dbHelper=mOpenHelpers.get(userHandle);
  }
  if (dbHelper == null) {
    return;
  }
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}
Program: 196659
Project: 196659
Buggy source:
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper=mOpenHelpers.get(callingUser);
    if (null == dbHelper) {
      establishDbTracking(callingUser);
      dbHelper=mOpenHelpers.get(callingUser);
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}

Fixed version (ground truth):
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper;
synchronized (this) {
      dbHelper=mOpenHelpers.get(callingUser);
    }
    if (null == dbHelper) {
      establishDbTracking(callingUser);
synchronized (this) {
        dbHelper=mOpenHelpers.get(callingUser);
      }
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}
Program: 196660
Project: 196660
Buggy source:
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper=mOpenHelpers.get(userHandle);
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}

Fixed version (ground truth):
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper;
synchronized (this) {
    dbHelper=mOpenHelpers.get(userHandle);
  }
  if (dbHelper == null) {
    return;
  }
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}
Program: 196661
Project: 196661
Buggy source:
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper=mOpenHelpers.get(callingUser);
    if (null == dbHelper) {
      establishDbTracking(callingUser);
      dbHelper=mOpenHelpers.get(callingUser);
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}

Fixed version (ground truth):
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper;
synchronized (this) {
      dbHelper=mOpenHelpers.get(callingUser);
    }
    if (null == dbHelper) {
      establishDbTracking(callingUser);
synchronized (this) {
        dbHelper=mOpenHelpers.get(callingUser);
      }
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}
Program: 196662
Project: 196662
Buggy source:
/** 
 * Called from Parcel.readException() when the exception is EX_STRICT_MODE_VIOLATIONS, we here read back all the encoded violations.
 */
static void readAndHandleBinderCallViolations(Parcel p){
  StringWriter sw=new StringWriter();
  PrintWriter pw=new FastPrintWriter(sw,false,256);
  new LogStackTrace().printStackTrace(pw);
  pw.flush();
  String ourStack=sw.toString();
  int policyMask=getThreadPolicyMask();
  boolean currentlyGathering=(policyMask & PENALTY_GATHER) != 0;
  int numViolations=p.readInt();
  for (int i=0; i < numViolations; ++i) {
    if (LOG_V)     Log.d(TAG,"String_Node_Str" + i);
    ViolationInfo info=new ViolationInfo(p,!currentlyGathering);
    if (info.crashInfo.stackTrace.length() > 10000) {
      while (i < numViolations) {
        info=new ViolationInfo(p,!currentlyGathering);
        i++;
      }
      clearGatheredViolations();
      Slog.wtfStack(TAG,"String_Node_Str" + numViolations + "String_Node_Str"+ Integer.toHexString(policyMask)+ "String_Node_Str"+ info.crashInfo.stackTrace.substring(256));
      return;
    }
    info.crashInfo.stackTrace+="String_Node_Str" + ourStack;
    BlockGuard.Policy policy=BlockGuard.getThreadPolicy();
    if (policy instanceof AndroidBlockGuardPolicy) {
      ((AndroidBlockGuardPolicy)policy).handleViolationWithTimingAttempt(info);
    }
  }
}

Fixed version (ground truth):
/** 
 * Called from Parcel.readException() when the exception is EX_STRICT_MODE_VIOLATIONS, we here read back all the encoded violations.
 */
static void readAndHandleBinderCallViolations(Parcel p){
  StringWriter sw=new StringWriter();
  PrintWriter pw=new FastPrintWriter(sw,false,256);
  new LogStackTrace().printStackTrace(pw);
  pw.flush();
  String ourStack=sw.toString();
  int policyMask=getThreadPolicyMask();
  boolean currentlyGathering=(policyMask & PENALTY_GATHER) != 0;
  int numViolations=p.readInt();
  for (int i=0; i < numViolations; ++i) {
    if (LOG_V)     Log.d(TAG,"String_Node_Str" + i);
    ViolationInfo info=new ViolationInfo(p,!currentlyGathering);
    if (info.crashInfo.stackTrace != null && info.crashInfo.stackTrace.length() > 10000) {
      while (i < numViolations) {
        info=new ViolationInfo(p,!currentlyGathering);
        i++;
      }
      clearGatheredViolations();
      Slog.wtfStack(TAG,"String_Node_Str" + numViolations + "String_Node_Str"+ Integer.toHexString(policyMask)+ "String_Node_Str"+ info.crashInfo.stackTrace.substring(256));
      return;
    }
    info.crashInfo.stackTrace+="String_Node_Str" + ourStack;
    BlockGuard.Policy policy=BlockGuard.getThreadPolicy();
    if (policy instanceof AndroidBlockGuardPolicy) {
      ((AndroidBlockGuardPolicy)policy).handleViolationWithTimingAttempt(info);
    }
  }
}
Program: 196663
Project: 196663
Buggy source:
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper=mOpenHelpers.get(userHandle);
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}

Fixed version (ground truth):
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper;
synchronized (this) {
    dbHelper=mOpenHelpers.get(userHandle);
  }
  if (dbHelper == null) {
    return;
  }
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}
Program: 196664
Project: 196664
Buggy source:
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper=mOpenHelpers.get(callingUser);
    if (null == dbHelper) {
      establishDbTracking(callingUser);
      dbHelper=mOpenHelpers.get(callingUser);
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}

Fixed version (ground truth):
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper;
synchronized (this) {
      dbHelper=mOpenHelpers.get(callingUser);
    }
    if (null == dbHelper) {
      establishDbTracking(callingUser);
synchronized (this) {
        dbHelper=mOpenHelpers.get(callingUser);
      }
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}
Program: 196665
Project: 196665
Buggy source:
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper=mOpenHelpers.get(userHandle);
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}

Fixed version (ground truth):
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper;
synchronized (this) {
    dbHelper=mOpenHelpers.get(userHandle);
  }
  if (dbHelper == null) {
    return;
  }
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}
Program: 196666
Project: 196666
Buggy source:
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper=mOpenHelpers.get(callingUser);
    if (null == dbHelper) {
      establishDbTracking(callingUser);
      dbHelper=mOpenHelpers.get(callingUser);
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}

Fixed version (ground truth):
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper;
synchronized (this) {
      dbHelper=mOpenHelpers.get(callingUser);
    }
    if (null == dbHelper) {
      establishDbTracking(callingUser);
synchronized (this) {
        dbHelper=mOpenHelpers.get(callingUser);
      }
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}
Program: 196667
Project: 196667
Buggy source:
/** 
 * Called from Parcel.readException() when the exception is EX_STRICT_MODE_VIOLATIONS, we here read back all the encoded violations.
 */
static void readAndHandleBinderCallViolations(Parcel p){
  StringWriter sw=new StringWriter();
  PrintWriter pw=new FastPrintWriter(sw,false,256);
  new LogStackTrace().printStackTrace(pw);
  pw.flush();
  String ourStack=sw.toString();
  int policyMask=getThreadPolicyMask();
  boolean currentlyGathering=(policyMask & PENALTY_GATHER) != 0;
  int numViolations=p.readInt();
  for (int i=0; i < numViolations; ++i) {
    if (LOG_V)     Log.d(TAG,"String_Node_Str" + i);
    ViolationInfo info=new ViolationInfo(p,!currentlyGathering);
    if (info.crashInfo.stackTrace.length() > 10000) {
      while (i < numViolations) {
        info=new ViolationInfo(p,!currentlyGathering);
        i++;
      }
      clearGatheredViolations();
      Slog.wtfStack(TAG,"String_Node_Str" + numViolations + "String_Node_Str"+ Integer.toHexString(policyMask)+ "String_Node_Str"+ info.crashInfo.stackTrace.substring(256));
      return;
    }
    info.crashInfo.stackTrace+="String_Node_Str" + ourStack;
    BlockGuard.Policy policy=BlockGuard.getThreadPolicy();
    if (policy instanceof AndroidBlockGuardPolicy) {
      ((AndroidBlockGuardPolicy)policy).handleViolationWithTimingAttempt(info);
    }
  }
}

Fixed version (ground truth):
/** 
 * Called from Parcel.readException() when the exception is EX_STRICT_MODE_VIOLATIONS, we here read back all the encoded violations.
 */
static void readAndHandleBinderCallViolations(Parcel p){
  StringWriter sw=new StringWriter();
  PrintWriter pw=new FastPrintWriter(sw,false,256);
  new LogStackTrace().printStackTrace(pw);
  pw.flush();
  String ourStack=sw.toString();
  int policyMask=getThreadPolicyMask();
  boolean currentlyGathering=(policyMask & PENALTY_GATHER) != 0;
  int numViolations=p.readInt();
  for (int i=0; i < numViolations; ++i) {
    if (LOG_V)     Log.d(TAG,"String_Node_Str" + i);
    ViolationInfo info=new ViolationInfo(p,!currentlyGathering);
    if (info.crashInfo.stackTrace != null && info.crashInfo.stackTrace.length() > 10000) {
      while (i < numViolations) {
        info=new ViolationInfo(p,!currentlyGathering);
        i++;
      }
      clearGatheredViolations();
      Slog.wtfStack(TAG,"String_Node_Str" + numViolations + "String_Node_Str"+ Integer.toHexString(policyMask)+ "String_Node_Str"+ info.crashInfo.stackTrace.substring(256));
      return;
    }
    info.crashInfo.stackTrace+="String_Node_Str" + ourStack;
    BlockGuard.Policy policy=BlockGuard.getThreadPolicy();
    if (policy instanceof AndroidBlockGuardPolicy) {
      ((AndroidBlockGuardPolicy)policy).handleViolationWithTimingAttempt(info);
    }
  }
}
Program: 196668
Project: 196668
Buggy source:
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper=mOpenHelpers.get(userHandle);
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}

Fixed version (ground truth):
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper;
synchronized (this) {
    dbHelper=mOpenHelpers.get(userHandle);
  }
  if (dbHelper == null) {
    return;
  }
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}
Program: 196669
Project: 196669
Buggy source:
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper=mOpenHelpers.get(callingUser);
    if (null == dbHelper) {
      establishDbTracking(callingUser);
      dbHelper=mOpenHelpers.get(callingUser);
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}

Fixed version (ground truth):
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper;
synchronized (this) {
      dbHelper=mOpenHelpers.get(callingUser);
    }
    if (null == dbHelper) {
      establishDbTracking(callingUser);
synchronized (this) {
        dbHelper=mOpenHelpers.get(callingUser);
      }
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}
Program: 196670
Project: 196670
Buggy source:
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper=mOpenHelpers.get(userHandle);
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}

Fixed version (ground truth):
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper;
synchronized (this) {
    dbHelper=mOpenHelpers.get(userHandle);
  }
  if (dbHelper == null) {
    return;
  }
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}
Program: 196671
Project: 196671
Buggy source:
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper=mOpenHelpers.get(callingUser);
    if (null == dbHelper) {
      establishDbTracking(callingUser);
      dbHelper=mOpenHelpers.get(callingUser);
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}

Fixed version (ground truth):
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper;
synchronized (this) {
      dbHelper=mOpenHelpers.get(callingUser);
    }
    if (null == dbHelper) {
      establishDbTracking(callingUser);
synchronized (this) {
        dbHelper=mOpenHelpers.get(callingUser);
      }
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}
Program: 196672
Project: 196672
Buggy source:
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper=mOpenHelpers.get(userHandle);
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}

Fixed version (ground truth):
private void fullyPopulateCaches(final int userHandle){
  DatabaseHelper dbHelper;
synchronized (this) {
    dbHelper=mOpenHelpers.get(userHandle);
  }
  if (dbHelper == null) {
    return;
  }
  if (userHandle == UserHandle.USER_OWNER) {
    fullyPopulateCache(dbHelper,TABLE_GLOBAL,sGlobalCache);
  }
  fullyPopulateCache(dbHelper,TABLE_SECURE,sSecureCaches.get(userHandle));
  fullyPopulateCache(dbHelper,TABLE_SYSTEM,sSystemCaches.get(userHandle));
}
Program: 196673
Project: 196673
Buggy source:
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper=mOpenHelpers.get(callingUser);
    if (null == dbHelper) {
      establishDbTracking(callingUser);
      dbHelper=mOpenHelpers.get(callingUser);
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}

Fixed version (ground truth):
private DatabaseHelper getOrEstablishDatabase(int callingUser){
  if (callingUser >= Process.SYSTEM_UID) {
    if (USER_CHECK_THROWS) {
      throw new IllegalArgumentException("String_Node_Str" + callingUser);
    }
 else {
      Slog.wtf(TAG,"String_Node_Str" + callingUser);
    }
  }
  long oldId=Binder.clearCallingIdentity();
  try {
    DatabaseHelper dbHelper;
synchronized (this) {
      dbHelper=mOpenHelpers.get(callingUser);
    }
    if (null == dbHelper) {
      establishDbTracking(callingUser);
synchronized (this) {
        dbHelper=mOpenHelpers.get(callingUser);
      }
    }
    return dbHelper;
  }
  finally {
    Binder.restoreCallingIdentity(oldId);
  }
}