nus-yam/ex-repair huggingface dataset:
Program: 43103
Project: 43103
Buggy source:
private void initRS(){
  mFSM=new FilmStripMesh();
  mMesh=mFSM.init(mRS);
  mMesh.setName("String_Node_Str");
  initPFS();
  initPF();
  initPV();
  Log.e("String_Node_Str","String_Node_Str");
  mStripPositionType=Type.createFromClass(mRS,StripPosition.class,1);
  ScriptC.Builder sb=new ScriptC.Builder(mRS);
  sb.setScript(mRes,R.raw.filmstrip);
  sb.setRoot(true);
  sb.setType(mStripPositionType,"String_Node_Str",1);
  mScriptStrip=sb.create();
  mScriptStrip.setClearColor(0.0f,0.0f,0.0f,1.0f);
  mAllocPos=Allocation.createTyped(mRS,mStripPositionType);
  loadImages();
  initState();
  mPVA=new ProgramVertex.MatrixAllocation(mRS);
  mPVBackground.bindAllocation(mPVA);
  mPVImages.bindAllocation(mPVA);
  mPVA.setupProjectionNormalized(320,480);
  mScriptStrip.bindAllocation(mAllocIDs,0);
  mScriptStrip.bindAllocation(mAllocPos,1);
  mScriptStrip.bindAllocation(mAllocState,2);
  mScriptStrip.bindAllocation(mPVA.mAlloc,3);
  mAllocOffsets=Allocation.createSized(mRS,Element.USER_I32,mFSM.mTriangleOffsets.length);
  mAllocOffsets.data(mFSM.mTriangleOffsets);
  mScriptStrip.bindAllocation(mAllocOffsets,4);
  mAllocOffsetsTex=Allocation.createSized(mRS,Element.USER_FLOAT,mFSM.mTriangleOffsetsTex.length);
  mAllocOffsetsTex.data(mFSM.mTriangleOffsetsTex);
  mScriptStrip.bindAllocation(mAllocOffsetsTex,5);
  setFilmStripPosition(0,0);
  mRS.contextBindRootScript(mScriptStrip);
}

Fixed version (ground truth):
private void initRS(){
  mFSM=new FilmStripMesh();
  mMesh=mFSM.init(mRS);
  mMesh.setName("String_Node_Str");
  initPFS();
  initPF();
  initPV();
  Log.e("String_Node_Str","String_Node_Str");
  mStripPositionType=Type.createFromClass(mRS,StripPosition.class,1);
  ScriptC.Builder sb=new ScriptC.Builder(mRS);
  sb.setScript(mRes,R.raw.filmstrip);
  sb.setRoot(true);
  sb.setType(mStripPositionType,"String_Node_Str",1);
  mScriptStrip=sb.create();
  mScriptStrip.setClearColor(0.0f,0.0f,0.0f,1.0f);
  mAllocPos=Allocation.createTyped(mRS,mStripPositionType);
  loadImages();
  initState();
  mPVA=new ProgramVertex.MatrixAllocation(mRS);
  mPVBackground.bindAllocation(mPVA);
  mPVImages.bindAllocation(mPVA);
  mPVA.setupProjectionNormalized(320,480);
  mScriptStrip.bindAllocation(mAllocIDs,0);
  mScriptStrip.bindAllocation(mAllocPos,1);
  mScriptStrip.bindAllocation(mAllocState,2);
  mScriptStrip.bindAllocation(mPVA.mAlloc,3);
  mAllocOffsets=Allocation.createSized(mRS,Element.USER_I32(mRS),mFSM.mTriangleOffsets.length);
  mAllocOffsets.data(mFSM.mTriangleOffsets);
  mScriptStrip.bindAllocation(mAllocOffsets,4);
  mAllocOffsetsTex=Allocation.createSized(mRS,Element.USER_F32(mRS),mFSM.mTriangleOffsetsTex.length);
  mAllocOffsetsTex.data(mFSM.mTriangleOffsetsTex);
  mScriptStrip.bindAllocation(mAllocOffsetsTex,5);
  setFilmStripPosition(0,0);
  mRS.contextBindRootScript(mScriptStrip);
}
Program: 43105
Project: 43105
Buggy source:
private void initRS(){
  ScriptC.Builder sb=new ScriptC.Builder(mRS);
  sb.setScript(mRes,R.raw.rollo);
  sb.setRoot(true);
  mScript=sb.create();
  mScript.setClearColor(0.0f,0.0f,0.0f,0.0f);
  mAllocStateBuf=new int[]{0,0,0,8,0,0,-1,0,mAllocIconIDBuf.length,0,0};
  mAllocState=Allocation.createSized(mRS,Element.USER_I32,mAllocStateBuf.length);
  mScript.bindAllocation(mAllocState,0);
  mScript.bindAllocation(mAllocIconID,1);
  mScript.bindAllocation(mAllocScratch,2);
  mScript.bindAllocation(mAllocLabelID,3);
  setPosition(0);
  setZoom(1);
  mRS.contextBindRootScript(mScript);
}

Fixed version (ground truth):
private void initRS(){
  ScriptC.Builder sb=new ScriptC.Builder(mRS);
  sb.setScript(mRes,R.raw.rollo);
  sb.setRoot(true);
  mScript=sb.create();
  mScript.setClearColor(0.0f,0.0f,0.0f,0.0f);
  mAllocStateBuf=new int[]{0,0,0,8,0,0,-1,0,mAllocIconIDBuf.length,0,0};
  mAllocState=Allocation.createSized(mRS,Element.USER_I32(mRS),mAllocStateBuf.length);
  mScript.bindAllocation(mAllocState,0);
  mScript.bindAllocation(mAllocIconID,1);
  mScript.bindAllocation(mAllocScratch,2);
  mScript.bindAllocation(mAllocLabelID,3);
  setPosition(0);
  setZoom(1);
  mRS.contextBindRootScript(mScript);
}
Program: 43106
Project: 43106
Buggy source:
Allocation makeTextBitmap(String t){
  Bitmap b=Bitmap.createBitmap(128,32,Bitmap.Config.ARGB_8888);
  Canvas c=new Canvas(b);
  Paint p=new Paint();
  p.setTypeface(Typeface.DEFAULT_BOLD);
  p.setTextSize(20);
  p.setColor(0xffffffff);
  c.drawText(t,2,26,p);
  return Allocation.createFromBitmap(mRS,b,Element.RGBA_8888,true);
}

