nus-yam/ex-repair huggingface dataset:
Program: 42261
Project: 42261
Buggy source:
/** 
 * If tearDown is true, this only tears down a CONNECTED session. Presently, there is no mechanism for abandoning an INITING/CONNECTING session, but would likely involve cancelling pending async requests or setting a flag or new state to ignore them when they came in
 * @param tearDown true if the underlying DataConnection should bedisconnected.
 * @param reason reason for the clean up.
 */
private void cleanUpConnection(boolean tearDown,String reason){
  if (DBG)   log("String_Node_Str" + reason);
  if (mReconnectIntent != null) {
    AlarmManager am=(AlarmManager)phone.getContext().getSystemService(Context.ALARM_SERVICE);
    am.cancel(mReconnectIntent);
    mReconnectIntent=null;
  }
  setState(State.DISCONNECTING);
  boolean notificationDeferred=false;
  for (  DataConnection conn : dataConnectionList) {
    if (conn != null) {
      if (tearDown) {
        if (DBG)         log("String_Node_Str");
        conn.disconnect(obtainMessage(EVENT_DISCONNECT_DONE,reason));
      }
 else {
        if (DBG)         log("String_Node_Str");
        conn.reset(obtainMessage(EVENT_RESET_DONE,reason));
      }
      notificationDeferred=true;
    }
  }
  stopNetStatPoll();
  if (!notificationDeferred) {
    if (DBG)     log("String_Node_Str");
    gotoIdleAndNotifyDataConnection(reason);
  }
}

Fixed version (ground truth):
/** 
 * If tearDown is true, this only tears down a CONNECTED session. Presently, there is no mechanism for abandoning an INITING/CONNECTING session, but would likely involve cancelling pending async requests or setting a flag or new state to ignore them when they came in
 * @param tearDown true if the underlying DataConnection should bedisconnected.
 * @param reason reason for the clean up.
 */
private void cleanUpConnection(boolean tearDown,String reason){
  if (DBG)   log("String_Node_Str" + reason);
  if (mReconnectIntent != null) {
    AlarmManager am=(AlarmManager)phone.getContext().getSystemService(Context.ALARM_SERVICE);
    am.cancel(mReconnectIntent);
    mReconnectIntent=null;
  }
  setState(State.DISCONNECTING);
  boolean notificationDeferred=false;
  for (  DataConnection conn : dataConnectionList) {
    if (conn != null) {
      if (tearDown) {
        if (DBG)         log("String_Node_Str");
        conn.disconnect(obtainMessage(EVENT_DISCONNECT_DONE,reason));
        notificationDeferred=true;
      }
 else {
        if (DBG)         log("String_Node_Str");
        conn.resetSynchronously();
        notificationDeferred=false;
      }
    }
  }
  stopNetStatPoll();
  if (!notificationDeferred) {
    if (DBG)     log("String_Node_Str");
    gotoIdleAndNotifyDataConnection(reason);
  }
}
Program: 42262
Project: 42262
Buggy source:
/** 
 * If tearDown is true, this only tears down a CONNECTED session. Presently, there is no mechanism for abandoning an INITING/CONNECTING session, but would likely involve cancelling pending async requests or setting a flag or new state to ignore them when they came in
 * @param tearDown true if the underlying GsmDataConnection should bedisconnected.
 * @param reason reason for the clean up.
 */
private void cleanUpConnection(boolean tearDown,String reason){
  if (DBG)   log("String_Node_Str" + reason);
  if (mReconnectIntent != null) {
    AlarmManager am=(AlarmManager)phone.getContext().getSystemService(Context.ALARM_SERVICE);
    am.cancel(mReconnectIntent);
    mReconnectIntent=null;
  }
  setState(State.DISCONNECTING);
  boolean notificationDeferred=false;
  for (  DataConnection conn : pdpList) {
    if (tearDown) {
      if (DBG)       log("String_Node_Str");
      conn.disconnect(obtainMessage(EVENT_DISCONNECT_DONE,reason));
    }
 else {
      if (DBG)       log("String_Node_Str");
      conn.reset(obtainMessage(EVENT_RESET_DONE,reason));
    }
    notificationDeferred=true;
  }
  stopNetStatPoll();
  if (!notificationDeferred) {
    if (DBG)     log("String_Node_Str");
    gotoIdleAndNotifyDataConnection(reason);
  }
}

Fixed version (ground truth):
/** 
 * If tearDown is true, this only tears down a CONNECTED session. Presently, there is no mechanism for abandoning an INITING/CONNECTING session, but would likely involve cancelling pending async requests or setting a flag or new state to ignore them when they came in
 * @param tearDown true if the underlying GsmDataConnection should bedisconnected.
 * @param reason reason for the clean up.
 */
private void cleanUpConnection(boolean tearDown,String reason){
  if (DBG)   log("String_Node_Str" + reason);
  if (mReconnectIntent != null) {
    AlarmManager am=(AlarmManager)phone.getContext().getSystemService(Context.ALARM_SERVICE);
    am.cancel(mReconnectIntent);
    mReconnectIntent=null;
  }
  setState(State.DISCONNECTING);
  boolean notificationDeferred=false;
  for (  DataConnection conn : pdpList) {
    if (tearDown) {
      if (DBG)       log("String_Node_Str");
      conn.disconnect(obtainMessage(EVENT_DISCONNECT_DONE,reason));
      notificationDeferred=true;
    }
 else {
      if (DBG)       log("String_Node_Str");
      conn.resetSynchronously();
      notificationDeferred=false;
    }
  }
  stopNetStatPoll();
  if (!notificationDeferred) {
    if (DBG)     log("String_Node_Str");
    gotoIdleAndNotifyDataConnection(reason);
  }
}
Program: 42263
Project: 42263
Buggy source:
public boolean validateMemoryResult(int startPid,int startMemory,Writer output,int limit) throws Exception {
  Thread.sleep(10000);
  mEndPid=getMediaserverPid();
  int memDiff=mEndMemory - startMemory;
  if (memDiff < 0)   memDiff=0;
 else   output.write("String_Node_Str" + memDiff);
  output.write("String_Node_Str");
  if (startPid != mEndPid) {
    output.write("String_Node_Str");
    return false;
  }
  if (memDiff > limit)   return false;
  return true;
}

