nus-yam/ex-repair huggingface dataset:
Program: 181403
Project: 181403
Buggy source:
private String getNonceFromResponse(Response response){
  WWWAuthenticate authHeader=(WWWAuthenticate)(response.getHeader(SIPHeaderNames.WWW_AUTHENTICATE));
  return (authHeader == null) ? null : authHeader.getNonce();
}

Fixed version (ground truth):
private String getNonceFromResponse(Response response){
  WWWAuthenticate wwwAuth=(WWWAuthenticate)response.getHeader(SIPHeaderNames.WWW_AUTHENTICATE);
  if (wwwAuth != null)   return wwwAuth.getNonce();
  ProxyAuthenticate proxyAuth=(ProxyAuthenticate)response.getHeader(SIPHeaderNames.PROXY_AUTHENTICATE);
  return (proxyAuth == null) ? null : proxyAuth.getNonce();
}
Program: 181404
Project: 181404
Buggy source:
protected void onDataSetupComplete(AsyncResult ar){
  String reason=null;
  if (ar.userObj instanceof String) {
    reason=(String)ar.userObj;
  }
  if (ar.exception == null) {
    if (isApnTypeActive(Phone.APN_TYPE_DEFAULT)) {
      SystemProperties.set("String_Node_Str","String_Node_Str");
      if (canSetPreferApn && preferredApn == null) {
        Log.d(LOG_TAG,"String_Node_Str");
        preferredApn=mActiveApn;
        setPreferredApn(preferredApn.id);
      }
    }
 else {
      SystemProperties.set("String_Node_Str","String_Node_Str");
    }
    notifyDefaultData(reason);
  }
 else {
    GsmDataConnection.FailCause cause;
    cause=(GsmDataConnection.FailCause)(ar.result);
    if (DBG)     log("String_Node_Str" + cause);
    if (cause.isEventLoggable()) {
      GsmCellLocation loc=((GsmCellLocation)phone.getCellLocation());
      EventLog.writeEvent(EventLogTags.PDP_SETUP_FAIL,cause.ordinal(),loc != null ? loc.getCid() : -1,TelephonyManager.getDefault().getNetworkType());
    }
    if (cause.isPermanentFail()) {
      notifyNoData(cause);
      if (!mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
        phone.notifyDataConnection(Phone.REASON_APN_FAILED);
        onEnableApn(apnTypeToId(mRequestedApnType),DISABLED);
      }
      return;
    }
    waitingApns.remove(0);
    if (waitingApns.isEmpty()) {
      startDelayedRetry(cause,reason);
    }
 else {
      setState(State.SCANNING);
      sendMessageDelayed(obtainMessage(EVENT_TRY_SETUP_DATA,reason),APN_DELAY_MILLIS);
    }
  }
}

Fixed version (ground truth):
protected void onDataSetupComplete(AsyncResult ar){
  String reason=null;
  if (ar.userObj instanceof String) {
    reason=(String)ar.userObj;
  }
  if (ar.exception == null) {
    if (isApnTypeActive(Phone.APN_TYPE_DEFAULT)) {
      SystemProperties.set("String_Node_Str","String_Node_Str");
      if (canSetPreferApn && preferredApn == null) {
        Log.d(LOG_TAG,"String_Node_Str");
        preferredApn=mActiveApn;
        setPreferredApn(preferredApn.id);
      }
    }
 else {
      SystemProperties.set("String_Node_Str","String_Node_Str");
    }
    notifyDefaultData(reason);
  }
 else {
    GsmDataConnection.FailCause cause;
    cause=(GsmDataConnection.FailCause)(ar.result);
    if (DBG)     log("String_Node_Str" + cause);
    if (cause.isEventLoggable()) {
      GsmCellLocation loc=((GsmCellLocation)phone.getCellLocation());
      EventLog.writeEvent(EventLogTags.PDP_SETUP_FAIL,cause.ordinal(),loc != null ? loc.getCid() : -1,TelephonyManager.getDefault().getNetworkType());
    }
    if (cause.isPermanentFail()) {
      notifyNoData(cause);
      phone.notifyDataConnection(Phone.REASON_APN_FAILED);
      onEnableApn(apnTypeToId(mRequestedApnType),DISABLED);
      return;
    }
    waitingApns.remove(0);
    if (waitingApns.isEmpty()) {
      startDelayedRetry(cause,reason);
    }
 else {
      setState(State.SCANNING);
      sendMessageDelayed(obtainMessage(EVENT_TRY_SETUP_DATA,reason),APN_DELAY_MILLIS);
    }
  }
}
Program: 181405
Project: 181405
Buggy source:
protected void onDataSetupComplete(AsyncResult ar){
  String reason=null;
  if (ar.userObj instanceof String) {
    reason=(String)ar.userObj;
  }
  if (ar.exception == null) {
    if (isApnTypeActive(Phone.APN_TYPE_DEFAULT)) {
      SystemProperties.set("String_Node_Str","String_Node_Str");
      if (canSetPreferApn && preferredApn == null) {
        Log.d(LOG_TAG,"String_Node_Str");
        preferredApn=mActiveApn;
        setPreferredApn(preferredApn.id);
      }
    }
 else {
      SystemProperties.set("String_Node_Str","String_Node_Str");
    }
    notifyDefaultData(reason);
  }
 else {
    GsmDataConnection.FailCause cause;
    cause=(GsmDataConnection.FailCause)(ar.result);
    if (DBG)     log("String_Node_Str" + cause);
    if (cause.isEventLoggable()) {
      GsmCellLocation loc=((GsmCellLocation)phone.getCellLocation());
      EventLog.writeEvent(EventLogTags.PDP_SETUP_FAIL,cause.ordinal(),loc != null ? loc.getCid() : -1,TelephonyManager.getDefault().getNetworkType());
    }
    if (cause.isPermanentFail()) {
      notifyNoData(cause);
      if (!mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
        phone.notifyDataConnection(Phone.REASON_APN_FAILED);
        onEnableApn(apnTypeToId(mRequestedApnType),DISABLED);
      }
      return;
    }
    waitingApns.remove(0);
    if (waitingApns.isEmpty()) {
      startDelayedRetry(cause,reason);
    }
 else {
      setState(State.SCANNING);
      sendMessageDelayed(obtainMessage(EVENT_TRY_SETUP_DATA,reason),APN_DELAY_MILLIS);
    }
  }
}