Fixed version (ground truth):
Allocation makeTextBitmap(String t){
  Bitmap b=Bitmap.createBitmap(128,32,Bitmap.Config.ARGB_8888);
  Canvas c=new Canvas(b);
  Paint p=new Paint();
  p.setTypeface(Typeface.DEFAULT_BOLD);
  p.setTextSize(20);
  p.setColor(0xffffffff);
  c.drawText(t,2,26,p);
  return Allocation.createFromBitmap(mRS,b,Element.RGBA_8888(mRS),true);
}
Program: 43108
Project: 43108
Buggy source:
public void performEnableScreen(){
synchronized (mWindowMap) {
    if (mDisplayEnabled) {
      return;
    }
    if (!mSystemBooted) {
      return;
    }
    final int N=mWindows.size();
    for (int i=0; i < N; i++) {
      WindowState w=(WindowState)mWindows.get(i);
      if (w.isVisibleLw() && !w.isDisplayedLw()) {
        return;
      }
    }
    mDisplayEnabled=true;
    if (false) {
      Log.i(TAG,"String_Node_Str");
      StringWriter sw=new StringWriter();
      PrintWriter pw=new PrintWriter(sw);
      this.dump(null,pw,null);
      Log.i(TAG,sw.toString());
    }
    try {
      IBinder surfaceFlinger=ServiceManager.getService("String_Node_Str");
      if (surfaceFlinger != null) {
        Parcel data=Parcel.obtain();
        data.writeInterfaceToken("String_Node_Str");
        surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION,data,null,0);
        data.recycle();
      }
    }
 catch (    RemoteException ex) {
      Log.e(TAG,"String_Node_Str");
    }
  }
  mPolicy.enableScreenAfterBoot();
  setRotationUnchecked(WindowManagerPolicy.USE_LAST_ROTATION,false,mLastRotationFlags | Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
}

Fixed version (ground truth):
public void performEnableScreen(){
synchronized (mWindowMap) {
    if (mDisplayEnabled) {
      return;
    }
    if (!mSystemBooted) {
      return;
    }
    final int N=mWindows.size();
    for (int i=0; i < N; i++) {
      WindowState w=(WindowState)mWindows.get(i);
      if (w.isVisibleLw() && !w.isDrawnLw()) {
        return;
      }
    }
    mDisplayEnabled=true;
    if (false) {
      Log.i(TAG,"String_Node_Str");
      StringWriter sw=new StringWriter();
      PrintWriter pw=new PrintWriter(sw);
      this.dump(null,pw,null);
      Log.i(TAG,sw.toString());
    }
    try {
      IBinder surfaceFlinger=ServiceManager.getService("String_Node_Str");
      if (surfaceFlinger != null) {
        Parcel data=Parcel.obtain();
        data.writeInterfaceToken("String_Node_Str");
        surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION,data,null,0);
        data.recycle();
      }
    }
 catch (    RemoteException ex) {
      Log.e(TAG,"String_Node_Str");
    }
  }
  mPolicy.enableScreenAfterBoot();
  setRotationUnchecked(WindowManagerPolicy.USE_LAST_ROTATION,false,mLastRotationFlags | Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE);
}
Program: 43112
Project: 43112
Buggy source:
/** 
 * Bind the contact details provided by the given   {@link Cursor}.
 */
protected void bindContactInfo(Cursor c){
  if (c == null || !c.moveToFirst())   return;
  final String displayName=c.getString(HEADER_DISPLAY_NAME_COLUMN_INDEX);
  final long contactId=c.getLong(HEADER_CONTACT_ID_COLUMN_INDEX);
  final String lookupKey=c.getString(HEADER_LOOKUP_KEY_COLUMN_INDEX);
  final String phoneticName=null;
  this.setDisplayName(displayName,null);
  final boolean starred=c.getInt(HEADER_STARRED_COLUMN_INDEX) != 0;
  mStarredView.setChecked(starred);
  Bitmap photoBitmap=loadContactPhoto(c.getLong(HEADER_PHOTO_ID_COLUMN_INDEX),null);
  if (photoBitmap == null) {
    photoBitmap=loadPlaceholderPhoto(null);
  }
  mPhotoView.setImageBitmap(photoBitmap);
  mPhotoView.assignContactUri(Contacts.getLookupUri(contactId,lookupKey));
  int presence=c.getInt(HEADER_PRESENCE_STATUS_COLUMN_INDEX);
  mPresenceView.setImageResource(Presence.getPresenceIconResourceId(presence));
}

Fixed version (ground truth):
/** 
 * Bind the contact details provided by the given   {@link Cursor}.
 */
protected void bindContactInfo(Cursor c){
  if (c == null || !c.moveToFirst())   return;
  final String displayName=c.getString(HEADER_DISPLAY_NAME_COLUMN_INDEX);
  final long contactId=c.getLong(HEADER_CONTACT_ID_COLUMN_INDEX);
  final String lookupKey=c.getString(HEADER_LOOKUP_KEY_COLUMN_INDEX);
  final String phoneticName=null;
  this.setDisplayName(displayName,null);
  final boolean starred=c.getInt(HEADER_STARRED_COLUMN_INDEX) != 0;
  mStarredView.setChecked(starred);
  Bitmap photoBitmap=loadContactPhoto(c.getLong(HEADER_PHOTO_ID_COLUMN_INDEX),null);
  if (photoBitmap == null) {
    photoBitmap=loadPlaceholderPhoto(null);
  }
  mPhotoView.setImageBitmap(photoBitmap);
  mPhotoView.assignContactUri(Contacts.getLookupUri(contactId,lookupKey));
  if (!c.isNull(HEADER_PRESENCE_STATUS_COLUMN_INDEX)) {
    int presence=c.getInt(HEADER_PRESENCE_STATUS_COLUMN_INDEX);
    mPresenceView.setImageResource(Presence.getPresenceIconResourceId(presence));
    mPresenceView.setVisibility(View.VISIBLE);
  }
 else {
    mPresenceView.setVisibility(View.GONE);
  }
}
Program: 43115
Project: 43115
Buggy source:
/** 
 * Handle message sent by   {@link #showLocked}.
 * @see #SHOW
 */
private void handleShow(){
synchronized (KeyguardViewMediator.this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    if (!mSystemReady)     return;
    mRealPowerManager.enableUserActivity(false);
    mKeyguardViewManager.show();
    mShowing=true;
  }
}

Fixed version (ground truth):
/** 
 * Handle message sent by   {@link #showLocked}.
 * @see #SHOW
 */
private void handleShow(){
synchronized (KeyguardViewMediator.this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    if (!mSystemReady)     return;
    mRealPowerManager.enableUserActivity(false);
    mKeyguardViewManager.show();
    mShowing=true;
    try {
      ActivityManagerNative.getDefault().closeSystemDialogs("String_Node_Str");
    }
 catch (    RemoteException e) {
    }
  }
}
Program: 43116
Project: 43116
Buggy source:
public PackageInfo(ActivityThread activityThread,String name,Context systemContext){
  mActivityThread=activityThread;
  mApplicationInfo=new ApplicationInfo();
  mApplicationInfo.packageName=name;
  mPackageName=name;
  mAppDir=null;
  mResDir=null;
  mSharedLibraries=null;
  mDataDir=null;
  mDataDirFile=null;
  mBaseClassLoader=null;
  mSecurityViolation=false;
  mIncludeCode=true;
  mClassLoader=systemContext.getClassLoader();
  mResources=systemContext.getResources();
  mCompatibilityInfo=new CompatibilityInfo(mApplicationInfo);
}