Fixed version (ground truth):
public boolean validateMemoryResult(int startPid,int startMemory,Writer output,int limit) throws Exception {
  Thread.sleep(10000);
  mEndPid=getMediaserverPid();
  int memDiff=mEndMemory - startMemory;
  if (memDiff < 0) {
    memDiff=0;
  }
  output.write("String_Node_Str" + memDiff);
  output.write("String_Node_Str");
  if (startPid != mEndPid) {
    output.write("String_Node_Str");
    return false;
  }
  if (memDiff > limit)   return false;
  return true;
}
Program: 42264
Project: 42264
Buggy source:
public int compareTo(Configuration that){
  int n;
  float a=this.fontScale;
  float b=that.fontScale;
  if (a < b)   return -1;
  if (a > b)   return 1;
  n=this.mcc - that.mcc;
  if (n != 0)   return n;
  n=this.mnc - that.mnc;
  if (n != 0)   return n;
  n=this.locale.getLanguage().compareTo(that.locale.getLanguage());
  if (n != 0)   return n;
  n=this.locale.getCountry().compareTo(that.locale.getCountry());
  if (n != 0)   return n;
  n=this.locale.getVariant().compareTo(that.locale.getVariant());
  if (n != 0)   return n;
  n=this.touchscreen - that.touchscreen;
  if (n != 0)   return n;
  n=this.keyboard - that.keyboard;
  if (n != 0)   return n;
  n=this.keyboardHidden - that.keyboardHidden;
  if (n != 0)   return n;
  n=this.hardKeyboardHidden - that.hardKeyboardHidden;
  if (n != 0)   return n;
  n=this.navigation - that.navigation;
  if (n != 0)   return n;
  n=this.navigationHidden - that.navigationHidden;
  if (n != 0)   return n;
  n=this.orientation - that.orientation;
  if (n != 0)   return n;
  n=this.screenLayout - that.screenLayout;
  if (n != 0)   return n;
  n=this.uiMode - that.uiMode;
  return n;
}

Fixed version (ground truth):
public int compareTo(Configuration that){
  int n;
  float a=this.fontScale;
  float b=that.fontScale;
  if (a < b)   return -1;
  if (a > b)   return 1;
  n=this.mcc - that.mcc;
  if (n != 0)   return n;
  n=this.mnc - that.mnc;
  if (n != 0)   return n;
  if (this.locale == null) {
    if (that.locale != null)     return 1;
  }
 else   if (that.locale == null) {
    return -1;
  }
 else {
    n=this.locale.getLanguage().compareTo(that.locale.getLanguage());
    if (n != 0)     return n;
    n=this.locale.getCountry().compareTo(that.locale.getCountry());
    if (n != 0)     return n;
    n=this.locale.getVariant().compareTo(that.locale.getVariant());
    if (n != 0)     return n;
  }
  n=this.touchscreen - that.touchscreen;
  if (n != 0)   return n;
  n=this.keyboard - that.keyboard;
  if (n != 0)   return n;
  n=this.keyboardHidden - that.keyboardHidden;
  if (n != 0)   return n;
  n=this.hardKeyboardHidden - that.hardKeyboardHidden;
  if (n != 0)   return n;
  n=this.navigation - that.navigation;
  if (n != 0)   return n;
  n=this.navigationHidden - that.navigationHidden;
  if (n != 0)   return n;
  n=this.orientation - that.orientation;
  if (n != 0)   return n;
  n=this.screenLayout - that.screenLayout;
  if (n != 0)   return n;
  n=this.uiMode - that.uiMode;
  return n;
}
Program: 42265
Project: 42265
Buggy source:
public int hashCode(){
  return ((int)this.fontScale) + this.mcc + this.mnc+ this.locale.hashCode()+ this.touchscreen+ this.keyboard+ this.keyboardHidden+ this.hardKeyboardHidden+ this.navigation+ this.navigationHidden+ this.orientation+ this.screenLayout+ this.uiMode;
}

Fixed version (ground truth):
public int hashCode(){
  return ((int)this.fontScale) + this.mcc + this.mnc+ (this.locale != null ? this.locale.hashCode() : 0)+ this.touchscreen+ this.keyboard+ this.keyboardHidden+ this.hardKeyboardHidden+ this.navigation+ this.navigationHidden+ this.orientation+ this.screenLayout+ this.uiMode;
}
Program: 42268
Project: 42268
Buggy source:
public final ActivityRecord performResumeActivity(IBinder token,boolean clearHide){
  ActivityRecord r=mActivities.get(token);
  if (localLOGV)   Log.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ r.activity.mFinished);
  if (r != null && !r.activity.mFinished) {
    if (clearHide) {
      r.hideForNow=false;
      r.activity.mStartedActivity=false;
    }
    try {
      if (r.pendingIntents != null) {
        deliverNewIntents(r,r.pendingIntents);
        r.pendingIntents=null;
      }
      if (r.pendingResults != null) {
        deliverResults(r,r.pendingResults);
        r.pendingResults=null;
      }
      r.activity.performResume();
      EventLog.writeEvent(LOG_ON_RESUME_CALLED,r.activity.getComponentName().getClassName());
      r.paused=false;
      r.stopped=false;
      if (r.activity.mStartedActivity) {
        r.hideForNow=true;
      }
      r.state=null;
    }
 catch (    Exception e) {
      if (!mInstrumentation.onException(r.activity,e)) {
        throw new RuntimeException("String_Node_Str" + r.intent.getComponent().toShortString() + "String_Node_Str"+ e.toString(),e);
      }
    }
  }
  return r;
}

Fixed version (ground truth):
public final ActivityRecord performResumeActivity(IBinder token,boolean clearHide){
  ActivityRecord r=mActivities.get(token);
  if (localLOGV)   Log.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ r.activity.mFinished);
  if (r != null && !r.activity.mFinished) {
    if (clearHide) {
      r.hideForNow=false;
      r.activity.mStartedActivity=false;
    }
    try {
      if (r.pendingIntents != null) {
        deliverNewIntents(r,r.pendingIntents);
        r.pendingIntents=null;
      }
      if (r.pendingResults != null) {
        deliverResults(r,r.pendingResults);
        r.pendingResults=null;
      }
      r.activity.performResume();
      EventLog.writeEvent(LOG_ON_RESUME_CALLED,r.activity.getComponentName().getClassName());
      r.paused=false;
      r.stopped=false;
      r.state=null;
    }
 catch (    Exception e) {
      if (!mInstrumentation.onException(r.activity,e)) {
        throw new RuntimeException("String_Node_Str" + r.intent.getComponent().toShortString() + "String_Node_Str"+ e.toString(),e);
      }
    }
  }
  return r;
}
Program: 42269
Project: 42269
Buggy source:
/** 
 * Send ar.userObj if its a message, which is should be back to originator.
 * @param dp is the DisconnectParams.
 */