Fixed version (ground truth):
protected void onDataSetupComplete(AsyncResult ar){
  String reason=null;
  if (ar.userObj instanceof String) {
    reason=(String)ar.userObj;
  }
  if (ar.exception == null) {
    if (isApnTypeActive(Phone.APN_TYPE_DEFAULT)) {
      SystemProperties.set("String_Node_Str","String_Node_Str");
      if (canSetPreferApn && preferredApn == null) {
        Log.d(LOG_TAG,"String_Node_Str");
        preferredApn=mActiveApn;
        setPreferredApn(preferredApn.id);
      }
    }
 else {
      SystemProperties.set("String_Node_Str","String_Node_Str");
    }
    notifyDefaultData(reason);
  }
 else {
    GsmDataConnection.FailCause cause;
    cause=(GsmDataConnection.FailCause)(ar.result);
    if (DBG)     log("String_Node_Str" + cause);
    if (cause.isEventLoggable()) {
      GsmCellLocation loc=((GsmCellLocation)phone.getCellLocation());
      EventLog.writeEvent(EventLogTags.PDP_SETUP_FAIL,cause.ordinal(),loc != null ? loc.getCid() : -1,TelephonyManager.getDefault().getNetworkType());
    }
    if (cause.isPermanentFail()) {
      notifyNoData(cause);
      phone.notifyDataConnection(Phone.REASON_APN_FAILED);
      onEnableApn(apnTypeToId(mRequestedApnType),DISABLED);
      return;
    }
    waitingApns.remove(0);
    if (waitingApns.isEmpty()) {
      startDelayedRetry(cause,reason);
    }
 else {
      setState(State.SCANNING);
      sendMessageDelayed(obtainMessage(EVENT_TRY_SETUP_DATA,reason),APN_DELAY_MILLIS);
    }
  }
}
Program: 181407
Project: 181407
Buggy source:
/** 
 * @hide Just for debugging; not internationalized. 
 */
public static void formatDuration(long time,long now,PrintWriter pw){
  if (time == 0) {
    pw.print("String_Node_Str");
    return;
  }
  formatDuration(time - now,pw);
}

Fixed version (ground truth):
/** 
 * @hide Just for debugging; not internationalized. 
 */
public static void formatDuration(long time,long now,PrintWriter pw){
  if (time == 0) {
    pw.print("String_Node_Str");
    return;
  }
  formatDuration(time - now,pw,0);
}
Program: 181409
Project: 181409
Buggy source:
/** 
 * @hide Just for debugging; not internationalized. 
 */
public static void formatDuration(long time,long now,PrintWriter pw){
  if (time == 0) {
    pw.print("String_Node_Str");
    return;
  }
  formatDuration(time - now,pw);
}

Fixed version (ground truth):
/** 
 * @hide Just for debugging; not internationalized. 
 */
public static void formatDuration(long time,long now,PrintWriter pw){
  if (time == 0) {
    pw.print("String_Node_Str");
    return;
  }
  formatDuration(time - now,pw,0);
}
Program: 181410
Project: 181410
Buggy source:
void edgeReached(int delta){
  mScroller.notifyVerticalEdgeReached(mScrollY,0,mOverflingDistance);
  mTouchMode=TOUCH_MODE_OVERFLING;
  if (mEdgeGlowTop != null) {
    final int vel=(int)mScroller.getCurrVelocity();
    if (delta > 0) {
      mEdgeGlowTop.onAbsorb(vel);
    }
 else {
      mEdgeGlowBottom.onAbsorb(vel);
    }
  }
  invalidate();
  post(this);
}