Fixed version (ground truth):
public PackageInfo(ActivityThread activityThread,String name,Context systemContext,ApplicationInfo info){
  mActivityThread=activityThread;
  mApplicationInfo=info != null ? info : new ApplicationInfo();
  mApplicationInfo.packageName=name;
  mPackageName=name;
  mAppDir=null;
  mResDir=null;
  mSharedLibraries=null;
  mDataDir=null;
  mDataDirFile=null;
  mBaseClassLoader=null;
  mSecurityViolation=false;
  mIncludeCode=true;
  mClassLoader=systemContext.getClassLoader();
  mResources=systemContext.getResources();
  mCompatibilityInfo=new CompatibilityInfo(mApplicationInfo);
}
Program: 43117
Project: 43117
Buggy source:
public ApplicationContext getSystemContext(){
synchronized (this) {
    if (mSystemContext == null) {
      ApplicationContext context=ApplicationContext.createSystemContext(this);
      PackageInfo info=new PackageInfo(this,"String_Node_Str",context);
      context.init(info,null,this);
      context.getResources().updateConfiguration(getConfiguration(),getDisplayMetricsLocked(false));
      mSystemContext=context;
    }
  }
  return mSystemContext;
}

Fixed version (ground truth):
public ApplicationContext getSystemContext(){
synchronized (this) {
    if (mSystemContext == null) {
      ApplicationContext context=ApplicationContext.createSystemContext(this);
      PackageInfo info=new PackageInfo(this,"String_Node_Str",context,null);
      context.init(info,null,this);
      context.getResources().updateConfiguration(getConfiguration(),getDisplayMetricsLocked(false));
      mSystemContext=context;
    }
  }
  return mSystemContext;
}
Program: 43118
Project: 43118
Buggy source:
public static void setSystemProcess(){
  try {
    ActivityManagerService m=mSelf;
    ServiceManager.addService("String_Node_Str",m);
    ServiceManager.addService("String_Node_Str",new MemBinder(m));
    if (MONITOR_CPU_USAGE) {
      ServiceManager.addService("String_Node_Str",new CpuBinder(m));
    }
    ServiceManager.addService("String_Node_Str",new BroadcastsBinder(m));
    ServiceManager.addService("String_Node_Str",new ServicesBinder(m));
    ServiceManager.addService("String_Node_Str",new SendersBinder(m));
    ServiceManager.addService("String_Node_Str",new ProvidersBinder(m));
    ServiceManager.addService("String_Node_Str",new PermissionController(m));
    ApplicationInfo info=mSelf.mContext.getPackageManager().getApplicationInfo("String_Node_Str",STOCK_PM_FLAGS);
synchronized (mSelf) {
      ProcessRecord app=mSelf.newProcessRecordLocked(mSystemThread.getApplicationThread(),info,info.processName);
      app.persistent=true;
      app.pid=Process.myPid();
      app.maxAdj=SYSTEM_ADJ;
      mSelf.mProcessNames.put(app.processName,app.info.uid,app);
synchronized (mSelf.mPidsSelfLocked) {
        mSelf.mPidsSelfLocked.put(app.pid,app);
      }
      mSelf.updateLRUListLocked(app,true);
    }
  }
 catch (  PackageManager.NameNotFoundException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public static void setSystemProcess(){
  try {
    ActivityManagerService m=mSelf;
    ServiceManager.addService("String_Node_Str",m);
    ServiceManager.addService("String_Node_Str",new MemBinder(m));
    if (MONITOR_CPU_USAGE) {
      ServiceManager.addService("String_Node_Str",new CpuBinder(m));
    }
    ServiceManager.addService("String_Node_Str",new BroadcastsBinder(m));
    ServiceManager.addService("String_Node_Str",new ServicesBinder(m));
    ServiceManager.addService("String_Node_Str",new SendersBinder(m));
    ServiceManager.addService("String_Node_Str",new ProvidersBinder(m));
    ServiceManager.addService("String_Node_Str",new PermissionController(m));
    ApplicationInfo info=mSelf.mContext.getPackageManager().getApplicationInfo("String_Node_Str",STOCK_PM_FLAGS);
    mSystemThread.installSystemApplicationInfo(info);
synchronized (mSelf) {
      ProcessRecord app=mSelf.newProcessRecordLocked(mSystemThread.getApplicationThread(),info,info.processName);
      app.persistent=true;
      app.pid=Process.myPid();
      app.maxAdj=SYSTEM_ADJ;
      mSelf.mProcessNames.put(app.processName,app.info.uid,app);
synchronized (mSelf.mPidsSelfLocked) {
        mSelf.mPidsSelfLocked.put(app.pid,app);
      }
      mSelf.updateLRUListLocked(app,true);
    }
  }
 catch (  PackageManager.NameNotFoundException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 43119
Project: 43119
Buggy source:
/** 
 * Creates a centered bitmap of the desired size.
 * @param source
 * @param recycle whether we want to recycle the input
 */
public static Bitmap extractMiniThumb(Bitmap source,int width,int height,boolean recycle){
  if (source == null) {
    return null;
  }
  float scale;
  if (source.getWidth() < source.getHeight()) {
    scale=width / (float)source.getWidth();
  }
 else {
    scale=height / (float)source.getHeight();
  }
  Matrix matrix=new Matrix();
  matrix.setScale(scale,scale);
  Bitmap miniThumbnail=transform(matrix,source,width,height,false,recycle);
  return miniThumbnail;
}

Fixed version (ground truth):
/** 
 * Creates a centered bitmap of the desired size.
 * @param source
 * @param recycle whether we want to recycle the input
 */
public static Bitmap extractMiniThumb(Bitmap source,int width,int height,boolean recycle){
  if (source == null) {
    return null;
  }
  float scale;
  if (source.getWidth() < source.getHeight()) {
    scale=width / (float)source.getWidth();
  }
 else {
    scale=height / (float)source.getHeight();
  }
  Matrix matrix=new Matrix();
  matrix.setScale(scale,scale);
  Bitmap miniThumbnail=transform(matrix,source,width,height,true,recycle);
  return miniThumbnail;
}
Program: 43121
Project: 43121
Buggy source:
private void updateAnimation(){
  final long millisSoFar=currentAnimationTimeMillis() - mAnimationStartTime;
  final long millisLeft=mAnimationDuration - millisSoFar;
  final int totalDeltaX=mAnimatingDeltaXStart - mAnimatingDeltaXEnd;
  final boolean goingRight=totalDeltaX < 0;
  if (DBG)   log("String_Node_Str" + millisLeft);
  if (millisLeft <= 0) {
    reset();
    return;
  }
  float interpolation=mInterpolator.getInterpolation((float)millisSoFar / mAnimationDuration);
  final int dx=(int)(totalDeltaX * (1 - interpolation));
  mRotaryOffsetX=mAnimatingDeltaXEnd + dx;
  if (mDimplesOfFling > 0) {
    if (!goingRight && mRotaryOffsetX < 3 * mDimpleSpacing) {
      mRotaryOffsetX+=mDimplesOfFling * mDimpleSpacing;
    }
 else     if (goingRight && mRotaryOffsetX > 3 * mDimpleSpacing) {
      mRotaryOffsetX-=mDimplesOfFling * mDimpleSpacing;
    }
  }
  invalidate();
}

Fixed version (ground truth):
private void updateAnimation(){
  final long millisSoFar=currentAnimationTimeMillis() - mAnimationStartTime;
  final long millisLeft=mAnimationDuration - millisSoFar;
  final int totalDeltaX=mAnimatingDeltaXStart - mAnimatingDeltaXEnd;
  final boolean goingRight=totalDeltaX < 0;
  if (DBG)   log("String_Node_Str" + millisLeft);
  if (millisLeft <= 0) {
    reset();
    return;
  }
  float interpolation=mInterpolator.getInterpolation((float)millisSoFar / mAnimationDuration);
  final int dx=(int)(totalDeltaX * (1 - interpolation));
  mRotaryOffsetX=mAnimatingDeltaXEnd + dx;
  if (mDimplesOfFling > 0) {
    if (!goingRight && mRotaryOffsetX < -3 * mDimpleSpacing) {
      mRotaryOffsetX+=mDimplesOfFling * mDimpleSpacing;
    }
 else     if (goingRight && mRotaryOffsetX > 3 * mDimpleSpacing) {
      mRotaryOffsetX-=mDimplesOfFling * mDimpleSpacing;
    }
  }
  invalidate();
}
Program: 43122
Project: 43122
Buggy source:
/** 
 * Handle message sent by   {@link #showLocked}.
 * @see #SHOW
 */
private void handleShow(){
synchronized (KeyguardViewMediator.this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    if (!mSystemReady)     return;
    mRealPowerManager.enableUserActivity(false);
    mKeyguardViewManager.show();
    mShowing=true;
  }
}

Fixed version (ground truth):
/** 
 * Handle message sent by   {@link #showLocked}.
 * @see #SHOW
 */
private void handleShow(){
synchronized (KeyguardViewMediator.this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    if (!mSystemReady)     return;
    mRealPowerManager.enableUserActivity(false);
    mKeyguardViewManager.show();
    mShowing=true;
    try {
      ActivityManagerNative.getDefault().closeSystemDialogs("String_Node_Str");
    }
 catch (    RemoteException e) {
    }
  }
}
Program: 43123
Project: 43123
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)       Log.v(TAG,"String_Node_Str" + r.name + "String_Node_Str"+ r.intent+ "String_Node_Str"+ si.intent);
      if (si.intent == null && N > 0) {
        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) {
      Log.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;
  }
  int i=0;
  while (i < N) {
    try {
      ServiceRecord.StartItem si=r.pendingStarts.get(i);
      if (DEBUG_SERVICE)       Log.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) {
      Log.w(TAG,"String_Node_Str",e);
      break;
    }
  }
  if (i == N) {
    r.pendingStarts.clear();
  }
 else {
    while (i > 0) {
      i--;
      r.pendingStarts.remove(i);
    }
  }
}
Program: 43126
Project: 43126
Buggy source:
/** 
 * @return whether the descendant of this scroll view is within deltapixels of being on the screen.
 */
private boolean isWithinDeltaOfScreen(View descendant,int delta){
  descendant.getDrawingRect(mTempRect);
  offsetDescendantRectToMyCoords(descendant,mTempRect);
  return (mTempRect.bottom + delta) >= getScrollY() && (mTempRect.top - delta) <= (getScrollY() + getHeight());
}

Fixed version (ground truth):
/** 
 * @return whether the descendant of this scroll view is within deltapixels of being on the screen.
 */
private boolean isWithinDeltaOfScreen(View descendant,int delta,int height){
  descendant.getDrawingRect(mTempRect);
  offsetDescendantRectToMyCoords(descendant,mTempRect);
  return (mTempRect.bottom + delta) >= getScrollY() && (mTempRect.top - delta) <= (getScrollY() + height);
}
Program: 43127
Project: 43127
Buggy source:
/** 
 * @return whether the descendant of this scroll view is scrolled offscreen.
 */
private boolean isOffScreen(View descendant){
  return !isWithinDeltaOfScreen(descendant,0);
}

Fixed version (ground truth):
/** 
 * @return whether the descendant of this scroll view is scrolled offscreen.
 */
private boolean isOffScreen(View descendant){
  return !isWithinDeltaOfScreen(descendant,0,getHeight());
}
Program: 43128
Project: 43128
Buggy source:
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  super.onSizeChanged(w,h,oldw,oldh);
  View currentFocused=findFocus();
  if (null == currentFocused || this == currentFocused)   return;
  final int maxJump=mBottom - mTop;
  if (isWithinDeltaOfScreen(currentFocused,maxJump)) {
    currentFocused.getDrawingRect(mTempRect);
    offsetDescendantRectToMyCoords(currentFocused,mTempRect);
    int scrollDelta=computeScrollDeltaToGetChildRectOnScreen(mTempRect);
    doScrollY(scrollDelta);
  }
}

Fixed version (ground truth):
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  super.onSizeChanged(w,h,oldw,oldh);
  View currentFocused=findFocus();
  if (null == currentFocused || this == currentFocused)   return;
  if (isWithinDeltaOfScreen(currentFocused,0,oldh)) {
    currentFocused.getDrawingRect(mTempRect);
    offsetDescendantRectToMyCoords(currentFocused,mTempRect);
    int scrollDelta=computeScrollDeltaToGetChildRectOnScreen(mTempRect);
    doScrollY(scrollDelta);
  }
}
Program: 43131
Project: 43131
Buggy source:
private void updateStatusLines(){
  if (!mStatus.showStatusLines()) {
    mStatus1.setVisibility(View.INVISIBLE);
    mStatus2.setVisibility(View.INVISIBLE);
  }
 else   if (mCharging != null && mNextAlarm == null) {
    mStatus1.setVisibility(View.VISIBLE);
    mStatus2.setVisibility(View.INVISIBLE);
    mStatus1.setText(mCharging);
    mStatus1.setCompoundDrawablesWithIntrinsicBounds(mChargingIcon,null,null,null);
  }
 else   if (mNextAlarm != null && mCharging == null) {
    mStatus1.setVisibility(View.VISIBLE);
    mStatus2.setVisibility(View.INVISIBLE);
    mStatus1.setText(mNextAlarm);
    mStatus1.setCompoundDrawablesWithIntrinsicBounds(mAlarmIcon,null,null,null);
  }
 else   if (mCharging != null && mNextAlarm != null) {
    mStatus1.setVisibility(View.VISIBLE);
    mStatus2.setVisibility(View.VISIBLE);
    mStatus1.setText(mCharging);
    mStatus1.setCompoundDrawablesWithIntrinsicBounds(mChargingIcon,null,null,null);
    mStatus2.setText(mNextAlarm);
    mStatus2.setCompoundDrawablesWithIntrinsicBounds(mAlarmIcon,null,null,null);
  }
}