private void notifyDisconnectCompleted(DisconnectParams dp){
  if (DBG)   log("String_Node_Str");
  Message msg=dp.onCompletedMsg;
  log(String.format("String_Node_Str",msg.what,((msg.obj instanceof String) ? (String)msg.obj : "String_Node_Str")));
  AsyncResult.forMessage(msg);
  msg.sendToTarget();
  clearSettings();
}

Fixed version (ground truth):
/** 
 * Send ar.userObj if its a message, which is should be back to originator.
 * @param dp is the DisconnectParams.
 */
private void notifyDisconnectCompleted(DisconnectParams dp){
  if (DBG)   log("String_Node_Str");
  if (dp.onCompletedMsg != null) {
    Message msg=dp.onCompletedMsg;
    log(String.format("String_Node_Str",msg.what,((msg.obj instanceof String) ? (String)msg.obj : "String_Node_Str")));
    AsyncResult.forMessage(msg);
    msg.sendToTarget();
  }
  if (dp.lockObj != null) {
synchronized (dp.lockObj) {
      dp.lockObj.notify();
    }
  }
  clearSettings();
}
Program: 42270
Project: 42270
Buggy source:
public DisconnectParams(Message onCompletedMsg){
  this.onCompletedMsg=onCompletedMsg;
}

Fixed version (ground truth):
public DisconnectParams(ResetSynchronouslyLock lockObj){
  this.lockObj=lockObj;
}
Program: 42271
Project: 42271
Buggy source:
/** 
 * If tearDown is true, this only tears down a CONNECTED session. Presently, there is no mechanism for abandoning an INITING/CONNECTING session, but would likely involve cancelling pending async requests or setting a flag or new state to ignore them when they came in
 * @param tearDown true if the underlying DataConnection should bedisconnected.
 * @param reason reason for the clean up.
 */
private void cleanUpConnection(boolean tearDown,String reason){
  if (DBG)   log("String_Node_Str" + reason);
  if (mReconnectIntent != null) {
    AlarmManager am=(AlarmManager)phone.getContext().getSystemService(Context.ALARM_SERVICE);
    am.cancel(mReconnectIntent);
    mReconnectIntent=null;
  }
  setState(State.DISCONNECTING);
  boolean notificationDeferred=false;
  for (  DataConnection conn : dataConnectionList) {
    if (conn != null) {
      if (tearDown) {
        if (DBG)         log("String_Node_Str");
        conn.disconnect(obtainMessage(EVENT_DISCONNECT_DONE,reason));
      }
 else {
        if (DBG)         log("String_Node_Str");
        conn.reset(obtainMessage(EVENT_RESET_DONE,reason));
      }
      notificationDeferred=true;
    }
  }
  stopNetStatPoll();
  if (!notificationDeferred) {
    if (DBG)     log("String_Node_Str");
    gotoIdleAndNotifyDataConnection(reason);
  }
}

Fixed version (ground truth):
/** 
 * If tearDown is true, this only tears down a CONNECTED session. Presently, there is no mechanism for abandoning an INITING/CONNECTING session, but would likely involve cancelling pending async requests or setting a flag or new state to ignore them when they came in
 * @param tearDown true if the underlying DataConnection should bedisconnected.
 * @param reason reason for the clean up.
 */
private void cleanUpConnection(boolean tearDown,String reason){
  if (DBG)   log("String_Node_Str" + reason);
  if (mReconnectIntent != null) {
    AlarmManager am=(AlarmManager)phone.getContext().getSystemService(Context.ALARM_SERVICE);
    am.cancel(mReconnectIntent);
    mReconnectIntent=null;
  }
  setState(State.DISCONNECTING);
  boolean notificationDeferred=false;
  for (  DataConnection conn : dataConnectionList) {
    if (conn != null) {
      if (tearDown) {
        if (DBG)         log("String_Node_Str");
        conn.disconnect(obtainMessage(EVENT_DISCONNECT_DONE,reason));
        notificationDeferred=true;
      }
 else {
        if (DBG)         log("String_Node_Str");
        conn.resetSynchronously();
        notificationDeferred=false;
      }
    }
  }
  stopNetStatPoll();
  if (!notificationDeferred) {
    if (DBG)     log("String_Node_Str");
    gotoIdleAndNotifyDataConnection(reason);
  }
}
Program: 42272
Project: 42272
Buggy source:
/** 
 * If tearDown is true, this only tears down a CONNECTED session. Presently, there is no mechanism for abandoning an INITING/CONNECTING session, but would likely involve cancelling pending async requests or setting a flag or new state to ignore them when they came in
 * @param tearDown true if the underlying GsmDataConnection should bedisconnected.
 * @param reason reason for the clean up.
 */
private void cleanUpConnection(boolean tearDown,String reason){
  if (DBG)   log("String_Node_Str" + reason);
  if (mReconnectIntent != null) {
    AlarmManager am=(AlarmManager)phone.getContext().getSystemService(Context.ALARM_SERVICE);
    am.cancel(mReconnectIntent);
    mReconnectIntent=null;
  }
  setState(State.DISCONNECTING);
  boolean notificationDeferred=false;
  for (  DataConnection conn : pdpList) {
    if (tearDown) {
      if (DBG)       log("String_Node_Str");
      conn.disconnect(obtainMessage(EVENT_DISCONNECT_DONE,reason));
    }
 else {
      if (DBG)       log("String_Node_Str");
      conn.reset(obtainMessage(EVENT_RESET_DONE,reason));
    }
    notificationDeferred=true;
  }
  stopNetStatPoll();
  if (!notificationDeferred) {
    if (DBG)     log("String_Node_Str");
    gotoIdleAndNotifyDataConnection(reason);
  }
}

Fixed version (ground truth):
/** 
 * If tearDown is true, this only tears down a CONNECTED session. Presently, there is no mechanism for abandoning an INITING/CONNECTING session, but would likely involve cancelling pending async requests or setting a flag or new state to ignore them when they came in
 * @param tearDown true if the underlying GsmDataConnection should bedisconnected.
 * @param reason reason for the clean up.
 */
