nus-yam/ex-repair huggingface dataset:
Program: 23677
Project: 23677
Buggy source:
/** 
 * @see AudioManager#playSoundEffect(int,float) 
 */
public void playSoundEffectVolume(int effectType,float volume){
  sendMsg(mAudioHandler,MSG_PLAY_SOUND_EFFECT,SHARED_MSG,SENDMSG_NOOP,effectType,(int)(volume * 1000),null,0);
}

Fixed version (ground truth):
/** 
 * @see AudioManager#playSoundEffect(int,float) 
 */
public void playSoundEffectVolume(int effectType,float volume){
  loadSoundEffects();
  sendMsg(mAudioHandler,MSG_PLAY_SOUND_EFFECT,SHARED_MSG,SENDMSG_NOOP,effectType,(int)(volume * 1000),null,0);
}
Program: 23681
Project: 23681
Buggy source:
public void die(boolean immediate){
  checkThread();
  if (Config.LOGV)   Log.v("String_Node_Str","String_Node_Str" + this + "String_Node_Str"+ mSurface);
synchronized (this) {
    if (mAdded && !mFirst) {
      int viewVisibility=mView.getVisibility();
      boolean viewVisibilityChanged=mViewVisibility != viewVisibility;
      if (mWindowAttributesChanged || viewVisibilityChanged) {
        try {
          if ((relayoutWindow(mWindowAttributes,viewVisibility,false) & WindowManagerImpl.RELAYOUT_FIRST_TIME) != 0) {
            sWindowSession.finishDrawing(mWindow);
          }
        }
 catch (        RemoteException e) {
        }
      }
      mSurface.release();
    }
    if (mAdded) {
      mAdded=false;
      if (immediate) {
        dispatchDetachedFromWindow();
      }
 else       if (mView != null) {
        sendEmptyMessage(DIE);
      }
    }
  }
}

Fixed version (ground truth):
public void die(boolean immediate){
  if (immediate) {
    doDie();
  }
 else {
    sendEmptyMessage(DIE);
  }
}
Program: 23684
Project: 23684
Buggy source:
/** 
 * Called when the system is mostly done booting to dentermine whether the system should go into safe mode.
 */
public boolean detectSafeMode();

Fixed version (ground truth):
/** 
 * Called when the system is mostly done booting to determine whether the system should go into safe mode.
 */
public boolean detectSafeMode();
Program: 23687
Project: 23687
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: 23690
Project: 23690
Buggy source:
Element(){
  super(null);
  mID=0;
  mSize=0;
}

Fixed version (ground truth):
Element(RenderScript rs,int count){
  super(rs);
  mSize=0;
  mEntries=new Entry[count];
}
Program: 23691
Project: 23691
Buggy source:
public Element create(){
  Element e=new Element();
  e.mEntries=new Entry[mEntryCount];
  java.lang.System.arraycopy(mEntries,0,e.mEntries,0,mEntryCount);
  e.init(mRS);
  return e;
}

Fixed version (ground truth):
public Element create(){
  Element e=new Element(mRS,mEntryCount);
  java.lang.System.arraycopy(mEntries,0,e.mEntries,0,mEntryCount);
  e.init();
  return e;
}
Program: 23692
Project: 23692
Buggy source:
void init(RenderScript rs){
  mRS=rs;
  internalCreate(mRS,this);
}

Fixed version (ground truth):
void init(){
  internalCreate(mRS,this);
}
Program: 23694
Project: 23694
Buggy source:
public MatrixAllocation(RenderScript rs){
  mModel=new Matrix();
  mProjection=new Matrix();
  mTexture=new Matrix();
  mAlloc=Allocation.createSized(rs,Element.USER_FLOAT,48);
  mAlloc.subData1D(MODELVIEW_OFFSET,16,mModel.mMat);
  mAlloc.subData1D(PROJECTION_OFFSET,16,mProjection.mMat);
  mAlloc.subData1D(TEXTURE_OFFSET,16,mTexture.mMat);
}

Fixed version (ground truth):
public MatrixAllocation(RenderScript rs){
  mModel=new Matrix();
  mProjection=new Matrix();
  mTexture=new Matrix();
  mAlloc=Allocation.createSized(rs,Element.USER_F32(rs),48);
  mAlloc.subData1D(MODELVIEW_OFFSET,16,mModel.mMat);
  mAlloc.subData1D(PROJECTION_OFFSET,16,mProjection.mMat);
  mAlloc.subData1D(TEXTURE_OFFSET,16,mTexture.mMat);
}
Program: 23695
Project: 23695
Buggy source:
public RenderScript(Surface sur,boolean useDepth,boolean forceSW){
  mSurface=sur;
  mDev=nDeviceCreate();
  if (forceSW) {
    nDeviceSetConfig(mDev,0,1);
  }
  mContext=nContextCreate(mDev,mSurface,0,useDepth);
  if (!mElementsInitialized) {
    Element.initPredefined(this);
    mElementsInitialized=true;
  }
}