Fixed version (ground truth):
private void updateStatusLines(){
  if (!mStatus.showStatusLines() || (mCharging == null && mNextAlarm == null)) {
    mStatus1.setVisibility(View.INVISIBLE);
    mStatus2.setVisibility(View.INVISIBLE);
  }
 else   if (mCharging != null && mNextAlarm == null) {
    mStatus1.setVisibility(View.VISIBLE);
    mStatus2.setVisibility(View.INVISIBLE);
    mStatus1.setText(mCharging);
    mStatus1.setCompoundDrawablesWithIntrinsicBounds(mChargingIcon,null,null,null);
  }
 else   if (mNextAlarm != null && mCharging == null) {
    mStatus1.setVisibility(View.VISIBLE);
    mStatus2.setVisibility(View.INVISIBLE);
    mStatus1.setText(mNextAlarm);
    mStatus1.setCompoundDrawablesWithIntrinsicBounds(mAlarmIcon,null,null,null);
  }
 else   if (mCharging != null && mNextAlarm != null) {
    mStatus1.setVisibility(View.VISIBLE);
    mStatus2.setVisibility(View.VISIBLE);
    mStatus1.setText(mCharging);
    mStatus1.setCompoundDrawablesWithIntrinsicBounds(mChargingIcon,null,null,null);
    mStatus2.setText(mNextAlarm);
    mStatus2.setCompoundDrawablesWithIntrinsicBounds(mAlarmIcon,null,null,null);
  }
}
Program: 43135
Project: 43135
Buggy source:
private void updateStatusLines(){
  if (!mStatus.showStatusLines()) {
    mStatus1.setVisibility(View.INVISIBLE);
    mStatus2.setVisibility(View.INVISIBLE);
  }
 else   if (mCharging != null && mNextAlarm == null) {
    mStatus1.setVisibility(View.VISIBLE);
    mStatus2.setVisibility(View.INVISIBLE);
    mStatus1.setText(mCharging);
    mStatus1.setCompoundDrawablesWithIntrinsicBounds(mChargingIcon,null,null,null);
  }
 else   if (mNextAlarm != null && mCharging == null) {
    mStatus1.setVisibility(View.VISIBLE);
    mStatus2.setVisibility(View.INVISIBLE);
    mStatus1.setText(mNextAlarm);
    mStatus1.setCompoundDrawablesWithIntrinsicBounds(mAlarmIcon,null,null,null);
  }
 else   if (mCharging != null && mNextAlarm != null) {
    mStatus1.setVisibility(View.VISIBLE);
    mStatus2.setVisibility(View.VISIBLE);
    mStatus1.setText(mCharging);
    mStatus1.setCompoundDrawablesWithIntrinsicBounds(mChargingIcon,null,null,null);
    mStatus2.setText(mNextAlarm);
    mStatus2.setCompoundDrawablesWithIntrinsicBounds(mAlarmIcon,null,null,null);
  }
}