private void cleanUpConnection(boolean tearDown,String reason){
  if (DBG)   log("String_Node_Str" + reason);
  if (mReconnectIntent != null) {
    AlarmManager am=(AlarmManager)phone.getContext().getSystemService(Context.ALARM_SERVICE);
    am.cancel(mReconnectIntent);
    mReconnectIntent=null;
  }
  setState(State.DISCONNECTING);
  boolean notificationDeferred=false;
  for (  DataConnection conn : pdpList) {
    if (tearDown) {
      if (DBG)       log("String_Node_Str");
      conn.disconnect(obtainMessage(EVENT_DISCONNECT_DONE,reason));
      notificationDeferred=true;
    }
 else {
      if (DBG)       log("String_Node_Str");
      conn.resetSynchronously();
      notificationDeferred=false;
    }
  }
  stopNetStatPoll();
  if (!notificationDeferred) {
    if (DBG)     log("String_Node_Str");
    gotoIdleAndNotifyDataConnection(reason);
  }
}
Program: 42273
Project: 42273
Buggy source:
public boolean validateMemoryResult(int startPid,int startMemory,Writer output,int limit) throws Exception {
  Thread.sleep(10000);
  mEndPid=getMediaserverPid();
  int memDiff=mEndMemory - startMemory;
  if (memDiff < 0)   memDiff=0;
 else   output.write("String_Node_Str" + memDiff);
  output.write("String_Node_Str");
  if (startPid != mEndPid) {
    output.write("String_Node_Str");
    return false;
  }
  if (memDiff > limit)   return false;
  return true;
}

Fixed version (ground truth):
public boolean validateMemoryResult(int startPid,int startMemory,Writer output,int limit) throws Exception {
  Thread.sleep(10000);
  mEndPid=getMediaserverPid();
  int memDiff=mEndMemory - startMemory;
  if (memDiff < 0) {
    memDiff=0;
  }
  output.write("String_Node_Str" + memDiff);
  output.write("String_Node_Str");
  if (startPid != mEndPid) {
    output.write("String_Node_Str");
    return false;
  }
  if (memDiff > limit)   return false;
  return true;
}
Program: 42274
Project: 42274
Buggy source:
/** 
 * Reboot the device immediately, passing 'reason' (may be null) to the underlying __reboot system call.  Should not return.
 */
public void reboot(String reason){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.REBOOT,null);
  if (mHandler == null || !ActivityManagerNative.isSystemReady()) {
    throw new IllegalStateException("String_Node_Str");
  }
  final String finalReason=reason;
  Runnable runnable=new Runnable(){
    public void run(){
synchronized (this) {
        ShutdownThread.reboot(mContext,finalReason,false);
        notify();
      }
    }
  }
;
  mHandler.post(runnable);
synchronized (runnable) {
    try {
      runnable.wait();
    }
 catch (    InterruptedException e) {
    }
  }
  throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Reboot the device immediately, passing 'reason' (may be null) to the underlying __reboot system call.  Should not return.
 */
public void reboot(String reason){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.REBOOT,null);
  if (mHandler == null || !ActivityManagerNative.isSystemReady()) {
    throw new IllegalStateException("String_Node_Str");
  }
  final String finalReason=reason;
  Runnable runnable=new Runnable(){
    public void run(){
synchronized (this) {
        ShutdownThread.reboot(mContext,finalReason,false);
      }
    }
  }
;
  mHandler.post(runnable);
synchronized (runnable) {
    while (true) {
      try {
        runnable.wait();
      }
 catch (      InterruptedException e) {
      }
    }
  }
}
Program: 42276
Project: 42276
Buggy source:
/** 
 * Reboot the device immediately, passing 'reason' (may be null) to the underlying __reboot system call.  Should not return.
 */
public void reboot(String reason){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.REBOOT,null);
  if (mHandler == null || !ActivityManagerNative.isSystemReady()) {
    throw new IllegalStateException("String_Node_Str");
  }
  final String finalReason=reason;
  Runnable runnable=new Runnable(){
    public void run(){
synchronized (this) {
        ShutdownThread.reboot(mContext,finalReason,false);
        notify();
      }
    }
  }
;
  mHandler.post(runnable);
synchronized (runnable) {
    try {
      runnable.wait();
    }
 catch (    InterruptedException e) {
    }
  }
  throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Reboot the device immediately, passing 'reason' (may be null) to the underlying __reboot system call.  Should not return.
 */
public void reboot(String reason){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.REBOOT,null);
  if (mHandler == null || !ActivityManagerNative.isSystemReady()) {
    throw new IllegalStateException("String_Node_Str");
  }
  final String finalReason=reason;
  Runnable runnable=new Runnable(){
    public void run(){
synchronized (this) {
        ShutdownThread.reboot(mContext,finalReason,false);
      }
    }
  }
;
  mHandler.post(runnable);
synchronized (runnable) {
    while (true) {
      try {
        runnable.wait();
      }
 catch (      InterruptedException e) {
      }
    }
  }
}
Program: 42278
Project: 42278
Buggy source:
final void handleProfilerControl(boolean start,ProfilerControlData pcd){
  if (start) {
    try {
      Debug.startMethodTracing(pcd.path,pcd.fd.getFileDescriptor(),8 * 1024 * 1024,0);
    }
 catch (    RuntimeException e) {
      Log.w(TAG,"String_Node_Str" + pcd.path + "String_Node_Str");
    }
 finally {
      try {
        pcd.fd.close();
      }
 catch (      IOException e) {
        Log.w(TAG,"String_Node_Str",e);
      }
    }
  }
 else {
    Debug.stopMethodTracing();
  }
}

Fixed version (ground truth):
final void handleProfilerControl(boolean start,ProfilerControlData pcd){
  if (start) {
    try {
      Debug.startMethodTracing(pcd.path,pcd.fd.getFileDescriptor(),8 * 1024 * 1024,0);
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str" + pcd.path + "String_Node_Str");
    }
 finally {
      try {
        pcd.fd.close();
      }
 catch (      IOException e) {
        Slog.w(TAG,"String_Node_Str",e);
      }
    }
  }
 else {
    Debug.stopMethodTracing();
  }
}
Program: 42279
Project: 42279
Buggy source:
public void setSchedulingGroup(int group){
  try {
    Process.setProcessGroup(Process.myPid(),group);
  }
 catch (  Exception e) {
    Log.w(TAG,"String_Node_Str" + group,e);
  }
}