Fixed version (ground truth):
public RenderScript(Surface sur,boolean useDepth,boolean forceSW){
  mSurface=sur;
  mDev=nDeviceCreate();
  if (forceSW) {
    nDeviceSetConfig(mDev,0,1);
  }
  mContext=nContextCreate(mDev,mSurface,0,useDepth);
  Element.initPredefined(this);
}
Program: 23696
Project: 23696
Buggy source:
public SimpleMesh create(){
  Element.Builder b=new Element.Builder(mRS);
  int floatCount=mVtxSize;
  if (mVtxSize == 2) {
    b.addFloatXY();
  }
 else {
    b.addFloatXYZ();
  }
  if (mTex) {
    floatCount+=2;
    b.addFloatST();
  }
  if (mNorm) {
    floatCount+=3;
    b.addFloatNorm();
  }
  mElement=b.create();
  Builder smb=new Builder(mRS);
  smb.addVertexType(mElement,mVtxCount / floatCount);
  smb.setIndexType(Element.INDEX_16,mIndexCount);
  smb.setPrimitive(Primitive.TRIANGLE);
  SimpleMesh sm=smb.create();
  Allocation vertexAlloc=sm.createVertexAllocation(0);
  Allocation indexAlloc=sm.createIndexAllocation();
  sm.bindVertexAllocation(vertexAlloc,0);
  sm.bindIndexAllocation(indexAlloc);
  vertexAlloc.data(mVtxData);
  vertexAlloc.uploadToBufferObject();
  indexAlloc.data(mIndexData);
  indexAlloc.uploadToBufferObject();
  return sm;
}

Fixed version (ground truth):
public SimpleMesh create(){
  Element.Builder b=new Element.Builder(mRS);
  int floatCount=mVtxSize;
  if (mVtxSize == 2) {
    b.addFloatXY();
  }
 else {
    b.addFloatXYZ();
  }
  if (mTex) {
    floatCount+=2;
    b.addFloatST();
  }
  if (mNorm) {
    floatCount+=3;
    b.addFloatNorm();
  }
  mElement=b.create();
  Builder smb=new Builder(mRS);
  smb.addVertexType(mElement,mVtxCount / floatCount);
  smb.setIndexType(Element.INDEX_16(mRS),mIndexCount);
  smb.setPrimitive(Primitive.TRIANGLE);
  SimpleMesh sm=smb.create();
  Allocation vertexAlloc=sm.createVertexAllocation(0);
  Allocation indexAlloc=sm.createIndexAllocation();
  sm.bindVertexAllocation(vertexAlloc,0);
  sm.bindIndexAllocation(indexAlloc);
  vertexAlloc.data(mVtxData);
  vertexAlloc.uploadToBufferObject();
  indexAlloc.data(mIndexData);
  indexAlloc.uploadToBufferObject();
  return sm;
}
Program: 23697
Project: 23697
Buggy source:
public void add(Dimension d,int value){
  if (mEntries.length >= mEntryCount) {
    Entry[] en=new Entry[mEntryCount + 8];
    System.arraycopy(mEntries,0,en,0,mEntries.length);
    mEntries=en;
  }
  mEntries[mEntryCount]=new Entry();
  mEntries[mEntryCount].mDim=d;
  mEntries[mEntryCount].mValue=value;
  mEntryCount++;
}

Fixed version (ground truth):
public void add(Dimension d,int value){
  if (value < 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (mEntries.length >= mEntryCount) {
    Entry[] en=new Entry[mEntryCount + 8];
    System.arraycopy(mEntries,0,en,0,mEntries.length);
    mEntries=en;
  }
  mEntries[mEntryCount]=new Entry();
  mEntries[mEntryCount].mDim=d;
  mEntries[mEntryCount].mValue=value;
  mEntryCount++;
}
Program: 23698
Project: 23698
Buggy source:
public Builder(RenderScript rs,Element e){
  mRS=rs;
  mEntries=new Entry[4];
  mElement=e;
}

Fixed version (ground truth):
public Builder(RenderScript rs,Element e){
  if (e.mID == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mRS=rs;
  mEntries=new Entry[4];
  mElement=e;
}
Program: 23700
Project: 23700
Buggy source:
private void initState(){
  mBufferState=new int[10];
  mAllocState=Allocation.createSized(mRS,Element.USER_FLOAT,mBufferState.length);
  mBufferState[STATE_LAST_FOCUS]=-1;
  mAllocState.data(mBufferState);
}

Fixed version (ground truth):
private void initState(){
  mBufferState=new int[10];
  mAllocState=Allocation.createSized(mRS,Element.USER_F32(mRS),mBufferState.length);
  mBufferState[STATE_LAST_FOCUS]=-1;
  mAllocState.data(mBufferState);
}
Program: 23701
Project: 23701
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: 23703
Project: 23703
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: 23704
Project: 23704
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: 23708
Project: 23708
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: 23711
Project: 23711
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: 23713
Project: 23713
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: 23714
Project: 23714
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: 23715
Project: 23715
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: 23716
Project: 23716
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: 23717
Project: 23717
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: 23719
Project: 23719
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: 23720
Project: 23720
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: 23722
Project: 23722
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: 23724
Project: 23724
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: 23725
Project: 23725
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: 23726
Project: 23726
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: 23731
Project: 23731
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: 23732
Project: 23732
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: 23734
Project: 23734
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: 23735
Project: 23735
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: 23736
Project: 23736
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: 23737
Project: 23737
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: 23738
Project: 23738
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;
}