Fixed version (ground truth):
void edgeReached(int delta){
  mScroller.notifyVerticalEdgeReached(mScrollY,0,mOverflingDistance);
  final int overscrollMode=getOverscrollMode();
  if (overscrollMode == OVERSCROLL_ALWAYS || (overscrollMode == OVERSCROLL_IF_CONTENT_SCROLLS && !contentFits())) {
    mTouchMode=TOUCH_MODE_OVERFLING;
    final int vel=(int)mScroller.getCurrVelocity();
    if (delta > 0) {
      mEdgeGlowTop.onAbsorb(vel);
    }
 else {
      mEdgeGlowBottom.onAbsorb(vel);
    }
  }
  invalidate();
  post(this);
}
Program: 181413
Project: 181413
Buggy source:
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (oldX != x || oldY != y) {
      overscrollBy(x - oldX,y - oldY,oldX,oldY,getScrollRange(),0,mOverflingDistance,0,false);
      onScrollChanged(mScrollX,mScrollY,oldX,oldY);
      final int range=getScrollRange();
      if (x < 0 && oldX >= 0) {
        mEdgeGlowLeft.onAbsorb((int)mScroller.getCurrVelocity());
      }
 else       if (x > range && oldX <= range) {
        mEdgeGlowRight.onAbsorb((int)mScroller.getCurrVelocity());
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}

Fixed version (ground truth):
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (oldX != x || oldY != y) {
      overscrollBy(x - oldX,y - oldY,oldX,oldY,getScrollRange(),0,mOverflingDistance,0,false);
      onScrollChanged(mScrollX,mScrollY,oldX,oldY);
      final int range=getScrollRange();
      final int overscrollMode=getOverscrollMode();
      if (overscrollMode == OVERSCROLL_ALWAYS || (overscrollMode == OVERSCROLL_IF_CONTENT_SCROLLS && range > 0)) {
        if (x < 0 && oldX >= 0) {
          mEdgeGlowLeft.onAbsorb((int)mScroller.getCurrVelocity());
        }
 else         if (x > range && oldX <= range) {
          mEdgeGlowRight.onAbsorb((int)mScroller.getCurrVelocity());
        }
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}
Program: 181415
Project: 181415
Buggy source:
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (oldX != x || oldY != y) {
      overscrollBy(x - oldX,y - oldY,oldX,oldY,0,getScrollRange(),0,mOverflingDistance,false);
      onScrollChanged(mScrollX,mScrollY,oldX,oldY);
      final int range=getScrollRange();
      if (y < 0 && oldY >= 0) {
        mEdgeGlowTop.onAbsorb((int)mScroller.getCurrVelocity());
      }
 else       if (y > range && oldY <= range) {
        mEdgeGlowBottom.onAbsorb((int)mScroller.getCurrVelocity());
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}

Fixed version (ground truth):
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (oldX != x || oldY != y) {
      overscrollBy(x - oldX,y - oldY,oldX,oldY,0,getScrollRange(),0,mOverflingDistance,false);
      onScrollChanged(mScrollX,mScrollY,oldX,oldY);
      final int range=getScrollRange();
      final int overscrollMode=getOverscrollMode();
      if (overscrollMode == OVERSCROLL_ALWAYS || (overscrollMode == OVERSCROLL_IF_CONTENT_SCROLLS && range > 0)) {
        if (y < 0 && oldY >= 0) {
          mEdgeGlowTop.onAbsorb((int)mScroller.getCurrVelocity());
        }
 else         if (y > range && oldY <= range) {
          mEdgeGlowBottom.onAbsorb((int)mScroller.getCurrVelocity());
        }
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}
Program: 181416
Project: 181416
Buggy source:
void edgeReached(int delta){
  mScroller.notifyVerticalEdgeReached(mScrollY,0,mOverflingDistance);
  mTouchMode=TOUCH_MODE_OVERFLING;
  if (mEdgeGlowTop != null) {
    final int vel=(int)mScroller.getCurrVelocity();
    if (delta > 0) {
      mEdgeGlowTop.onAbsorb(vel);
    }
 else {
      mEdgeGlowBottom.onAbsorb(vel);
    }
  }
  invalidate();
  post(this);
}

Fixed version (ground truth):
void edgeReached(int delta){
  mScroller.notifyVerticalEdgeReached(mScrollY,0,mOverflingDistance);
  final int overscrollMode=getOverscrollMode();
  if (overscrollMode == OVERSCROLL_ALWAYS || (overscrollMode == OVERSCROLL_IF_CONTENT_SCROLLS && !contentFits())) {
    mTouchMode=TOUCH_MODE_OVERFLING;
    final int vel=(int)mScroller.getCurrVelocity();
    if (delta > 0) {
      mEdgeGlowTop.onAbsorb(vel);
    }
 else {
      mEdgeGlowBottom.onAbsorb(vel);
    }
  }
  invalidate();
  post(this);
}
Program: 181419
Project: 181419
Buggy source:
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (oldX != x || oldY != y) {
      overscrollBy(x - oldX,y - oldY,oldX,oldY,getScrollRange(),0,mOverflingDistance,0,false);
      onScrollChanged(mScrollX,mScrollY,oldX,oldY);
      final int range=getScrollRange();
      if (x < 0 && oldX >= 0) {
        mEdgeGlowLeft.onAbsorb((int)mScroller.getCurrVelocity());
      }
 else       if (x > range && oldX <= range) {
        mEdgeGlowRight.onAbsorb((int)mScroller.getCurrVelocity());
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}

Fixed version (ground truth):
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (oldX != x || oldY != y) {
      overscrollBy(x - oldX,y - oldY,oldX,oldY,getScrollRange(),0,mOverflingDistance,0,false);
      onScrollChanged(mScrollX,mScrollY,oldX,oldY);
      final int range=getScrollRange();
      final int overscrollMode=getOverscrollMode();
      if (overscrollMode == OVERSCROLL_ALWAYS || (overscrollMode == OVERSCROLL_IF_CONTENT_SCROLLS && range > 0)) {
        if (x < 0 && oldX >= 0) {
          mEdgeGlowLeft.onAbsorb((int)mScroller.getCurrVelocity());
        }
 else         if (x > range && oldX <= range) {
          mEdgeGlowRight.onAbsorb((int)mScroller.getCurrVelocity());
        }
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}
Program: 181421
Project: 181421
Buggy source:
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (oldX != x || oldY != y) {
      overscrollBy(x - oldX,y - oldY,oldX,oldY,0,getScrollRange(),0,mOverflingDistance,false);
      onScrollChanged(mScrollX,mScrollY,oldX,oldY);
      final int range=getScrollRange();
      if (y < 0 && oldY >= 0) {
        mEdgeGlowTop.onAbsorb((int)mScroller.getCurrVelocity());
      }
 else       if (y > range && oldY <= range) {
        mEdgeGlowBottom.onAbsorb((int)mScroller.getCurrVelocity());
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}

Fixed version (ground truth):
@Override public void computeScroll(){
  if (mScroller.computeScrollOffset()) {
    int oldX=mScrollX;
    int oldY=mScrollY;
    int x=mScroller.getCurrX();
    int y=mScroller.getCurrY();
    if (oldX != x || oldY != y) {
      overscrollBy(x - oldX,y - oldY,oldX,oldY,0,getScrollRange(),0,mOverflingDistance,false);
      onScrollChanged(mScrollX,mScrollY,oldX,oldY);
      final int range=getScrollRange();
      final int overscrollMode=getOverscrollMode();
      if (overscrollMode == OVERSCROLL_ALWAYS || (overscrollMode == OVERSCROLL_IF_CONTENT_SCROLLS && range > 0)) {
        if (y < 0 && oldY >= 0) {
          mEdgeGlowTop.onAbsorb((int)mScroller.getCurrVelocity());
        }
 else         if (y > range && oldY <= range) {
          mEdgeGlowBottom.onAbsorb((int)mScroller.getCurrVelocity());
        }
      }
    }
    awakenScrollBars();
    postInvalidate();
  }
}
Program: 181422
Project: 181422
Buggy source:
private boolean deleteSystemPackageLI(PackageParser.Package p,int flags,PackageRemovedInfo outInfo){
  ApplicationInfo applicationInfo=p.applicationInfo;
  if (applicationInfo == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str");
    return false;
  }
  PackageSetting ps=null;
synchronized (mPackages) {
    ps=mSettings.getDisabledSystemPkg(p.packageName);
  }
  if (ps == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName);
    return false;
  }
 else {
    Log.i(TAG,"String_Node_Str");
  }
  outInfo.isRemovedPackageSystemUpdate=true;
  boolean deleteCodeAndResources=false;
  if (ps.versionCode < p.mVersionCode) {
    deleteCodeAndResources=true;
    if ((flags & PackageManager.DONT_DELETE_DATA) == 0) {
      flags&=~PackageManager.DONT_DELETE_DATA;
    }
  }
 else {
    if ((flags & PackageManager.DONT_DELETE_DATA) == 0) {
      flags|=PackageManager.DONT_DELETE_DATA;
    }
  }
  boolean ret=deleteInstalledPackageLI(p,deleteCodeAndResources,flags,outInfo);
  if (!ret) {
    return false;
  }
synchronized (mPackages) {
    mSettings.enableSystemPackageLP(p.packageName);
    removeNativeBinariesLI(p);
  }
  PackageParser.Package newPkg=scanPackageLI(ps.codePath,PackageParser.PARSE_MUST_BE_APK | PackageParser.PARSE_IS_SYSTEM,SCAN_MONITOR | SCAN_NO_PATHS);
  if (newPkg == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str"+ mLastScanError);
    return false;
  }
synchronized (mPackages) {
    updatePermissionsLP(newPkg.packageName,newPkg,true,true,false);
    mSettings.writeLP();
  }
  return true;
}

Fixed version (ground truth):
private boolean deleteSystemPackageLI(PackageParser.Package p,int flags,PackageRemovedInfo outInfo){
  ApplicationInfo applicationInfo=p.applicationInfo;
  if (applicationInfo == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str");
    return false;
  }
  PackageSetting ps=null;
synchronized (mPackages) {
    ps=mSettings.getDisabledSystemPkg(p.packageName);
  }
  if (ps == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName);
    return false;
  }
 else {
    Log.i(TAG,"String_Node_Str");
  }
  outInfo.isRemovedPackageSystemUpdate=true;
  final boolean deleteCodeAndResources;
  if (ps.versionCode < p.mVersionCode) {
    deleteCodeAndResources=true;
    flags&=~PackageManager.DONT_DELETE_DATA;
  }
 else {
    deleteCodeAndResources=false;
    flags|=PackageManager.DONT_DELETE_DATA;
  }
  boolean ret=deleteInstalledPackageLI(p,deleteCodeAndResources,flags,outInfo);
  if (!ret) {
    return false;
  }
synchronized (mPackages) {
    mSettings.enableSystemPackageLP(p.packageName);
    removeNativeBinariesLI(p);
  }
  PackageParser.Package newPkg=scanPackageLI(ps.codePath,PackageParser.PARSE_MUST_BE_APK | PackageParser.PARSE_IS_SYSTEM,SCAN_MONITOR | SCAN_NO_PATHS);
  if (newPkg == null) {
    Slog.w(TAG,"String_Node_Str" + p.packageName + "String_Node_Str"+ mLastScanError);
    return false;
  }
synchronized (mPackages) {
    updatePermissionsLP(newPkg.packageName,newPkg,true,true,false);
    mSettings.writeLP();
  }
  return true;
}
Program: 181423
Project: 181423
Buggy source:
public void run(){
  if (mDataChanged) {
    post(this);
  }
 else {
    fireOnSelected();
  }
}

Fixed version (ground truth):
public void run(){
  if (mDataChanged) {
    if (getAdapter() != null) {
      post(this);
    }
  }
 else {
    fireOnSelected();
  }
}
Program: 181424
Project: 181424
Buggy source:
@Override public void onInvalidated(){
  mDataChanged=true;
  if (AdapterView.this.getAdapter().hasStableIds()) {
    mInstanceState=AdapterView.this.onSaveInstanceState();
  }
  mOldItemCount=mItemCount;
  mItemCount=0;
  mSelectedPosition=INVALID_POSITION;
  mSelectedRowId=INVALID_ROW_ID;
  mNextSelectedPosition=INVALID_POSITION;
  mNextSelectedRowId=INVALID_ROW_ID;
  mNeedSync=false;
  checkSelectionChanged();
  checkFocus();
  requestLayout();
}

Fixed version (ground truth):
@Override public void onInvalidated(){
  mDataChanged=true;
  if (AdapterView.this.getAdapter().hasStableIds()) {
    mInstanceState=AdapterView.this.onSaveInstanceState();
  }
  mOldItemCount=mItemCount;
  mItemCount=0;
  mSelectedPosition=INVALID_POSITION;
  mSelectedRowId=INVALID_ROW_ID;
  mNextSelectedPosition=INVALID_POSITION;
  mNextSelectedRowId=INVALID_ROW_ID;
  mNeedSync=false;
  checkFocus();
  requestLayout();
}
Program: 181425
Project: 181425
Buggy source:
void selectionChanged(){
  if (mOnItemSelectedListener != null) {
    if (mInLayout || mBlockLayoutRequests) {
      if (mSelectionNotifier == null) {
        mSelectionNotifier=new SelectionNotifier();
      }
      mSelectionNotifier.post(mSelectionNotifier);
    }
 else {
      fireOnSelected();
    }
  }
  if (mSelectedPosition != ListView.INVALID_POSITION && isShown() && !isInTouchMode()) {
    sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
  }
}

Fixed version (ground truth):
void selectionChanged(){
  if (mOnItemSelectedListener != null) {
    if (mInLayout || mBlockLayoutRequests) {
      if (mSelectionNotifier == null) {
        mSelectionNotifier=new SelectionNotifier();
      }
      post(mSelectionNotifier);
    }
 else {
      fireOnSelected();
    }
  }
  if (mSelectedPosition != ListView.INVALID_POSITION && isShown() && !isInTouchMode()) {
    sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
  }
}
Program: 181426
Project: 181426
Buggy source:
public void run(){
  if (mDataChanged) {
    post(this);
  }
 else {
    fireOnSelected();
  }
}

Fixed version (ground truth):
public void run(){
  if (mDataChanged) {
    if (getAdapter() != null) {
      post(this);
    }
  }
 else {
    fireOnSelected();
  }
}
Program: 181427
Project: 181427
Buggy source:
@Override public void onInvalidated(){
  mDataChanged=true;
  if (AdapterView.this.getAdapter().hasStableIds()) {
    mInstanceState=AdapterView.this.onSaveInstanceState();
  }
  mOldItemCount=mItemCount;
  mItemCount=0;
  mSelectedPosition=INVALID_POSITION;
  mSelectedRowId=INVALID_ROW_ID;
  mNextSelectedPosition=INVALID_POSITION;
  mNextSelectedRowId=INVALID_ROW_ID;
  mNeedSync=false;
  checkSelectionChanged();
  checkFocus();
  requestLayout();
}

Fixed version (ground truth):
@Override public void onInvalidated(){
  mDataChanged=true;
  if (AdapterView.this.getAdapter().hasStableIds()) {
    mInstanceState=AdapterView.this.onSaveInstanceState();
  }
  mOldItemCount=mItemCount;
  mItemCount=0;
  mSelectedPosition=INVALID_POSITION;
  mSelectedRowId=INVALID_ROW_ID;
  mNextSelectedPosition=INVALID_POSITION;
  mNextSelectedRowId=INVALID_ROW_ID;
  mNeedSync=false;
  checkFocus();
  requestLayout();
}
Program: 181428
Project: 181428
Buggy source:
void selectionChanged(){
  if (mOnItemSelectedListener != null) {
    if (mInLayout || mBlockLayoutRequests) {
      if (mSelectionNotifier == null) {
        mSelectionNotifier=new SelectionNotifier();
      }
      mSelectionNotifier.post(mSelectionNotifier);
    }
 else {
      fireOnSelected();
    }
  }
  if (mSelectedPosition != ListView.INVALID_POSITION && isShown() && !isInTouchMode()) {
    sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
  }
}

Fixed version (ground truth):
void selectionChanged(){
  if (mOnItemSelectedListener != null) {
    if (mInLayout || mBlockLayoutRequests) {
      if (mSelectionNotifier == null) {
        mSelectionNotifier=new SelectionNotifier();
      }
      post(mSelectionNotifier);
    }
 else {
      fireOnSelected();
    }
  }
  if (mSelectedPosition != ListView.INVALID_POSITION && isShown() && !isInTouchMode()) {
    sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
  }
}
Program: 181429
Project: 181429
Buggy source:
/** 
 * Sets the maximum and maximum preview fps. This controls the rate of preview frames received in   {@link #PreviewCallback}. The minimum and maximum preview fps must be one of the elements from   {@link #getSupportedPreviewFpsRange}.
 * @param min the minimum preview fps (scaled by 1000).
 * @param max the maximum preview fps (scaled by 1000).
 * @throws RuntimeException if fps range is invalid.
 * @see #setPreviewCallbackWithBuffer(Camera.PreviewCallback)
 * @see #getSupportedPreviewFpsRange()
 */
public void setPreviewFpsRange(int min,int max){
  set(KEY_PREVIEW_FPS_RANGE,"String_Node_Str" + min + "String_Node_Str"+ max);
}

Fixed version (ground truth):
/** 
 * Sets the maximum and maximum preview fps. This controls the rate of preview frames received in   {@link PreviewCallback}. The minimum and maximum preview fps must be one of the elements from   {@link #getSupportedPreviewFpsRange}.
 * @param min the minimum preview fps (scaled by 1000).
 * @param max the maximum preview fps (scaled by 1000).
 * @throws RuntimeException if fps range is invalid.
 * @see #setPreviewCallbackWithBuffer(Camera.PreviewCallback)
 * @see #getSupportedPreviewFpsRange()
 */
public void setPreviewFpsRange(int min,int max){
  set(KEY_PREVIEW_FPS_RANGE,"String_Node_Str" + min + "String_Node_Str"+ max);
}
Program: 181430
Project: 181430
Buggy source:
@Override public int update(Uri url,ContentValues initialValues,String where,String[] whereArgs){
  SqlArguments args=new SqlArguments(url,where,whereArgs);
  if (TABLE_FAVORITES.equals(args.table)) {
    return 0;
  }
  checkWritePermissions(args);
  sKnownMutationsInFlight.incrementAndGet();
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  sKnownMutationsInFlight.decrementAndGet();
  int count=db.update(args.table,initialValues,args.where,args.args);
  if (count > 0) {
    SettingsCache.wipe(args.table);
    sendNotify(url);
  }
  startAsyncCachePopulation();
  if (LOCAL_LOGV)   Log.v(TAG,args.table + "String_Node_Str" + count+ "String_Node_Str"+ initialValues);
  return count;
}

Fixed version (ground truth):
@Override public int update(Uri url,ContentValues initialValues,String where,String[] whereArgs){
  SqlArguments args=new SqlArguments(url,where,whereArgs);
  if (TABLE_FAVORITES.equals(args.table)) {
    return 0;
  }
  checkWritePermissions(args);
  sKnownMutationsInFlight.incrementAndGet();
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  int count=db.update(args.table,initialValues,args.where,args.args);
  sKnownMutationsInFlight.decrementAndGet();
  if (count > 0) {
    SettingsCache.invalidate(args.table);
    sendNotify(url);
  }
  startAsyncCachePopulation();
  if (LOCAL_LOGV)   Log.v(TAG,args.table + "String_Node_Str" + count+ "String_Node_Str"+ initialValues);
  return count;
}
Program: 181431
Project: 181431
Buggy source:
private void fullyPopulateCache(String table,SettingsCache cache){
  SQLiteDatabase db=mOpenHelper.getReadableDatabase();
  Cursor c=db.query(table,new String[]{Settings.NameValueTable.NAME,Settings.NameValueTable.VALUE},null,null,null,null,null,"String_Node_Str" + (MAX_CACHE_ENTRIES + 1));
  try {
synchronized (cache) {
      cache.clear();
      cache.setFullyMatchesDisk(true);
      int rows=0;
      while (c.moveToNext()) {
        rows++;
        String name=c.getString(0);
        String value=c.getString(1);
        cache.populate(name,value);
      }
      if (rows > MAX_CACHE_ENTRIES) {
        cache.setFullyMatchesDisk(false);
        Log.d(TAG,"String_Node_Str" + table);
      }
      Log.d(TAG,"String_Node_Str" + table + "String_Node_Str"+ cache.fullyMatchesDisk());
    }
  }
  finally {
    c.close();
  }
}

Fixed version (ground truth):
private void fullyPopulateCache(String table,SettingsCache cache){
  SQLiteDatabase db=mOpenHelper.getReadableDatabase();
  Cursor c=db.query(table,new String[]{Settings.NameValueTable.NAME,Settings.NameValueTable.VALUE},null,null,null,null,null,"String_Node_Str" + (MAX_CACHE_ENTRIES + 1));
  try {
synchronized (cache) {
      cache.clear();
      cache.setFullyMatchesDisk(true);
      int rows=0;
      while (c.moveToNext()) {
        rows++;
        String name=c.getString(0);
        String value=c.getString(1);
        cache.populate(name,value);
      }
      if (rows > MAX_CACHE_ENTRIES) {
        cache.setFullyMatchesDisk(false);
        Log.d(TAG,"String_Node_Str" + table);
      }
      Log.d(TAG,"String_Node_Str" + table + "String_Node_Str"+ rows+ "String_Node_Str"+ cache.fullyMatchesDisk());
    }
  }
  finally {
    c.close();
  }
}
Program: 181432
Project: 181432
Buggy source:
@Override public int delete(Uri url,String where,String[] whereArgs){
  SqlArguments args=new SqlArguments(url,where,whereArgs);
  if (TABLE_FAVORITES.equals(args.table)) {
    return 0;
  }
 else   if (TABLE_OLD_FAVORITES.equals(args.table)) {
    args.table=TABLE_FAVORITES;
  }
  checkWritePermissions(args);
  sKnownMutationsInFlight.incrementAndGet();
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  int count=db.delete(args.table,args.where,args.args);
  sKnownMutationsInFlight.decrementAndGet();
  if (count > 0) {
    SettingsCache.wipe(args.table);
    sendNotify(url);
  }
  startAsyncCachePopulation();
  if (LOCAL_LOGV)   Log.v(TAG,args.table + "String_Node_Str" + count+ "String_Node_Str");
  return count;
}

Fixed version (ground truth):
@Override public int delete(Uri url,String where,String[] whereArgs){
  SqlArguments args=new SqlArguments(url,where,whereArgs);
  if (TABLE_FAVORITES.equals(args.table)) {
    return 0;
  }
 else   if (TABLE_OLD_FAVORITES.equals(args.table)) {
    args.table=TABLE_FAVORITES;
  }
  checkWritePermissions(args);
  sKnownMutationsInFlight.incrementAndGet();
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  int count=db.delete(args.table,args.where,args.args);
  sKnownMutationsInFlight.decrementAndGet();
  if (count > 0) {
    SettingsCache.invalidate(args.table);
    sendNotify(url);
  }
  startAsyncCachePopulation();
  if (LOCAL_LOGV)   Log.v(TAG,args.table + "String_Node_Str" + count+ "String_Node_Str");
  return count;
}
Program: 181433
Project: 181433
Buggy source:
@Override public int update(Uri url,ContentValues initialValues,String where,String[] whereArgs){
  SqlArguments args=new SqlArguments(url,where,whereArgs);
  if (TABLE_FAVORITES.equals(args.table)) {
    return 0;
  }
  checkWritePermissions(args);
  sKnownMutationsInFlight.incrementAndGet();
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  sKnownMutationsInFlight.decrementAndGet();
  int count=db.update(args.table,initialValues,args.where,args.args);
  if (count > 0) {
    SettingsCache.wipe(args.table);
    sendNotify(url);
  }
  startAsyncCachePopulation();
  if (LOCAL_LOGV)   Log.v(TAG,args.table + "String_Node_Str" + count+ "String_Node_Str"+ initialValues);
  return count;
}

Fixed version (ground truth):
@Override public int update(Uri url,ContentValues initialValues,String where,String[] whereArgs){
  SqlArguments args=new SqlArguments(url,where,whereArgs);
  if (TABLE_FAVORITES.equals(args.table)) {
    return 0;
  }
  checkWritePermissions(args);
  sKnownMutationsInFlight.incrementAndGet();
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  int count=db.update(args.table,initialValues,args.where,args.args);
  sKnownMutationsInFlight.decrementAndGet();
  if (count > 0) {
    SettingsCache.invalidate(args.table);
    sendNotify(url);
  }
  startAsyncCachePopulation();
  if (LOCAL_LOGV)   Log.v(TAG,args.table + "String_Node_Str" + count+ "String_Node_Str"+ initialValues);
  return count;
}
Program: 181434
Project: 181434
Buggy source:
private void fullyPopulateCache(String table,SettingsCache cache){
  SQLiteDatabase db=mOpenHelper.getReadableDatabase();
  Cursor c=db.query(table,new String[]{Settings.NameValueTable.NAME,Settings.NameValueTable.VALUE},null,null,null,null,null,"String_Node_Str" + (MAX_CACHE_ENTRIES + 1));
  try {
synchronized (cache) {
      cache.clear();
      cache.setFullyMatchesDisk(true);
      int rows=0;
      while (c.moveToNext()) {
        rows++;
        String name=c.getString(0);
        String value=c.getString(1);
        cache.populate(name,value);
      }
      if (rows > MAX_CACHE_ENTRIES) {
        cache.setFullyMatchesDisk(false);
        Log.d(TAG,"String_Node_Str" + table);
      }
      Log.d(TAG,"String_Node_Str" + table + "String_Node_Str"+ cache.fullyMatchesDisk());
    }
  }
  finally {
    c.close();
  }
}

Fixed version (ground truth):
private void fullyPopulateCache(String table,SettingsCache cache){
  SQLiteDatabase db=mOpenHelper.getReadableDatabase();
  Cursor c=db.query(table,new String[]{Settings.NameValueTable.NAME,Settings.NameValueTable.VALUE},null,null,null,null,null,"String_Node_Str" + (MAX_CACHE_ENTRIES + 1));
  try {
synchronized (cache) {
      cache.clear();
      cache.setFullyMatchesDisk(true);
      int rows=0;
      while (c.moveToNext()) {
        rows++;
        String name=c.getString(0);
        String value=c.getString(1);
        cache.populate(name,value);
      }
      if (rows > MAX_CACHE_ENTRIES) {
        cache.setFullyMatchesDisk(false);
        Log.d(TAG,"String_Node_Str" + table);
      }
      Log.d(TAG,"String_Node_Str" + table + "String_Node_Str"+ rows+ "String_Node_Str"+ cache.fullyMatchesDisk());
    }
  }
  finally {
    c.close();
  }
}
Program: 181435
Project: 181435
Buggy source:
@Override public int delete(Uri url,String where,String[] whereArgs){
  SqlArguments args=new SqlArguments(url,where,whereArgs);
  if (TABLE_FAVORITES.equals(args.table)) {
    return 0;
  }
 else   if (TABLE_OLD_FAVORITES.equals(args.table)) {
    args.table=TABLE_FAVORITES;
  }
  checkWritePermissions(args);
  sKnownMutationsInFlight.incrementAndGet();
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  int count=db.delete(args.table,args.where,args.args);
  sKnownMutationsInFlight.decrementAndGet();
  if (count > 0) {
    SettingsCache.wipe(args.table);
    sendNotify(url);
  }
  startAsyncCachePopulation();
  if (LOCAL_LOGV)   Log.v(TAG,args.table + "String_Node_Str" + count+ "String_Node_Str");
  return count;
}

Fixed version (ground truth):
@Override public int delete(Uri url,String where,String[] whereArgs){
  SqlArguments args=new SqlArguments(url,where,whereArgs);
  if (TABLE_FAVORITES.equals(args.table)) {
    return 0;
  }
 else   if (TABLE_OLD_FAVORITES.equals(args.table)) {
    args.table=TABLE_FAVORITES;
  }
  checkWritePermissions(args);
  sKnownMutationsInFlight.incrementAndGet();
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  int count=db.delete(args.table,args.where,args.args);
  sKnownMutationsInFlight.decrementAndGet();
  if (count > 0) {
    SettingsCache.invalidate(args.table);
    sendNotify(url);
  }
  startAsyncCachePopulation();
  if (LOCAL_LOGV)   Log.v(TAG,args.table + "String_Node_Str" + count+ "String_Node_Str");
  return count;
}
Program: 181438
Project: 181438
Buggy source:
public void dump(Printer pw,String prefix){
  super.dumpFront(pw,prefix);
  if (className != null) {
    pw.println(prefix + "String_Node_Str" + className);
  }
  if (permission != null) {
    pw.println(prefix + "String_Node_Str" + permission);
  }
  pw.println(prefix + "String_Node_Str" + uid+ "String_Node_Str"+ taskAffinity);
  if (theme != 0) {
    pw.println(prefix + "String_Node_Str" + Integer.toHexString(theme));
  }
  pw.println(prefix + "String_Node_Str" + Integer.toHexString(flags)+ "String_Node_Str"+ processName);
  pw.println(prefix + "String_Node_Str" + sourceDir);
  pw.println(prefix + "String_Node_Str" + publicSourceDir);
  pw.println(prefix + "String_Node_Str" + resourceDirs);
  pw.println(prefix + "String_Node_Str" + dataDir);
  if (sharedLibraryFiles != null) {
    pw.println(prefix + "String_Node_Str" + sharedLibraryFiles);
  }
  pw.println(prefix + "String_Node_Str" + enabled+ "String_Node_Str"+ targetSdkVersion);
  if (manageSpaceActivityName != null) {
    pw.println(prefix + "String_Node_Str" + manageSpaceActivityName);
  }
  if (descriptionRes != 0) {
    pw.println(prefix + "String_Node_Str" + Integer.toHexString(descriptionRes));
  }
  super.dumpBack(pw,prefix);
}

Fixed version (ground truth):
public void dump(Printer pw,String prefix){
  super.dumpFront(pw,prefix);
  if (className != null) {
    pw.println(prefix + "String_Node_Str" + className);
  }
  if (permission != null) {
    pw.println(prefix + "String_Node_Str" + permission);
  }
  pw.println(prefix + "String_Node_Str" + processName);
  pw.println(prefix + "String_Node_Str" + taskAffinity);
  pw.println(prefix + "String_Node_Str" + uid+ "String_Node_Str"+ Integer.toHexString(flags)+ "String_Node_Str"+ Integer.toHexString(theme));
  pw.println(prefix + "String_Node_Str" + sourceDir);
  if (!sourceDir.equals(publicSourceDir)) {
    pw.println(prefix + "String_Node_Str" + publicSourceDir);
  }
  if (resourceDirs != null) {
    pw.println(prefix + "String_Node_Str" + resourceDirs);
  }
  pw.println(prefix + "String_Node_Str" + dataDir);
  if (sharedLibraryFiles != null) {
    pw.println(prefix + "String_Node_Str" + sharedLibraryFiles);
  }
  pw.println(prefix + "String_Node_Str" + enabled+ "String_Node_Str"+ targetSdkVersion);
  if (manageSpaceActivityName != null) {
    pw.println(prefix + "String_Node_Str" + manageSpaceActivityName);
  }
  if (descriptionRes != 0) {
    pw.println(prefix + "String_Node_Str" + Integer.toHexString(descriptionRes));
  }
  super.dumpBack(pw,prefix);
}
Program: 181439
Project: 181439
Buggy source:
private final void realStartServiceLocked(ServiceRecord r,ProcessRecord app) throws RemoteException {
  if (app.thread == null) {
    throw new RemoteException();
  }
  r.app=app;
  r.restartTime=r.lastActivity=SystemClock.uptimeMillis();
  app.services.add(r);
  bumpServiceExecutingLocked(r);
  updateLruProcessLocked(app,true,true);
  boolean created=false;
  try {
    if (DEBUG_SERVICE)     Slog.v(TAG,"String_Node_Str" + r.name + "String_Node_Str"+ r.intent);
    mStringBuilder.setLength(0);
    r.intent.getIntent().toShortString(mStringBuilder,false,true);
    EventLog.writeEvent(EventLogTags.AM_CREATE_SERVICE,System.identityHashCode(r),r.shortName,mStringBuilder.toString(),r.app.pid);
synchronized (r.stats.getBatteryStats()) {
      r.stats.startLaunchedLocked();
    }
    ensurePackageDexOpt(r.serviceInfo.packageName);
    app.thread.scheduleCreateService(r,r.serviceInfo);
    r.postNotification();
    created=true;
  }
  finally {
    if (!created) {
      app.services.remove(r);
      scheduleServiceRestartLocked(r,false);
    }
  }
  requestServiceBindingsLocked(r);
  if (r.startRequested && r.callStart && r.pendingStarts.size() == 0) {
    r.lastStartId++;
    if (r.lastStartId < 1) {
      r.lastStartId=1;
    }
    r.pendingStarts.add(new ServiceRecord.StartItem(r.lastStartId,null));
  }
  sendServiceArgsLocked(r,true);
}

Fixed version (ground truth):
private final void realStartServiceLocked(ServiceRecord r,ProcessRecord app) throws RemoteException {
  if (app.thread == null) {
    throw new RemoteException();
  }
  r.app=app;
  r.restartTime=r.lastActivity=SystemClock.uptimeMillis();
  app.services.add(r);
  bumpServiceExecutingLocked(r);
  updateLruProcessLocked(app,true,true);
  boolean created=false;
  try {
    if (DEBUG_SERVICE)     Slog.v(TAG,"String_Node_Str" + r.name + "String_Node_Str"+ r.intent);
    mStringBuilder.setLength(0);
    r.intent.getIntent().toShortString(mStringBuilder,false,true);
    EventLog.writeEvent(EventLogTags.AM_CREATE_SERVICE,System.identityHashCode(r),r.shortName,mStringBuilder.toString(),r.app.pid);
synchronized (r.stats.getBatteryStats()) {
      r.stats.startLaunchedLocked();
    }
    ensurePackageDexOpt(r.serviceInfo.packageName);
    app.thread.scheduleCreateService(r,r.serviceInfo);
    r.postNotification();
    created=true;
  }
  finally {
    if (!created) {
      app.services.remove(r);
      scheduleServiceRestartLocked(r,false);
    }
  }
  requestServiceBindingsLocked(r);
  if (r.startRequested && r.callStart && r.pendingStarts.size() == 0) {
    r.lastStartId++;
    if (r.lastStartId < 1) {
      r.lastStartId=1;
    }
    r.pendingStarts.add(new ServiceRecord.StartItem(r,r.lastStartId,null,-1));
  }
  sendServiceArgsLocked(r,true);
}
Program: 181440
Project: 181440
Buggy source:
void grantUriPermissionFromIntentLocked(int callingUid,String targetPkg,Intent intent,ActivityRecord activity){
  if (DEBUG_URI_PERMISSION)   Slog.v(TAG,"String_Node_Str" + (intent != null ? intent.getData() : null) + "String_Node_Str"+ intent+ "String_Node_Str"+ Integer.toHexString(intent != null ? intent.getFlags() : 0));
  if (intent == null) {
    return;
  }
  Uri data=intent.getData();
  if (data == null) {
    return;
  }
  grantUriPermissionLocked(callingUid,targetPkg,data,intent.getFlags(),activity);
}

Fixed version (ground truth):
void grantUriPermissionFromIntentLocked(int callingUid,String targetPkg,Intent intent,UriPermissionOwner owner){
  int targetUid=checkGrantUriPermissionFromIntentLocked(callingUid,targetPkg,intent);
  if (targetUid < 0) {
    return;
  }
  grantUriPermissionUncheckedFromIntentLocked(targetUid,targetPkg,intent,owner);
}
Program: 181441
Project: 181441
Buggy source:
public boolean stopServiceToken(ComponentName className,IBinder token,int startId){
synchronized (this) {
    if (DEBUG_SERVICE)     Slog.v(TAG,"String_Node_Str" + className + "String_Node_Str"+ token+ "String_Node_Str"+ startId);
    ServiceRecord r=findServiceLocked(className,token);
    if (r != null) {
      if (startId >= 0) {
        ServiceRecord.StartItem si=r.findDeliveredStart(startId,false);
        if (si != null) {
          while (r.deliveredStarts.size() > 0) {
            if (r.deliveredStarts.remove(0) == si) {
              break;
            }
          }
        }
        if (r.lastStartId != startId) {
          return false;
        }
        if (r.deliveredStarts.size() > 0) {
          Slog.w(TAG,"String_Node_Str" + startId + "String_Node_Str"+ r.deliveredStarts.size()+ "String_Node_Str");
        }
      }
synchronized (r.stats.getBatteryStats()) {
        r.stats.stopRunningLocked();
        r.startRequested=false;
        r.callStart=false;
      }
      final long origId=Binder.clearCallingIdentity();
      bringDownServiceLocked(r,false);
      Binder.restoreCallingIdentity(origId);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean stopServiceToken(ComponentName className,IBinder token,int startId){
synchronized (this) {
    if (DEBUG_SERVICE)     Slog.v(TAG,"String_Node_Str" + className + "String_Node_Str"+ token+ "String_Node_Str"+ startId);
    ServiceRecord r=findServiceLocked(className,token);
    if (r != null) {
      if (startId >= 0) {
        ServiceRecord.StartItem si=r.findDeliveredStart(startId,false);
        if (si != null) {
          while (r.deliveredStarts.size() > 0) {
            ServiceRecord.StartItem cur=r.deliveredStarts.remove(0);
            cur.removeUriPermissionsLocked();
            if (cur == si) {
              break;
            }
          }
        }
        if (r.lastStartId != startId) {
          return false;
        }
        if (r.deliveredStarts.size() > 0) {
          Slog.w(TAG,"String_Node_Str" + startId + "String_Node_Str"+ r.deliveredStarts.size()+ "String_Node_Str");
        }
      }
synchronized (r.stats.getBatteryStats()) {
        r.stats.stopRunningLocked();
        r.startRequested=false;
        r.callStart=false;
      }
      final long origId=Binder.clearCallingIdentity();
      bringDownServiceLocked(r,false);
      Binder.restoreCallingIdentity(origId);
      return true;
    }
  }
  return false;
}
Program: 181444
Project: 181444
Buggy source:
private final void sendServiceArgsLocked(ServiceRecord r,boolean oomAdjusted){
  final int N=r.pendingStarts.size();
  if (N == 0) {
    return;
  }
  int i=0;
  while (i < N) {
    try {
      ServiceRecord.StartItem si=r.pendingStarts.get(i);
      if (DEBUG_SERVICE)       Slog.v(TAG,"String_Node_Str" + r.name + "String_Node_Str"+ r.intent+ "String_Node_Str"+ si.intent);
      if (si.intent == null && N > 1) {
        i++;
        continue;
      }
      bumpServiceExecutingLocked(r);
      if (!oomAdjusted) {
        oomAdjusted=true;
        updateOomAdjLocked(r.app);
      }
      int flags=0;
      if (si.deliveryCount > 0) {
        flags|=Service.START_FLAG_RETRY;
      }
      if (si.doneExecutingCount > 0) {
        flags|=Service.START_FLAG_REDELIVERY;
      }
      r.app.thread.scheduleServiceArgs(r,si.id,flags,si.intent);
      si.deliveredTime=SystemClock.uptimeMillis();
      r.deliveredStarts.add(si);
      si.deliveryCount++;
      i++;
    }
 catch (    RemoteException e) {
      break;
    }
catch (    Exception e) {
      Slog.w(TAG,"String_Node_Str",e);
      break;
    }
  }
  if (i == N) {
    r.pendingStarts.clear();
  }
 else {
    while (i > 0) {
      i--;
      r.pendingStarts.remove(i);
    }
  }
}

Fixed version (ground truth):
private final void sendServiceArgsLocked(ServiceRecord r,boolean oomAdjusted){
  final int N=r.pendingStarts.size();
  if (N == 0) {
    return;
  }
  while (r.pendingStarts.size() > 0) {
    try {
      ServiceRecord.StartItem si=r.pendingStarts.remove(0);
      if (DEBUG_SERVICE)       Slog.v(TAG,"String_Node_Str" + r.name + "String_Node_Str"+ r.intent+ "String_Node_Str"+ si.intent);
      if (si.intent == null) {
        continue;
      }
      si.deliveredTime=SystemClock.uptimeMillis();
      r.deliveredStarts.add(si);
      si.deliveryCount++;
      if (si.targetPermissionUid >= 0) {
        grantUriPermissionUncheckedFromIntentLocked(si.targetPermissionUid,r.packageName,si.intent,si);
      }
      bumpServiceExecutingLocked(r);
      if (!oomAdjusted) {
        oomAdjusted=true;
        updateOomAdjLocked(r.app);
      }
      int flags=0;
      if (si.deliveryCount > 0) {
        flags|=Service.START_FLAG_RETRY;
      }
      if (si.doneExecutingCount > 0) {
        flags|=Service.START_FLAG_REDELIVERY;
      }
      r.app.thread.scheduleServiceArgs(r,si.id,flags,si.intent);
    }
 catch (    RemoteException e) {
      break;
    }
catch (    Exception e) {
      Slog.w(TAG,"String_Node_Str",e);
      break;
    }
  }
}
Program: 181449
Project: 181449
Buggy source:
private boolean getValueAt(int index,TypedValue outValue){
  final int[] data=mData;
  final int type=data[index + AssetManager.STYLE_TYPE];
  if (type == TypedValue.TYPE_NULL) {
    return false;
  }
  outValue.type=type;
  outValue.data=data[index + AssetManager.STYLE_DATA];
  outValue.assetCookie=data[index + AssetManager.STYLE_ASSET_COOKIE];
  outValue.resourceId=data[index + AssetManager.STYLE_RESOURCE_ID];
  outValue.changingConfigurations=data[index + AssetManager.STYLE_CHANGING_CONFIGURATIONS];
  outValue.density=data[index + AssetManager.STYLE_DENSITY];
  if (type == TypedValue.TYPE_STRING) {
    outValue.string=loadStringValueAt(index);
  }
  return true;
}

Fixed version (ground truth):
private boolean getValueAt(int index,TypedValue outValue){
  final int[] data=mData;
  final int type=data[index + AssetManager.STYLE_TYPE];
  if (type == TypedValue.TYPE_NULL) {
    return false;
  }
  outValue.type=type;
  outValue.data=data[index + AssetManager.STYLE_DATA];
  outValue.assetCookie=data[index + AssetManager.STYLE_ASSET_COOKIE];
  outValue.resourceId=data[index + AssetManager.STYLE_RESOURCE_ID];
  outValue.changingConfigurations=data[index + AssetManager.STYLE_CHANGING_CONFIGURATIONS];
  outValue.density=data[index + AssetManager.STYLE_DENSITY];
  outValue.string=(type == TypedValue.TYPE_STRING) ? loadStringValueAt(index) : null;
  return true;
}