Fixed version (ground truth):
public void setSchedulingGroup(int group){
  try {
    Process.setProcessGroup(Process.myPid(),group);
  }
 catch (  Exception e) {
    Slog.w(TAG,"String_Node_Str" + group,e);
  }
}
Program: 42280
Project: 42280
Buggy source:
public void removeContextRegistrations(Context context,String who,String what){
  HashMap<BroadcastReceiver,ReceiverDispatcher> rmap=mReceivers.remove(context);
  if (rmap != null) {
    Iterator<ReceiverDispatcher> it=rmap.values().iterator();
    while (it.hasNext()) {
      ReceiverDispatcher rd=it.next();
      IntentReceiverLeaked leak=new IntentReceiverLeaked(what + "String_Node_Str" + who+ "String_Node_Str"+ rd.getIntentReceiver()+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      leak.setStackTrace(rd.getLocation().getStackTrace());
      Log.e(TAG,leak.getMessage(),leak);
      try {
        ActivityManagerNative.getDefault().unregisterReceiver(rd.getIIntentReceiver());
      }
 catch (      RemoteException e) {
      }
    }
  }
  mUnregisteredReceivers.remove(context);
  HashMap<ServiceConnection,ServiceDispatcher> smap=mServices.remove(context);
  if (smap != null) {
    Iterator<ServiceDispatcher> it=smap.values().iterator();
    while (it.hasNext()) {
      ServiceDispatcher sd=it.next();
      ServiceConnectionLeaked leak=new ServiceConnectionLeaked(what + "String_Node_Str" + who+ "String_Node_Str"+ sd.getServiceConnection()+ "String_Node_Str");
      leak.setStackTrace(sd.getLocation().getStackTrace());
      Log.e(TAG,leak.getMessage(),leak);
      try {
        ActivityManagerNative.getDefault().unbindService(sd.getIServiceConnection());
      }
 catch (      RemoteException e) {
      }
      sd.doForget();
    }
  }
  mUnboundServices.remove(context);
}

Fixed version (ground truth):
public void removeContextRegistrations(Context context,String who,String what){
  HashMap<BroadcastReceiver,ReceiverDispatcher> rmap=mReceivers.remove(context);
  if (rmap != null) {
    Iterator<ReceiverDispatcher> it=rmap.values().iterator();
    while (it.hasNext()) {
      ReceiverDispatcher rd=it.next();
      IntentReceiverLeaked leak=new IntentReceiverLeaked(what + "String_Node_Str" + who+ "String_Node_Str"+ rd.getIntentReceiver()+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      leak.setStackTrace(rd.getLocation().getStackTrace());
      Slog.e(TAG,leak.getMessage(),leak);
      try {
        ActivityManagerNative.getDefault().unregisterReceiver(rd.getIIntentReceiver());
      }
 catch (      RemoteException e) {
      }
    }
  }
  mUnregisteredReceivers.remove(context);
  HashMap<ServiceConnection,ServiceDispatcher> smap=mServices.remove(context);
  if (smap != null) {
    Iterator<ServiceDispatcher> it=smap.values().iterator();
    while (it.hasNext()) {
      ServiceDispatcher sd=it.next();
      ServiceConnectionLeaked leak=new ServiceConnectionLeaked(what + "String_Node_Str" + who+ "String_Node_Str"+ sd.getServiceConnection()+ "String_Node_Str");
      leak.setStackTrace(sd.getLocation().getStackTrace());
      Slog.e(TAG,leak.getMessage(),leak);
      try {
        ActivityManagerNative.getDefault().unbindService(sd.getIServiceConnection());
      }
 catch (      RemoteException e) {
      }
      sd.doForget();
    }
  }
  mUnboundServices.remove(context);
}
Program: 42283
Project: 42283
Buggy source:
private final void handleDestroyBackupAgent(CreateBackupAgentData data){
  if (DEBUG_BACKUP)   Log.v(TAG,"String_Node_Str" + data);
  PackageInfo packageInfo=getPackageInfoNoCheck(data.appInfo);
  String packageName=packageInfo.mPackageName;
  BackupAgent agent=mBackupAgents.get(packageName);
  if (agent != null) {
    try {
      agent.onDestroy();
    }
 catch (    Exception e) {
      Log.w(TAG,"String_Node_Str" + data.appInfo);
      e.printStackTrace();
    }
    mBackupAgents.remove(packageName);
  }
 else {
    Log.w(TAG,"String_Node_Str" + data);
  }
}

Fixed version (ground truth):
private final void handleDestroyBackupAgent(CreateBackupAgentData data){
  if (DEBUG_BACKUP)   Log.v(TAG,"String_Node_Str" + data);
  PackageInfo packageInfo=getPackageInfoNoCheck(data.appInfo);
  String packageName=packageInfo.mPackageName;
  BackupAgent agent=mBackupAgents.get(packageName);
  if (agent != null) {
    try {
      agent.onDestroy();
    }
 catch (    Exception e) {
      Slog.w(TAG,"String_Node_Str" + data.appInfo);
      e.printStackTrace();
    }
    mBackupAgents.remove(packageName);
  }
 else {
    Slog.w(TAG,"String_Node_Str" + data);
  }
}
Program: 42284
Project: 42284
Buggy source:
private final IContentProvider getProvider(Context context,String name){
synchronized (mProviderMap) {
    final ProviderRecord pr=mProviderMap.get(name);
    if (pr != null) {
      return pr.mProvider;
    }
  }
  IActivityManager.ContentProviderHolder holder=null;
  try {
    holder=ActivityManagerNative.getDefault().getContentProvider(getApplicationThread(),name);
  }
 catch (  RemoteException ex) {
  }
  if (holder == null) {
    Log.e(TAG,"String_Node_Str" + name);
    return null;
  }
  if (holder.permissionFailure != null) {
    throw new SecurityException("String_Node_Str" + holder.permissionFailure + "String_Node_Str"+ name);
  }
  IContentProvider prov=installProvider(context,holder.provider,holder.info,true);
  if (holder.noReleaseNeeded || holder.provider == null) {
synchronized (mProviderMap) {
      mProviderRefCountMap.put(prov.asBinder(),new ProviderRefCount(10000));
    }
  }
  return prov;
}

Fixed version (ground truth):
private final IContentProvider getProvider(Context context,String name){
synchronized (mProviderMap) {
    final ProviderRecord pr=mProviderMap.get(name);
    if (pr != null) {
      return pr.mProvider;
    }
  }
  IActivityManager.ContentProviderHolder holder=null;
  try {
    holder=ActivityManagerNative.getDefault().getContentProvider(getApplicationThread(),name);
  }
 catch (  RemoteException ex) {
  }
  if (holder == null) {
    Slog.e(TAG,"String_Node_Str" + name);
    return null;
  }
  if (holder.permissionFailure != null) {
    throw new SecurityException("String_Node_Str" + holder.permissionFailure + "String_Node_Str"+ name);
  }
  IContentProvider prov=installProvider(context,holder.provider,holder.info,true);
  if (holder.noReleaseNeeded || holder.provider == null) {
synchronized (mProviderMap) {
      mProviderRefCountMap.put(prov.asBinder(),new ProviderRefCount(10000));
    }
  }
  return prov;
}
Program: 42285
Project: 42285
Buggy source:
private final void performStopActivityInner(ActivityRecord r,StopInfo info,boolean keepShown){
  if (localLOGV)   Log.v(TAG,"String_Node_Str" + r);
  if (r != null) {
    if (!keepShown && r.stopped) {
      if (r.activity.mFinished) {
        return;
      }
      RuntimeException e=new RuntimeException("String_Node_Str" + r.intent.getComponent().toShortString());
      Log.e(TAG,e.getMessage(),e);
    }
    if (info != null) {
      try {
        info.description=r.activity.onCreateDescription();
      }
 catch (      Exception e) {
        if (!mInstrumentation.onException(r.activity,e)) {
          throw new RuntimeException("String_Node_Str" + r.intent.getComponent().toShortString() + "String_Node_Str"+ e.toString(),e);
        }
      }
    }
    if (!keepShown) {
      try {
        r.activity.performStop();
      }
 catch (      Exception e) {
        if (!mInstrumentation.onException(r.activity,e)) {
          throw new RuntimeException("String_Node_Str" + r.intent.getComponent().toShortString() + "String_Node_Str"+ e.toString(),e);
        }
      }
      r.stopped=true;
    }
    r.paused=true;
  }
}

Fixed version (ground truth):
private final void performStopActivityInner(ActivityRecord r,StopInfo info,boolean keepShown){
  if (localLOGV)   Log.v(TAG,"String_Node_Str" + r);
  if (r != null) {
    if (!keepShown && r.stopped) {
      if (r.activity.mFinished) {
        return;
      }
      RuntimeException e=new RuntimeException("String_Node_Str" + r.intent.getComponent().toShortString());
      Slog.e(TAG,e.getMessage(),e);
    }
    if (info != null) {
      try {
        info.description=r.activity.onCreateDescription();
      }
 catch (      Exception e) {
        if (!mInstrumentation.onException(r.activity,e)) {
          throw new RuntimeException("String_Node_Str" + r.intent.getComponent().toShortString() + "String_Node_Str"+ e.toString(),e);
        }
      }
    }
    if (!keepShown) {
      try {
        r.activity.performStop();
      }
 catch (      Exception e) {
        if (!mInstrumentation.onException(r.activity,e)) {
          throw new RuntimeException("String_Node_Str" + r.intent.getComponent().toShortString() + "String_Node_Str"+ e.toString(),e);
        }
      }
      r.stopped=true;
    }
    r.paused=true;
  }
}
Program: 42286
Project: 42286
Buggy source:
private void warn(String methodName){
  if (warned) {
    return;
  }
  warned=true;
  Thread.currentThread().setContextClassLoader(getParent());
  Log.w(TAG,"String_Node_Str" + methodName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
private void warn(String methodName){
  if (warned) {
    return;
  }
  warned=true;
  Thread.currentThread().setContextClassLoader(getParent());
  Slog.w(TAG,"String_Node_Str" + methodName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 42287
Project: 42287
Buggy source:
final Bundle performPauseActivity(ActivityRecord r,boolean finished,boolean saveState){
  if (r.paused) {
    if (r.activity.mFinished) {
      return null;
    }
    RuntimeException e=new RuntimeException("String_Node_Str" + r.intent.getComponent().toShortString());
    Log.e(TAG,e.getMessage(),e);
  }
  Bundle state=null;
  if (finished) {
    r.activity.mFinished=true;
  }
  try {
    if (!r.activity.mFinished && saveState) {
      state=new Bundle();
      mInstrumentation.callActivityOnSaveInstanceState(r.activity,state);
      r.state=state;
    }
    r.activity.mCalled=false;
    mInstrumentation.callActivityOnPause(r.activity);
    EventLog.writeEvent(LOG_ON_PAUSE_CALLED,r.activity.getComponentName().getClassName());
    if (!r.activity.mCalled) {
      throw new SuperNotCalledException("String_Node_Str" + r.intent.getComponent().toShortString() + "String_Node_Str");
    }
  }
 catch (  SuperNotCalledException e) {
    throw e;
  }
catch (  Exception e) {
    if (!mInstrumentation.onException(r.activity,e)) {
      throw new RuntimeException("String_Node_Str" + r.intent.getComponent().toShortString() + "String_Node_Str"+ e.toString(),e);
    }
  }
  r.paused=true;
  return state;
}

Fixed version (ground truth):
final Bundle performPauseActivity(ActivityRecord r,boolean finished,boolean saveState){
  if (r.paused) {
    if (r.activity.mFinished) {
      return null;
    }
    RuntimeException e=new RuntimeException("String_Node_Str" + r.intent.getComponent().toShortString());
    Slog.e(TAG,e.getMessage(),e);
  }
  Bundle state=null;
  if (finished) {
    r.activity.mFinished=true;
  }
  try {
    if (!r.activity.mFinished && saveState) {
      state=new Bundle();
      mInstrumentation.callActivityOnSaveInstanceState(r.activity,state);
      r.state=state;
    }
    r.activity.mCalled=false;
    mInstrumentation.callActivityOnPause(r.activity);
    EventLog.writeEvent(LOG_ON_PAUSE_CALLED,r.activity.getComponentName().getClassName());
    if (!r.activity.mCalled) {
      throw new SuperNotCalledException("String_Node_Str" + r.intent.getComponent().toShortString() + "String_Node_Str");
    }
  }
 catch (  SuperNotCalledException e) {
    throw e;
  }
catch (  Exception e) {
    if (!mInstrumentation.onException(r.activity,e)) {
      throw new RuntimeException("String_Node_Str" + r.intent.getComponent().toShortString() + "String_Node_Str"+ e.toString(),e);
    }
  }
  r.paused=true;
  return state;
}
Program: 42288
Project: 42288
Buggy source:
/** 
 * The main function called when started through the zygote process. This could be unified with main(), if the native code in finishInit() were rationalized with Zygote startup.<p> Current recognized args: <ul> <li> --nice-name=<i>nice name to appear in ps</i> <li> <code> [--] &lt;start class name&gt;  &lt;args&gt; </ul>
 * @param argv arg strings
 */
public static final void zygoteInit(String[] argv) throws ZygoteInit.MethodAndArgsCaller {
  System.setOut(new AndroidPrintStream(Log.INFO,"String_Node_Str"));
  System.setErr(new AndroidPrintStream(Log.WARN,"String_Node_Str"));
  commonInit();
  zygoteInitNative();
  int curArg=0;
  for (; curArg < argv.length; curArg++) {
    String arg=argv[curArg];
    if (arg.equals("String_Node_Str")) {
      curArg++;
      break;
    }
 else     if (!arg.startsWith("String_Node_Str")) {
      break;
    }
 else     if (arg.startsWith("String_Node_Str")) {
      String niceName=arg.substring(arg.indexOf('=') + 1);
      Process.setArgV0(niceName);
    }
  }
  if (curArg == argv.length) {
    Log.e(TAG,"String_Node_Str");
    return;
  }
  String startClass=argv[curArg++];
  String[] startArgs=new String[argv.length - curArg];
  System.arraycopy(argv,curArg,startArgs,0,startArgs.length);
  invokeStaticMain(startClass,startArgs);
}

Fixed version (ground truth):
/** 
 * The main function called when started through the zygote process. This could be unified with main(), if the native code in finishInit() were rationalized with Zygote startup.<p> Current recognized args: <ul> <li> --nice-name=<i>nice name to appear in ps</i> <li> <code> [--] &lt;start class name&gt;  &lt;args&gt; </ul>
 * @param argv arg strings
 */
public static final void zygoteInit(String[] argv) throws ZygoteInit.MethodAndArgsCaller {
  System.setOut(new AndroidPrintStream(Log.INFO,"String_Node_Str"));
  System.setErr(new AndroidPrintStream(Log.WARN,"String_Node_Str"));
  commonInit();
  zygoteInitNative();
  int curArg=0;
  for (; curArg < argv.length; curArg++) {
    String arg=argv[curArg];
    if (arg.equals("String_Node_Str")) {
      curArg++;
      break;
    }
 else     if (!arg.startsWith("String_Node_Str")) {
      break;
    }
 else     if (arg.startsWith("String_Node_Str")) {
      String niceName=arg.substring(arg.indexOf('=') + 1);
      Process.setArgV0(niceName);
    }
  }
  if (curArg == argv.length) {
    Slog.e(TAG,"String_Node_Str");
    return;
  }
  String startClass=argv[curArg++];
  String[] startArgs=new String[argv.length - curArg];
  System.arraycopy(argv,curArg,startArgs,0,startArgs.length);
  invokeStaticMain(startClass,startArgs);
}
Program: 42289
Project: 42289
Buggy source:
/** 
 * Report a serious error in the current process.  May or may not cause the process to terminate (depends on system settings).
 * @param tag to record with the error
 * @param t exception describing the error site and conditions
 */
public static void wtf(String tag,Throwable t){
  try {
    if (ActivityManagerNative.getDefault().handleApplicationWtf(mApplicationObject,tag,new ApplicationErrorReport.CrashInfo(t))) {
      Process.killProcess(Process.myPid());
      System.exit(10);
    }
  }
 catch (  Throwable t2) {
    Log.e(TAG,"String_Node_Str",t2);
  }
}

Fixed version (ground truth):
/** 
 * Report a serious error in the current process.  May or may not cause the process to terminate (depends on system settings).
 * @param tag to record with the error
 * @param t exception describing the error site and conditions
 */
public static void wtf(String tag,Throwable t){
  try {
    if (ActivityManagerNative.getDefault().handleApplicationWtf(mApplicationObject,tag,new ApplicationErrorReport.CrashInfo(t))) {
      Process.killProcess(Process.myPid());
      System.exit(10);
    }
  }
 catch (  Throwable t2) {
    Slog.e(TAG,"String_Node_Str",t2);
  }
}
Program: 42290
Project: 42290
Buggy source:
public static final void main(String[] argv){
  commonInit();
  finishInit();
  if (Config.LOGV)   Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
public static final void main(String[] argv){
  commonInit();
  finishInit();
  if (Config.LOGV)   Slog.d(TAG,"String_Node_Str");
}
Program: 42291
Project: 42291
Buggy source:
private static final void commonInit(){
  if (Config.LOGV)   Log.d(TAG,"String_Node_Str");
  Thread.setDefaultUncaughtExceptionHandler(new UncaughtHandler());
  int hasQwerty=getQwertyKeyboard();
  if (Config.LOGV)   Log.d(TAG,"String_Node_Str" + hasQwerty);
  if (hasQwerty == 1) {
    System.setProperty("String_Node_Str","String_Node_Str");
  }
  TimezoneGetter.setInstance(new TimezoneGetter(){
    @Override public String getId(){
      return SystemProperties.get("String_Node_Str");
    }
  }
);
  TimeZone.setDefault(null);
  LogManager.getLogManager().reset();
  new AndroidConfig();
  String userAgent=getDefaultUserAgent();
  System.setProperty("String_Node_Str",userAgent);
  String trace=SystemProperties.get("String_Node_Str");
  if (trace.equals("String_Node_Str")) {
    Log.i(TAG,"String_Node_Str");
    Debug.enableEmulatorTraceOutput();
  }
  initialized=true;
}

Fixed version (ground truth):
private static final void commonInit(){
  if (Config.LOGV)   Slog.d(TAG,"String_Node_Str");
  Thread.setDefaultUncaughtExceptionHandler(new UncaughtHandler());
  int hasQwerty=getQwertyKeyboard();
  if (Config.LOGV)   Slog.d(TAG,"String_Node_Str" + hasQwerty);
  if (hasQwerty == 1) {
    System.setProperty("String_Node_Str","String_Node_Str");
  }
  TimezoneGetter.setInstance(new TimezoneGetter(){
    @Override public String getId(){
      return SystemProperties.get("String_Node_Str");
    }
  }
);
  TimeZone.setDefault(null);
  LogManager.getLogManager().reset();
  new AndroidConfig();
  String userAgent=getDefaultUserAgent();
  System.setProperty("String_Node_Str",userAgent);
  String trace=SystemProperties.get("String_Node_Str");
  if (trace.equals("String_Node_Str")) {
    Slog.i(TAG,"String_Node_Str");
    Debug.enableEmulatorTraceOutput();
  }
  initialized=true;
}
Program: 42292
Project: 42292
Buggy source:
public void uncaughtException(Thread t,Throwable e){
  try {
    if (mCrashing)     return;
    mCrashing=true;
    if (mApplicationObject == null) {
      Log.e(TAG,"String_Node_Str" + t.getName(),e);
    }
 else {
      Log.e(TAG,"String_Node_Str" + t.getName(),e);
    }
    ActivityManagerNative.getDefault().handleApplicationCrash(mApplicationObject,new ApplicationErrorReport.CrashInfo(e));
  }
 catch (  Throwable t2) {
    try {
      Log.e(TAG,"String_Node_Str",t2);
    }
 catch (    Throwable t3) {
    }
  }
 finally {
    Process.killProcess(Process.myPid());
    System.exit(10);
  }
}

Fixed version (ground truth):
public void uncaughtException(Thread t,Throwable e){
  try {
    if (mCrashing)     return;
    mCrashing=true;
    if (mApplicationObject == null) {
      Slog.e(TAG,"String_Node_Str" + t.getName(),e);
    }
 else {
      Slog.e(TAG,"String_Node_Str" + t.getName(),e);
    }
    ActivityManagerNative.getDefault().handleApplicationCrash(mApplicationObject,new ApplicationErrorReport.CrashInfo(e));
  }
 catch (  Throwable t2) {
    try {
      Slog.e(TAG,"String_Node_Str",t2);
    }
 catch (    Throwable t3) {
    }
  }
 finally {
    Process.killProcess(Process.myPid());
    System.exit(10);
  }
}
Program: 42293
Project: 42293
Buggy source:
public void clearWallpaperLocked(){
  File f=WALLPAPER_FILE;
  if (f.exists()) {
    f.delete();
  }
  final long ident=Binder.clearCallingIdentity();
  try {
    bindWallpaperComponentLocked(null);
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}

Fixed version (ground truth):
public void clearWallpaperLocked(){
  File f=WALLPAPER_FILE;
  if (f.exists()) {
    f.delete();
  }
  final long ident=Binder.clearCallingIdentity();
  try {
    bindWallpaperComponentLocked(null);
  }
 catch (  IllegalArgumentException e) {
    Slog.e(TAG,"String_Node_Str",e);
  }
 finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 42296
Project: 42296
Buggy source:
/** 
 * Searches for an entry in the CalendarAlerts table that matches the given event id, begin time and alarm time.  If one is found then this alarm already exists and this method returns true.
 * @param cr the ContentResolver
 * @param eventId the event id to match
 * @param begin the start time of the event in UTC millis
 * @param alarmTime the alarm time of the event in UTC millis
 * @return true if there is already an alarm for the given eventwith the same start time and alarm time.
 */
public static final boolean alarmExists(ContentResolver cr,long eventId,long begin,long alarmTime){
  String selection=CalendarAlerts.EVENT_ID + "String_Node_Str" + eventId+ "String_Node_Str"+ CalendarAlerts.BEGIN+ "String_Node_Str"+ begin+ "String_Node_Str"+ CalendarAlerts.ALARM_TIME+ "String_Node_Str"+ alarmTime;
  String[] projection=new String[]{CalendarAlerts.ALARM_TIME};
  Cursor cursor=query(cr,projection,selection,null,null);
  boolean found=false;
  try {
    if (cursor != null && cursor.getCount() > 0) {
      found=true;
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return found;
}

Fixed version (ground truth):
/** 
 * Searches for an entry in the CalendarAlerts table that matches the given event id, begin time and alarm time.  If one is found then this alarm already exists and this method returns true.
 * @param cr the ContentResolver
 * @param eventId the event id to match
 * @param begin the start time of the event in UTC millis
 * @param alarmTime the alarm time of the event in UTC millis
 * @return true if there is already an alarm for the given eventwith the same start time and alarm time.
 */
public static final boolean alarmExists(ContentResolver cr,long eventId,long begin,long alarmTime){
  String[] projection=new String[]{ALARM_TIME};
  Cursor cursor=query(cr,projection,WHERE_ALARM_EXISTS,new String[]{Long.toString(eventId),Long.toString(begin),Long.toString(alarmTime)},null);
  boolean found=false;
  try {
    if (cursor != null && cursor.getCount() > 0) {
      found=true;
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return found;
}
Program: 42298
Project: 42298
Buggy source:
/** 
 * Finds the next alarm after (or equal to) the given time and returns the time of that alarm or -1 if no such alarm exists.
 * @param cr the ContentResolver
 * @param millis the time in UTC milliseconds
 * @return the next alarm time greater than or equal to "millis", or -1if no such alarm exists.
 */
public static final long findNextAlarmTime(ContentResolver cr,long millis){
  String selection=ALARM_TIME + "String_Node_Str" + millis;
  String[] projection=new String[]{ALARM_TIME};
  Cursor cursor=query(cr,projection,selection,null,ALARM_TIME + "String_Node_Str");
  long alarmTime=-1;
  try {
    if (cursor != null && cursor.moveToFirst()) {
      alarmTime=cursor.getLong(0);
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return alarmTime;
}

Fixed version (ground truth):
/** 
 * Finds the next alarm after (or equal to) the given time and returns the time of that alarm or -1 if no such alarm exists.
 * @param cr the ContentResolver
 * @param millis the time in UTC milliseconds
 * @return the next alarm time greater than or equal to "millis", or -1if no such alarm exists.
 */
public static final long findNextAlarmTime(ContentResolver cr,long millis){
  String selection=ALARM_TIME + "String_Node_Str" + millis;
  String[] projection=new String[]{ALARM_TIME};
  Cursor cursor=query(cr,projection,WHERE_FINDNEXTALARMTIME,new String[]{Long.toString(millis)},SORT_ORDER_ALARMTIME_ASC);
  long alarmTime=-1;
  try {
    if (cursor != null && cursor.moveToFirst()) {
      alarmTime=cursor.getLong(0);
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
  return alarmTime;
}