Fixed version (ground truth):
private void updateStatusLines(){
  if (!mStatus.showStatusLines() || (mCharging == null && mNextAlarm == null)) {
    mStatus1.setVisibility(View.INVISIBLE);
    mStatus2.setVisibility(View.INVISIBLE);
  }
 else   if (mCharging != null && mNextAlarm == null) {
    mStatus1.setVisibility(View.VISIBLE);
    mStatus2.setVisibility(View.INVISIBLE);
    mStatus1.setText(mCharging);
    mStatus1.setCompoundDrawablesWithIntrinsicBounds(mChargingIcon,null,null,null);
  }
 else   if (mNextAlarm != null && mCharging == null) {
    mStatus1.setVisibility(View.VISIBLE);
    mStatus2.setVisibility(View.INVISIBLE);
    mStatus1.setText(mNextAlarm);
    mStatus1.setCompoundDrawablesWithIntrinsicBounds(mAlarmIcon,null,null,null);
  }
 else   if (mCharging != null && mNextAlarm != null) {
    mStatus1.setVisibility(View.VISIBLE);
    mStatus2.setVisibility(View.VISIBLE);
    mStatus1.setText(mCharging);
    mStatus1.setCompoundDrawablesWithIntrinsicBounds(mChargingIcon,null,null,null);
    mStatus2.setText(mNextAlarm);
    mStatus2.setCompoundDrawablesWithIntrinsicBounds(mAlarmIcon,null,null,null);
  }
}
Program: 43136
Project: 43136
Buggy source:
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
  try {
switch (token) {
case TOKEN_CONTACT_INFO:
{
        bindContactInfo(cursor);
        invalidate();
        break;
      }
case TOKEN_SOCIAL:
{
      bindSocial(cursor);
      invalidate();
      break;
    }
case TOKEN_PHONE_LOOKUP:
{
    if (cursor != null && cursor.moveToFirst()) {
      long contactId=cursor.getLong(PHONE_LOOKUP_CONTACT_ID_COLUMN_INDEX);
      String lookupKey=cursor.getString(PHONE_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
      bindFromContactUri(Contacts.getLookupUri(contactId,lookupKey));
    }
 else {
      setDisplayName((String)cookie,null);
    }
    break;
  }
case TOKEN_EMAIL_LOOKUP:
{
  if (cursor != null && cursor.moveToFirst()) {
    long contactId=cursor.getLong(EMAIL_LOOKUP_CONTACT_ID_COLUMN_INDEX);
    String lookupKey=cursor.getString(EMAIL_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
    bindFromContactUri(Contacts.getLookupUri(contactId,lookupKey));
  }
 else {
    setDisplayName((String)cookie,null);
  }
  break;
}
case TOKEN_LOOKUP_CONTACT_FOR_SOCIAL_QUERY:
{
if (cursor != null && cursor.moveToFirst()) {
  long contactId=cursor.getLong(CONTACT_LOOKUP_ID_COLUMN_INDEX);
  startSocialQuery(ContentUris.withAppendedId(Activities.CONTENT_CONTACT_STATUS_URI,contactId));
}
}
}
}
  finally {
if (cursor != null) {
cursor.close();
}
}
}

Fixed version (ground truth):
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
  try {
switch (token) {
case TOKEN_CONTACT_INFO:
{
        bindContactInfo(cursor);
        invalidate();
        break;
      }
case TOKEN_SOCIAL:
{
      bindSocial(cursor);
      invalidate();
      break;
    }
case TOKEN_PHONE_LOOKUP:
{
    if (cursor != null && cursor.moveToFirst()) {
      long contactId=cursor.getLong(PHONE_LOOKUP_CONTACT_ID_COLUMN_INDEX);
      String lookupKey=cursor.getString(PHONE_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
      bindFromContactUri(Contacts.getLookupUri(contactId,lookupKey));
    }
 else {
      String phoneNumber=(String)cookie;
      setDisplayName(phoneNumber,null);
      mPhotoView.assignContactFromPhone(phoneNumber,true);
    }
    break;
  }
case TOKEN_EMAIL_LOOKUP:
{
  if (cursor != null && cursor.moveToFirst()) {
    long contactId=cursor.getLong(EMAIL_LOOKUP_CONTACT_ID_COLUMN_INDEX);
    String lookupKey=cursor.getString(EMAIL_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
    bindFromContactUri(Contacts.getLookupUri(contactId,lookupKey));
  }
 else {
    String emailAddress=(String)cookie;
    setDisplayName(emailAddress,null);
    mPhotoView.assignContactFromEmail(emailAddress,true);
  }
  break;
}
case TOKEN_LOOKUP_CONTACT_FOR_SOCIAL_QUERY:
{
if (cursor != null && cursor.moveToFirst()) {
  long contactId=cursor.getLong(CONTACT_LOOKUP_ID_COLUMN_INDEX);
  startSocialQuery(ContentUris.withAppendedId(Activities.CONTENT_CONTACT_STATUS_URI,contactId));
}
}
}
}
  finally {
if (cursor != null) {
cursor.close();
}
}
}
Program: 43137
Project: 43137
Buggy source:
private static char findPOrWCharToAppend(String phoneNumber,int currPwIndex,int nextNonPwCharIndex){
  char c=phoneNumber.charAt(currPwIndex);
  char ret;
  ret=(isPause(c)) ? PhoneNumberUtils.PAUSE : PhoneNumberUtils.WAIT;
  if (isPause(c) && (nextNonPwCharIndex > (currPwIndex + 2))) {
    ret=PhoneNumberUtils.WAIT;
  }
  return ret;
}

Fixed version (ground truth):
private static char findPOrWCharToAppend(String phoneNumber,int currPwIndex,int nextNonPwCharIndex){
  char c=phoneNumber.charAt(currPwIndex);
  char ret;
  ret=(isPause(c)) ? PhoneNumberUtils.PAUSE : PhoneNumberUtils.WAIT;
  if (nextNonPwCharIndex > (currPwIndex + 1)) {
    ret=PhoneNumberUtils.WAIT;
  }
  return ret;
}
Program: 43138
Project: 43138
Buggy source:
boolean update(DriverCall dc){
  CdmaCall newParent;
  boolean changed=false;
  boolean wasConnectingInOrOut=isConnectingInOrOut();
  boolean wasHolding=(getState() == CdmaCall.State.HOLDING);
  newParent=parentFromDCState(dc.state);
  if (!equalsHandlesNulls(address,dc.number)) {
    if (Phone.DEBUG_PHONE)     log("String_Node_Str");
    address=dc.number;
    changed=true;
  }
  if (TextUtils.isEmpty(dc.name)) {
    if (!TextUtils.isEmpty(cnapName)) {
      changed=true;
      cnapName="String_Node_Str";
    }
  }
 else   if (!dc.name.equals(cnapName)) {
    changed=true;
    cnapName=dc.name;
  }
  log("String_Node_Str" + cnapName);
  cnapNamePresentation=dc.namePresentation;
  numberPresentation=dc.numberPresentation;
  if (newParent != parent) {
    if (parent != null) {
      parent.detach(this);
    }
    newParent.attach(this,dc);
    parent=newParent;
    changed=true;
  }
 else {
    boolean parentStateChange;
    parentStateChange=parent.update(this,dc);
    changed=changed || parentStateChange;
  }
  if (Phone.DEBUG_PHONE)   log("String_Node_Str" + parent + "String_Node_Str"+ (newParent != parent)+ "String_Node_Str"+ wasConnectingInOrOut+ "String_Node_Str"+ wasHolding+ "String_Node_Str"+ isConnectingInOrOut()+ "String_Node_Str"+ changed);
  if (wasConnectingInOrOut && !isConnectingInOrOut()) {
    onConnectedInOrOut();
  }
  if (changed && !wasHolding && (getState() == CdmaCall.State.HOLDING)) {
    onStartedHolding();
  }
  return changed;
}

Fixed version (ground truth):
boolean update(DriverCall dc){
  CdmaCall newParent;
  boolean changed=false;
  boolean wasConnectingInOrOut=isConnectingInOrOut();
  boolean wasHolding=(getState() == CdmaCall.State.HOLDING);
  newParent=parentFromDCState(dc.state);
  if (Phone.DEBUG_PHONE)   log("String_Node_Str" + parent + "String_Node_Str"+ newParent);
  if (!equalsHandlesNulls(address,dc.number)) {
    if (Phone.DEBUG_PHONE)     log("String_Node_Str");
    address=dc.number;
    changed=true;
  }
  if (TextUtils.isEmpty(dc.name)) {
    if (!TextUtils.isEmpty(cnapName)) {
      changed=true;
      cnapName="String_Node_Str";
    }
  }
 else   if (!dc.name.equals(cnapName)) {
    changed=true;
    cnapName=dc.name;
  }
  if (Phone.DEBUG_PHONE)   log("String_Node_Str" + cnapName);
  cnapNamePresentation=dc.namePresentation;
  numberPresentation=dc.numberPresentation;
  if (newParent != parent) {
    if (parent != null) {
      parent.detach(this);
    }
    newParent.attach(this,dc);
    parent=newParent;
    changed=true;
  }
 else {
    boolean parentStateChange;
    parentStateChange=parent.update(this,dc);
    changed=changed || parentStateChange;
  }
  if (Phone.DEBUG_PHONE)   log("String_Node_Str" + wasConnectingInOrOut + "String_Node_Str"+ wasHolding+ "String_Node_Str"+ isConnectingInOrOut()+ "String_Node_Str"+ changed);
  if (wasConnectingInOrOut && !isConnectingInOrOut()) {
    onConnectedInOrOut();
  }
  if (changed && !wasHolding && (getState() == CdmaCall.State.HOLDING)) {
    onStartedHolding();
  }
  return changed;
}
Program: 43139
Project: 43139
Buggy source:
/** 
 * format original dial string 1) convert international dialing prefix "+" to string specified per region 2) handle corner cases for PAUSE/WAIT dialing: If PAUSE/WAIT sequence at the end, ignore them. If consecutive PAUSE/WAIT sequence in the middle of the string, and if there is any WAIT in PAUSE/WAIT sequence, treat them like WAIT.
 */
public static String formatDialString(String phoneNumber){
  if (phoneNumber == null) {
    return null;
  }
  int length=phoneNumber.length();
  StringBuilder ret=new StringBuilder();
  char c;
  int currIndex=0;
  while (currIndex < length) {
    c=phoneNumber.charAt(currIndex);
    if (isPause(c) || isWait(c)) {
      if (currIndex < length - 1) {
        int nextIndex=findNextPCharOrNonPOrNonWCharIndex(phoneNumber,currIndex);
        if (nextIndex < length) {
          char pC=findPOrWCharToAppend(phoneNumber,currIndex,nextIndex);
          ret.append(pC);
          if (nextIndex > (currIndex + 2)) {
            currIndex=nextIndex - 1;
          }
        }
 else         if (nextIndex == length) {
          currIndex=length - 1;
        }
      }
    }
 else {
      ret.append(c);
    }
    currIndex++;
  }
  return PhoneNumberUtils.cdmaCheckAndProcessPlusCode(ret.toString());
}

Fixed version (ground truth):
/** 
 * format original dial string 1) convert international dialing prefix "+" to string specified per region 2) handle corner cases for PAUSE/WAIT dialing: If PAUSE/WAIT sequence at the end, ignore them. If consecutive PAUSE/WAIT sequence in the middle of the string, and if there is any WAIT in PAUSE/WAIT sequence, treat them like WAIT.
 */
public static String formatDialString(String phoneNumber){
  if (phoneNumber == null) {
    return null;
  }
  int length=phoneNumber.length();
  StringBuilder ret=new StringBuilder();
  char c;
  int currIndex=0;
  while (currIndex < length) {
    c=phoneNumber.charAt(currIndex);
    if (isPause(c) || isWait(c)) {
      if (currIndex < length - 1) {
        int nextIndex=findNextPCharOrNonPOrNonWCharIndex(phoneNumber,currIndex);
        if (nextIndex < length) {
          char pC=findPOrWCharToAppend(phoneNumber,currIndex,nextIndex);
          ret.append(pC);
          if (nextIndex > (currIndex + 1)) {
            currIndex=nextIndex - 1;
          }
        }
 else         if (nextIndex == length) {
          currIndex=length - 1;
        }
      }
    }
 else {
      ret.append(c);
    }
    currIndex++;
  }
  return PhoneNumberUtils.cdmaCheckAndProcessPlusCode(ret.toString());
}
Program: 43140
Project: 43140
Buggy source:
/** 
 * Assign the contact uri that this fasttrack badge should be associated with. Note that this is only used for displaying the fasttrack window and won't bind the contact's photo for you.
 * @param conatctUri Either a {Contacts.CONTENT_URI} or {Contacts.CONTENT_LOOKUP_URI}style URI.
 */
public void assignContactUri(Uri contactUri){
  mContactUri=contactUri;
}

Fixed version (ground truth):
/** 
 * Assign the contact uri that this fasttrack badge should be associated with. Note that this is only used for displaying the fasttrack window and won't bind the contact's photo for you.
 * @param contactUri Either a {@link Contacts#CONTENT_URI} or{@link Contacts#CONTENT_LOOKUP_URI} style URI.
 */
public void assignContactUri(Uri contactUri){
  mContactUri=contactUri;
}
Program: 43141
Project: 43141
Buggy source:
/** 
 * Assign a contact based on a phone number. This should only be used when the contact's URI is not available, as an extra query will have to be performed to lookup the URI based on the phone number.
 * @param phoneNumber The phone number of the contact.
 * @param lazyLookup If this is true, the lookup query will not be performeduntil this view is clicked.
 */
public void assignContactFromPhone(String phoneNumber,boolean lazyLookup){
  mContactPhone=phoneNumber;
  if (!lazyLookup) {
    mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP,null,Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,mContactPhone),PHONE_LOOKUP_PROJECTION,null,null,null);
  }
}

Fixed version (ground truth):
/** 
 * Assign a contact based on a phone number. This should only be used when the contact's URI is not available, as an extra query will have to be performed to lookup the URI based on the phone number.
 * @param phoneNumber The phone number of the contact.
 * @param lazyLookup If this is true, the lookup query will not be performeduntil this view is clicked.
 */
public void assignContactFromPhone(String phoneNumber,boolean lazyLookup){
  mContactPhone=phoneNumber;
  if (!lazyLookup) {
    mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP,null,Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,mContactPhone),PHONE_LOOKUP_PROJECTION,null,null,null);
  }
 else {
    mContactUri=null;
  }
}
Program: 43142
Project: 43142
Buggy source:
public void onClick(View v){
  final Rect target=getTargetRect(v);
  if (mContactUri != null) {
    trigger(mContactUri,target);
  }
 else   if (mContactEmail != null) {
    mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP_AND_TRIGGER,target,Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI,Uri.encode(mContactEmail)),EMAIL_LOOKUP_PROJECTION,null,null,null);
  }
 else   if (mContactPhone != null) {
    mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP_AND_TRIGGER,target,Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,mContactPhone),PHONE_LOOKUP_PROJECTION,null,null,null);
  }
 else {
    return;
  }
}

Fixed version (ground truth):
public void onClick(View v){
  if (mContactUri != null) {
    final ContentResolver resolver=getContext().getContentResolver();
    final Uri lookupUri=Contacts.getLookupUri(resolver,mContactUri);
    trigger(lookupUri);
  }
 else   if (mContactEmail != null) {
    mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP_AND_TRIGGER,mContactEmail,Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI,Uri.encode(mContactEmail)),EMAIL_LOOKUP_PROJECTION,null,null,null);
  }
 else   if (mContactPhone != null) {
    mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP_AND_TRIGGER,mContactPhone,Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,mContactPhone),PHONE_LOOKUP_PROJECTION,null,null,null);
  }
 else {
    return;
  }
}
Program: 43143
Project: 43143
Buggy source:
/** 
 * Set the fasttrack window mode. Options are   {@link Intents.MODE_SMALL},  {@link Intents.MODE_MEDIUM},   {@link Intents.MODE_LARGE}.
 * @param size
 */
public void setMode(int size){
  mMode=size;
}

Fixed version (ground truth):
/** 
 * Set the fasttrack window mode. Options are   {@link FastTrack#MODE_SMALL},  {@link FastTrack#MODE_MEDIUM},   {@link FastTrack#MODE_LARGE}.
 * @param size
 */
public void setMode(int size){
  mMode=size;
}
Program: 43144
Project: 43144
Buggy source:
public FasttrackBadgeWidget(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  TypedArray a=context.obtainStyledAttributes(attrs,com.android.internal.R.styleable.FasttrackBadgeWidget,defStyle,0);
  mMode=a.getInt(com.android.internal.R.styleable.FasttrackBadgeWidget_fasttrackWindowSize,Intents.MODE_MEDIUM);
  a.recycle();
  init();
}

Fixed version (ground truth):
public FasttrackBadgeWidget(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  TypedArray a=context.obtainStyledAttributes(attrs,com.android.internal.R.styleable.FasttrackBadgeWidget,defStyle,0);
  mMode=a.getInt(com.android.internal.R.styleable.FasttrackBadgeWidget_fasttrackWindowSize,FastTrack.MODE_MEDIUM);
  a.recycle();
  init();
}
Program: 43145
Project: 43145
Buggy source:
/** 
 * Assign a contact based on an email address. This should only be used when the contact's URI is not available, as an extra query will have to be performed to lookup the URI based on the email.
 * @param emailAddress The email address of the contact.
 * @param lazyLookup If this is true, the lookup query will not be performeduntil this view is clicked.
 */
public void assignContactFromEmail(String emailAddress,boolean lazyLookup){
  mContactEmail=emailAddress;
  if (!lazyLookup) {
    mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP,null,Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI,Uri.encode(mContactEmail)),EMAIL_LOOKUP_PROJECTION,null,null,null);
  }
}

Fixed version (ground truth):
/** 
 * Assign a contact based on an email address. This should only be used when the contact's URI is not available, as an extra query will have to be performed to lookup the URI based on the email.
 * @param emailAddress The email address of the contact.
 * @param lazyLookup If this is true, the lookup query will not be performeduntil this view is clicked.
 */
public void assignContactFromEmail(String emailAddress,boolean lazyLookup){
  mContactEmail=emailAddress;
  if (!lazyLookup) {
    mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP,null,Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI,Uri.encode(mContactEmail)),EMAIL_LOOKUP_PROJECTION,null,null,null);
  }
 else {
    mContactUri=null;
  }
}
Program: 43146
Project: 43146
Buggy source:
private void trigger(Uri contactUri,Rect target){
  Intent intent=new Intent(Intents.SHOW_OR_CREATE_CONTACT,contactUri);
  intent.putExtra(Intents.EXTRA_TARGET_RECT,target);
  intent.putExtra(Intents.EXTRA_MODE,mMode);
  mContext.startActivity(intent);
}

Fixed version (ground truth):
private void trigger(Uri lookupUri){
  FastTrack.showFastTrack(getContext(),this,lookupUri,mMode,mExcludeMimes);
}
Program: 43147
Project: 43147
Buggy source:
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
  Uri contactUri=null;
  boolean trigger=false;
  try {
switch (token) {
case TOKEN_PHONE_LOOKUP_AND_TRIGGER:
      trigger=true;
case TOKEN_PHONE_LOOKUP:
{
      if (cursor != null && cursor.moveToFirst()) {
        long contactId=cursor.getLong(PHONE_ID_COLUMN_INDEX);
        String lookupKey=cursor.getString(PHONE_LOOKUP_STRING_COLUMN_INDEX);
        contactUri=Contacts.getLookupUri(contactId,lookupKey);
      }
      break;
    }
case TOKEN_EMAIL_LOOKUP_AND_TRIGGER:
  trigger=true;
case TOKEN_EMAIL_LOOKUP:
{
  if (cursor != null && cursor.moveToFirst()) {
    long contactId=cursor.getLong(EMAIL_ID_COLUMN_INDEX);
    String lookupKey=cursor.getString(EMAIL_LOOKUP_STRING_COLUMN_INDEX);
    contactUri=Contacts.getLookupUri(contactId,lookupKey);
  }
}
}
}
  finally {
if (cursor != null) {
cursor.close();
}
}
if (contactUri != null) {
mContactUri=contactUri;
if (trigger && cookie != null) {
trigger(contactUri,(Rect)cookie);
}
}
}

Fixed version (ground truth):
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
  Uri lookupUri=null;
  Uri createUri=null;
  boolean trigger=false;
  try {
switch (token) {
case TOKEN_PHONE_LOOKUP_AND_TRIGGER:
      trigger=true;
    createUri=Uri.fromParts("String_Node_Str",(String)cookie,null);
case TOKEN_PHONE_LOOKUP:
{
    if (cursor != null && cursor.moveToFirst()) {
      long contactId=cursor.getLong(PHONE_ID_COLUMN_INDEX);
      String lookupKey=cursor.getString(PHONE_LOOKUP_STRING_COLUMN_INDEX);
      lookupUri=Contacts.getLookupUri(contactId,lookupKey);
    }
    break;
  }
case TOKEN_EMAIL_LOOKUP_AND_TRIGGER:
trigger=true;
createUri=Uri.fromParts("String_Node_Str",(String)cookie,null);
case TOKEN_EMAIL_LOOKUP:
{
if (cursor != null && cursor.moveToFirst()) {
long contactId=cursor.getLong(EMAIL_ID_COLUMN_INDEX);
String lookupKey=cursor.getString(EMAIL_LOOKUP_STRING_COLUMN_INDEX);
lookupUri=Contacts.getLookupUri(contactId,lookupKey);
}
}
}
}
  finally {
if (cursor != null) {
cursor.close();
}
}
mContactUri=lookupUri;
if (trigger && lookupUri != null) {
trigger(lookupUri);
}
 else if (createUri != null) {
final Intent intent=new Intent(Intents.SHOW_OR_CREATE_CONTACT,createUri);
getContext().startActivity(intent);
}
}
Program: 43148
Project: 43148
Buggy source:
/** 
 * Assign the contact uri that this fasttrack badge should be associated with. Note that this is only used for displaying the fasttrack window and won't bind the contact's photo for you.
 * @param conatctUri Either a {Contacts.CONTENT_URI} or {Contacts.CONTENT_LOOKUP_URI}style URI.
 */
public void assignContactUri(Uri contactUri){
  mContactUri=contactUri;
}

Fixed version (ground truth):
/** 
 * Assign the contact uri that this fasttrack badge should be associated with. Note that this is only used for displaying the fasttrack window and won't bind the contact's photo for you.
 * @param contactUri Either a {@link Contacts#CONTENT_URI} or{@link Contacts#CONTENT_LOOKUP_URI} style URI.
 */
public void assignContactUri(Uri contactUri){
  mContactUri=contactUri;
}