nus-yam/ex-repair huggingface dataset:
Program: 182625
Project: 182625
Buggy source:
private void startContactQuery(Uri contactUri){
  mQueryHandler.startQuery(TOKEN_CONTACT_INFO,null,contactUri,ContactQuery.COLUMNS,null,null,null);
}

Fixed version (ground truth):
/** 
 * startContactQuery internal method to query contact by Uri.
 * @param contactUri the contact uri
 * @param resetQueryHandler whether to use a new AsyncQueryHandler or not
 */
private void startContactQuery(Uri contactUri,boolean resetQueryHandler){
  if (resetQueryHandler) {
    resetAsyncQueryHandler();
  }
  mQueryHandler.startQuery(TOKEN_CONTACT_INFO,null,contactUri,ContactQuery.COLUMNS,null,null,null);
}
Program: 182626
Project: 182626
Buggy source:
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param conatctUri a {Contacts.CONTENT_LOOKUP_URI} style URI.
 */
public void bindFromContactLookupUri(Uri contactLookupUri){
  mContactUri=contactLookupUri;
  startContactQuery(contactLookupUri);
}

Fixed version (ground truth):
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param contactLookupUri a {Contacts.CONTENT_LOOKUP_URI} style URI.
 */
public void bindFromContactLookupUri(Uri contactLookupUri){
  bindFromContactUriInternal(contactLookupUri,true);
}
Program: 182627
Project: 182627
Buggy source:
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param number The phone number used to do a reverse lookup inthe contacts database. If more than one contact contains this phone number, one of them will be chosen to bind to.
 */
public void bindFromPhoneNumber(String number){
  mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP,number,Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,Uri.encode(number)),PHONE_LOOKUP_PROJECTION,null,null,null);
}

Fixed version (ground truth):
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param number The phone number used to do a reverse lookup inthe contacts database. If more than one contact contains this phone number, one of them will be chosen to bind to.
 */
public void bindFromPhoneNumber(String number){
  resetAsyncQueryHandler();
  mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP,number,Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,Uri.encode(number)),PHONE_LOOKUP_PROJECTION,null,null,null);
}
Program: 182628
Project: 182628
Buggy source:
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param emailAddress The email address used to do a reverse lookup inthe contacts database. If more than one contact contains this email address, one of them will be chosen to bind to.
 */
public void bindFromEmail(String emailAddress){
  mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP,emailAddress,Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI,Uri.encode(emailAddress)),EMAIL_LOOKUP_PROJECTION,null,null,null);
}

Fixed version (ground truth):
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param emailAddress The email address used to do a reverse lookup inthe contacts database. If more than one contact contains this email address, one of them will be chosen to bind to.
 */
public void bindFromEmail(String emailAddress){
  resetAsyncQueryHandler();
  mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP,emailAddress,Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI,Uri.encode(emailAddress)),EMAIL_LOOKUP_PROJECTION,null,null,null);
}
Program: 182629
Project: 182629
Buggy source:
/** 
 * Method to force this widget to forget everything it knows about the contact. The widget isn't automatically updated or redrawn.
 */
public void wipeClean(){
  setDisplayName(null,null);
  setPhoto(null);
  setSocialSnippet(null);
  mContactUri=null;
  mExcludeMimes=null;
}

Fixed version (ground truth):
/** 
 * Method to force this widget to forget everything it knows about the contact. We need to stop any existing async queries for phone, email, contact, and photos.
 */
public void wipeClean(){
  resetAsyncQueryHandler();
  setDisplayName(null,null);
  setPhoto(loadPlaceholderPhoto(null));
  setSocialSnippet(null);
  setPresence(0);
  mContactUri=null;
  mExcludeMimes=null;
}
Program: 182630
Project: 182630
Buggy source:
public ContactHeaderWidget(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mContentResolver=mContext.getContentResolver();
  LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.contact_header,this);
  mDisplayNameView=(TextView)findViewById(R.id.name);
  mAggregateBadge=findViewById(R.id.aggregate_badge);
  mAggregateBadge.setVisibility(View.GONE);
  mPhoneticNameView=(TextView)findViewById(R.id.phonetic_name);
  mStarredView=(CheckBox)findViewById(R.id.star);
  mStarredView.setOnClickListener(this);
  mPhotoView=(QuickContactBadge)findViewById(R.id.photo);
  mPresenceView=(ImageView)findViewById(R.id.presence);
  mStatusView=(TextView)findViewById(R.id.status);
  mStatusAttributionView=(TextView)findViewById(R.id.status_date);
  long now=SystemClock.elapsedRealtime();
  int num=(int)now & 0xf;
  if (num < 9) {
    mNoPhotoResource=R.drawable.ic_contact_picture;
  }
 else   if (num < 14) {
    mNoPhotoResource=R.drawable.ic_contact_picture_2;
  }
 else {
    mNoPhotoResource=R.drawable.ic_contact_picture_3;
  }
  mQueryHandler=new QueryHandler(mContentResolver);
}

Fixed version (ground truth):
public ContactHeaderWidget(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mContentResolver=mContext.getContentResolver();
  LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.contact_header,this);
  mDisplayNameView=(TextView)findViewById(R.id.name);
  mAggregateBadge=findViewById(R.id.aggregate_badge);
  mAggregateBadge.setVisibility(View.GONE);
  mPhoneticNameView=(TextView)findViewById(R.id.phonetic_name);
  mStarredView=(CheckBox)findViewById(R.id.star);
  mStarredView.setOnClickListener(this);
  mPhotoView=(QuickContactBadge)findViewById(R.id.photo);
  mPresenceView=(ImageView)findViewById(R.id.presence);
  mStatusView=(TextView)findViewById(R.id.status);
  mStatusAttributionView=(TextView)findViewById(R.id.status_date);
  long now=SystemClock.elapsedRealtime();
  int num=(int)now & 0xf;
  if (num < 9) {
    mNoPhotoResource=R.drawable.ic_contact_picture;
  }
 else   if (num < 14) {
    mNoPhotoResource=R.drawable.ic_contact_picture_2;
  }
 else {
    mNoPhotoResource=R.drawable.ic_contact_picture_3;
  }
  resetAsyncQueryHandler();
}
Program: 182632
Project: 182632
Buggy source:
public void uploadToBufferObject(){
  mRS.validate();
  mRS.validateSurface();
  mRS.nAllocationUploadToBufferObject(mID);
}

Fixed version (ground truth):
public void uploadToBufferObject(){
  mRS.validate();
  mRS.nAllocationUploadToBufferObject(mID);
}
Program: 182633
Project: 182633
Buggy source:
public void uploadToTexture(int baseMipLevel){
  mRS.validate();
  mRS.validateSurface();
  mRS.nAllocationUploadToTexture(mID,baseMipLevel);
}

Fixed version (ground truth):
public void uploadToTexture(int baseMipLevel){
  mRS.validate();
  mRS.nAllocationUploadToTexture(mID,baseMipLevel);
}
Program: 182634
Project: 182634
Buggy source:
public void contextBindProgramFragmentStore(ProgramStore p){
  nContextBindProgramFragmentStore(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramFragmentStore(ProgramStore p){
  validate();
  nContextBindProgramFragmentStore(safeID(p));
}
Program: 182635
Project: 182635
Buggy source:
public void contextSetSurface(int w,int h,Surface sur){
  mSurface=sur;
  mWidth=w;
  mHeight=h;
  nContextSetSurface(w,h,mSurface);
}

Fixed version (ground truth):
public void contextSetSurface(int w,int h,Surface sur){
  mSurface=sur;
  mWidth=w;
  mHeight=h;
  validate();
  nContextSetSurface(w,h,mSurface);
}
Program: 182636
Project: 182636
Buggy source:
public void destroy(){
  nContextDeinitToClient();
  mMessageThread.mRun=false;
  nContextDestroy(mContext);
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}

Fixed version (ground truth):
public void destroy(){
  validate();
  nContextDeinitToClient();
  mMessageThread.mRun=false;
  nContextDestroy(mContext);
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}
Program: 182637
Project: 182637
Buggy source:
public void contextBindProgramVertex(ProgramVertex p){
  nContextBindProgramVertex(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramVertex(ProgramVertex p){
  validate();
  nContextBindProgramVertex(safeID(p));
}
Program: 182638
Project: 182638
Buggy source:
public void contextBindProgramFragment(ProgramFragment p){
  nContextBindProgramFragment(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramFragment(ProgramFragment p){
  validate();
  nContextBindProgramFragment(safeID(p));
}
Program: 182639
Project: 182639
Buggy source:
void resume(){
  nContextResume();
}

Fixed version (ground truth):
void resume(){
  validate();
  nContextResume();
}
Program: 182640
Project: 182640
Buggy source:
public void contextBindRootScript(Script s){
  nContextBindRootScript(safeID(s));
}

Fixed version (ground truth):
public void contextBindRootScript(Script s){
  validate();
  nContextBindRootScript(safeID(s));
}
Program: 182641
Project: 182641
Buggy source:
public void contextDump(int bits){
  nContextDump(bits);
}

Fixed version (ground truth):
public void contextDump(int bits){
  validate();
  nContextDump(bits);
}
Program: 182642
Project: 182642
Buggy source:
void pause(){
  nContextPause();
}

Fixed version (ground truth):
void pause(){
  validate();
  nContextPause();
}
Program: 182643
Project: 182643
Buggy source:
public void contextBindProgramRaster(ProgramRaster p){
  nContextBindProgramRaster(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramRaster(ProgramRaster p){
  validate();
  nContextBindProgramRaster(safeID(p));
}
Program: 182644
Project: 182644
Buggy source:
public void contextSetPriority(Priority p){
  nContextSetPriority(p.mID);
}

Fixed version (ground truth):
public void contextSetPriority(Priority p){
  validate();
  nContextSetPriority(p.mID);
}
Program: 182645
Project: 182645
Buggy source:
public void uploadToBufferObject(){
  mRS.validate();
  mRS.validateSurface();
  mRS.nAllocationUploadToBufferObject(mID);
}

Fixed version (ground truth):
public void uploadToBufferObject(){
  mRS.validate();
  mRS.nAllocationUploadToBufferObject(mID);
}
Program: 182646
Project: 182646
Buggy source:
public void uploadToTexture(int baseMipLevel){
  mRS.validate();
  mRS.validateSurface();
  mRS.nAllocationUploadToTexture(mID,baseMipLevel);
}

Fixed version (ground truth):
public void uploadToTexture(int baseMipLevel){
  mRS.validate();
  mRS.nAllocationUploadToTexture(mID,baseMipLevel);
}
Program: 182647
Project: 182647
Buggy source:
public void contextBindProgramFragmentStore(ProgramStore p){
  nContextBindProgramFragmentStore(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramFragmentStore(ProgramStore p){
  validate();
  nContextBindProgramFragmentStore(safeID(p));
}
Program: 182648
Project: 182648
Buggy source:
public void contextSetSurface(int w,int h,Surface sur){
  mSurface=sur;
  mWidth=w;
  mHeight=h;
  nContextSetSurface(w,h,mSurface);
}

Fixed version (ground truth):
public void contextSetSurface(int w,int h,Surface sur){
  mSurface=sur;
  mWidth=w;
  mHeight=h;
  validate();
  nContextSetSurface(w,h,mSurface);
}
Program: 182649
Project: 182649
Buggy source:
public void destroy(){
  nContextDeinitToClient();
  mMessageThread.mRun=false;
  nContextDestroy(mContext);
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}

Fixed version (ground truth):
public void destroy(){
  validate();
  nContextDeinitToClient();
  mMessageThread.mRun=false;
  nContextDestroy(mContext);
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}
Program: 182650
Project: 182650
Buggy source:
public void contextBindProgramVertex(ProgramVertex p){
  nContextBindProgramVertex(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramVertex(ProgramVertex p){
  validate();
  nContextBindProgramVertex(safeID(p));
}
Program: 182651
Project: 182651
Buggy source:
public void contextBindProgramFragment(ProgramFragment p){
  nContextBindProgramFragment(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramFragment(ProgramFragment p){
  validate();
  nContextBindProgramFragment(safeID(p));
}
Program: 182652
Project: 182652
Buggy source:
void resume(){
  nContextResume();
}

Fixed version (ground truth):
void resume(){
  validate();
  nContextResume();
}
Program: 182653
Project: 182653
Buggy source:
public void contextBindRootScript(Script s){
  nContextBindRootScript(safeID(s));
}

Fixed version (ground truth):
public void contextBindRootScript(Script s){
  validate();
  nContextBindRootScript(safeID(s));
}
Program: 182654
Project: 182654
Buggy source:
public void contextDump(int bits){
  nContextDump(bits);
}

Fixed version (ground truth):
public void contextDump(int bits){
  validate();
  nContextDump(bits);
}
Program: 182655
Project: 182655
Buggy source:
void pause(){
  nContextPause();
}

Fixed version (ground truth):
void pause(){
  validate();
  nContextPause();
}
Program: 182656
Project: 182656
Buggy source:
public void contextBindProgramRaster(ProgramRaster p){
  nContextBindProgramRaster(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramRaster(ProgramRaster p){
  validate();
  nContextBindProgramRaster(safeID(p));
}
Program: 182657
Project: 182657
Buggy source:
public void contextSetPriority(Priority p){
  nContextSetPriority(p.mID);
}

Fixed version (ground truth):
public void contextSetPriority(Priority p){
  validate();
  nContextSetPriority(p.mID);
}
Program: 182663
Project: 182663
Buggy source:
private native void nativeUpdateLayers(int layer,int updates);

Fixed version (ground truth):
private native void nativeUpdateLayers(int updates);
Program: 182664
Project: 182664
Buggy source:
/** 
 * Sets the audio mode. <p> The audio mode encompasses audio routing AND the behavior of the telephony layer. Therefore this method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application. In particular, the   {@link #MODE_IN_CALL} mode should only be used by the telephonyapplication when it places a phone call, as it will cause signals from the radio layer to feed the platform mixer.
 * @param mode  the requested audio mode (NORMAL, RINGTONE, or IN_CALL).Informs the HAL about the current audio state so that it can route the audio appropriately.
 */
public void setMode(int mode){
  IAudioService service=getService();
  try {
    service.setMode(mode);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Sets the audio mode. <p> The audio mode encompasses audio routing AND the behavior of the telephony layer. Therefore this method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application. In particular, the   {@link #MODE_IN_CALL} mode should only be used by the telephonyapplication when it places a phone call, as it will cause signals from the radio layer to feed the platform mixer.
 * @param mode  the requested audio mode (NORMAL, RINGTONE, or IN_CALL).Informs the HAL about the current audio state so that it can route the audio appropriately.
 */
public void setMode(int mode){
  IAudioService service=getService();
  try {
    service.setMode(mode,mICallBack);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 182665
Project: 182665
Buggy source:
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]=SystemProperties.getInt("String_Node_Str",MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  mMode=AudioSystem.MODE_NORMAL;
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMediaServerOk=true;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  context.registerReceiver(mReceiver,intentFilter);
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]=SystemProperties.getInt("String_Node_Str",MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMode=AudioSystem.MODE_INVALID;
  setMode(AudioSystem.MODE_NORMAL,null);
  mMediaServerOk=true;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  context.registerReceiver(mReceiver,intentFilter);
}
Program: 182666
Project: 182666
Buggy source:
/** 
 * @see AudioManager#setMode(int) 
 */
public void setMode(int mode){
  if (!checkAudioSettingsPermission("String_Node_Str")) {
    return;
  }
  if (mode < AudioSystem.MODE_CURRENT || mode > AudioSystem.MODE_IN_CALL) {
    return;
  }
synchronized (mSettingsLock) {
    if (mode == AudioSystem.MODE_CURRENT) {
      mode=mMode;
    }
    if (mode != mMode) {
      if (AudioSystem.setPhoneState(mode) == AudioSystem.AUDIO_STATUS_OK) {
        mMode=mode;
      }
    }
    int streamType=getActiveStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
    int index=mStreamStates[STREAM_VOLUME_ALIAS[streamType]].mIndex;
    setStreamVolumeInt(STREAM_VOLUME_ALIAS[streamType],index,true,true);
  }
}

Fixed version (ground truth):
/** 
 * @see AudioManager#setMode(int) 
 */
public void setMode(int mode,IBinder cb){
  if (!checkAudioSettingsPermission("String_Node_Str")) {
    return;
  }
  if (mode < AudioSystem.MODE_CURRENT || mode > AudioSystem.MODE_IN_CALL) {
    return;
  }
synchronized (mSettingsLock) {
    if (mode == AudioSystem.MODE_CURRENT) {
      mode=mMode;
    }
    if (mode != mMode) {
      if (AudioSystem.setPhoneState(mode) == AudioSystem.AUDIO_STATUS_OK) {
        mMode=mode;
synchronized (mSetModeDeathHandlers) {
          SetModeDeathHandler hdlr=null;
          Iterator iter=mSetModeDeathHandlers.iterator();
          while (iter.hasNext()) {
            SetModeDeathHandler h=(SetModeDeathHandler)iter.next();
            if (h.getBinder() == cb) {
              hdlr=h;
              iter.remove();
              break;
            }
          }
          if (hdlr == null) {
            hdlr=new SetModeDeathHandler(cb);
            if (cb != null) {
              try {
                cb.linkToDeath(hdlr,0);
              }
 catch (              RemoteException e) {
                Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
              }
            }
          }
          mSetModeDeathHandlers.add(0,hdlr);
          hdlr.setMode(mode);
        }
      }
    }
    int streamType=getActiveStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
    int index=mStreamStates[STREAM_VOLUME_ALIAS[streamType]].mIndex;
    setStreamVolumeInt(STREAM_VOLUME_ALIAS[streamType],index,true,true);
  }
}
Program: 182667
Project: 182667
Buggy source:
/** 
 * Sets the audio mode. <p> The audio mode encompasses audio routing AND the behavior of the telephony layer. Therefore this method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application. In particular, the   {@link #MODE_IN_CALL} mode should only be used by the telephonyapplication when it places a phone call, as it will cause signals from the radio layer to feed the platform mixer.
 * @param mode  the requested audio mode (NORMAL, RINGTONE, or IN_CALL).Informs the HAL about the current audio state so that it can route the audio appropriately.
 */
public void setMode(int mode){
  IAudioService service=getService();
  try {
    service.setMode(mode);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Sets the audio mode. <p> The audio mode encompasses audio routing AND the behavior of the telephony layer. Therefore this method should only be used by applications that replace the platform-wide management of audio settings or the main telephony application. In particular, the   {@link #MODE_IN_CALL} mode should only be used by the telephonyapplication when it places a phone call, as it will cause signals from the radio layer to feed the platform mixer.
 * @param mode  the requested audio mode (NORMAL, RINGTONE, or IN_CALL).Informs the HAL about the current audio state so that it can route the audio appropriately.
 */
public void setMode(int mode){
  IAudioService service=getService();
  try {
    service.setMode(mode,mICallBack);
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 182668
Project: 182668
Buggy source:
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]=SystemProperties.getInt("String_Node_Str",MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  mMode=AudioSystem.MODE_NORMAL;
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMediaServerOk=true;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  context.registerReceiver(mReceiver,intentFilter);
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public AudioService(Context context){
  mContext=context;
  mContentResolver=context.getContentResolver();
  MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]=SystemProperties.getInt("String_Node_Str",MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
  mVolumePanel=new VolumePanel(context,this);
  mSettingsObserver=new SettingsObserver();
  mForcedUseForComm=AudioSystem.FORCE_NONE;
  createAudioSystemThread();
  readPersistedSettings();
  createStreamStates();
  mMode=AudioSystem.MODE_INVALID;
  setMode(AudioSystem.MODE_NORMAL,null);
  mMediaServerOk=true;
  AudioSystem.setErrorCallback(mAudioSystemCallback);
  loadSoundEffects();
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_HEADSET_PLUG);
  intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  intentFilter.addAction(BluetoothHeadset.ACTION_STATE_CHANGED);
  context.registerReceiver(mReceiver,intentFilter);
}
Program: 182669
Project: 182669
Buggy source:
/** 
 * @see AudioManager#setMode(int) 
 */
public void setMode(int mode){
  if (!checkAudioSettingsPermission("String_Node_Str")) {
    return;
  }
  if (mode < AudioSystem.MODE_CURRENT || mode > AudioSystem.MODE_IN_CALL) {
    return;
  }
synchronized (mSettingsLock) {
    if (mode == AudioSystem.MODE_CURRENT) {
      mode=mMode;
    }
    if (mode != mMode) {
      if (AudioSystem.setPhoneState(mode) == AudioSystem.AUDIO_STATUS_OK) {
        mMode=mode;
      }
    }
    int streamType=getActiveStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
    int index=mStreamStates[STREAM_VOLUME_ALIAS[streamType]].mIndex;
    setStreamVolumeInt(STREAM_VOLUME_ALIAS[streamType],index,true,true);
  }
}

Fixed version (ground truth):
/** 
 * @see AudioManager#setMode(int) 
 */
public void setMode(int mode,IBinder cb){
  if (!checkAudioSettingsPermission("String_Node_Str")) {
    return;
  }
  if (mode < AudioSystem.MODE_CURRENT || mode > AudioSystem.MODE_IN_CALL) {
    return;
  }
synchronized (mSettingsLock) {
    if (mode == AudioSystem.MODE_CURRENT) {
      mode=mMode;
    }
    if (mode != mMode) {
      if (AudioSystem.setPhoneState(mode) == AudioSystem.AUDIO_STATUS_OK) {
        mMode=mode;
synchronized (mSetModeDeathHandlers) {
          SetModeDeathHandler hdlr=null;
          Iterator iter=mSetModeDeathHandlers.iterator();
          while (iter.hasNext()) {
            SetModeDeathHandler h=(SetModeDeathHandler)iter.next();
            if (h.getBinder() == cb) {
              hdlr=h;
              iter.remove();
              break;
            }
          }
          if (hdlr == null) {
            hdlr=new SetModeDeathHandler(cb);
            if (cb != null) {
              try {
                cb.linkToDeath(hdlr,0);
              }
 catch (              RemoteException e) {
                Log.w(TAG,"String_Node_Str" + cb + "String_Node_Str");
              }
            }
          }
          mSetModeDeathHandlers.add(0,hdlr);
          hdlr.setMode(mode);
        }
      }
    }
    int streamType=getActiveStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
    int index=mStreamStates[STREAM_VOLUME_ALIAS[streamType]].mIndex;
    setStreamVolumeInt(STREAM_VOLUME_ALIAS[streamType],index,true,true);
  }
}
Program: 182671
Project: 182671
Buggy source:
ArrayList<String> getListOfIncompleteInstallPackages(){
  HashSet<String> kList=new HashSet<String>(mPackages.keySet());
  Iterator<String> its=kList.iterator();
  ArrayList<String> ret=new ArrayList<String>();
  while (its.hasNext()) {
    String key=its.next();
    PackageSetting ps=mPackages.get(key);
    if (ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
      ret.add(key);
    }
  }
  return ret;
}

Fixed version (ground truth):
ArrayList<PackageSetting> getListOfIncompleteInstallPackages(){
  HashSet<String> kList=new HashSet<String>(mPackages.keySet());
  Iterator<String> its=kList.iterator();
  ArrayList<PackageSetting> ret=new ArrayList<PackageSetting>();
  while (its.hasNext()) {
    String key=its.next();
    PackageSetting ps=mPackages.get(key);
    if (ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
      ret.add(ps);
    }
  }
  return ret;
}
Program: 182672
Project: 182672
Buggy source:
void cleanupInstallFailedPackage(String packageName){
  if (mInstaller != null) {
    int retCode=mInstaller.remove(packageName);
    if (retCode < 0) {
      Log.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ retCode);
    }
  }
 else {
    PackageParser.Package pkg=mPackages.get(packageName);
    File dataDir=new File(pkg.applicationInfo.dataDir);
    dataDir.delete();
  }
  mSettings.removePackageLP(packageName);
}

Fixed version (ground truth):
void cleanupInstallFailedPackage(PackageSetting ps){
  Log.i(TAG,"String_Node_Str" + ps.name);
  if (mInstaller != null) {
    int retCode=mInstaller.remove(ps.name);
    if (retCode < 0) {
      Log.w(TAG,"String_Node_Str" + ps.name + "String_Node_Str"+ retCode);
    }
  }
 else {
    PackageParser.Package pkg=mPackages.get(ps.name);
    File dataDir=new File(pkg.applicationInfo.dataDir);
    dataDir.delete();
  }
  if (ps.codePath != null) {
    if (!ps.codePath.delete()) {
      Log.w(TAG,"String_Node_Str" + ps.codePath);
    }
  }
  if (ps.resourcePath != null) {
    if (!ps.resourcePath.delete() && !ps.resourcePath.equals(ps.codePath)) {
      Log.w(TAG,"String_Node_Str" + ps.resourcePath);
    }
  }
  mSettings.removePackageLP(ps.name);
}
Program: 182674
Project: 182674
Buggy source:
ArrayList<String> getListOfIncompleteInstallPackages(){
  HashSet<String> kList=new HashSet<String>(mPackages.keySet());
  Iterator<String> its=kList.iterator();
  ArrayList<String> ret=new ArrayList<String>();
  while (its.hasNext()) {
    String key=its.next();
    PackageSetting ps=mPackages.get(key);
    if (ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
      ret.add(key);
    }
  }
  return ret;
}

Fixed version (ground truth):
ArrayList<PackageSetting> getListOfIncompleteInstallPackages(){
  HashSet<String> kList=new HashSet<String>(mPackages.keySet());
  Iterator<String> its=kList.iterator();
  ArrayList<PackageSetting> ret=new ArrayList<PackageSetting>();
  while (its.hasNext()) {
    String key=its.next();
    PackageSetting ps=mPackages.get(key);
    if (ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
      ret.add(ps);
    }
  }
  return ret;
}
Program: 182675
Project: 182675
Buggy source:
void cleanupInstallFailedPackage(String packageName){
  if (mInstaller != null) {
    int retCode=mInstaller.remove(packageName);
    if (retCode < 0) {
      Log.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ retCode);
    }
  }
 else {
    PackageParser.Package pkg=mPackages.get(packageName);
    File dataDir=new File(pkg.applicationInfo.dataDir);
    dataDir.delete();
  }
  mSettings.removePackageLP(packageName);
}

Fixed version (ground truth):
void cleanupInstallFailedPackage(PackageSetting ps){
  Log.i(TAG,"String_Node_Str" + ps.name);
  if (mInstaller != null) {
    int retCode=mInstaller.remove(ps.name);
    if (retCode < 0) {
      Log.w(TAG,"String_Node_Str" + ps.name + "String_Node_Str"+ retCode);
    }
  }
 else {
    PackageParser.Package pkg=mPackages.get(ps.name);
    File dataDir=new File(pkg.applicationInfo.dataDir);
    dataDir.delete();
  }
  if (ps.codePath != null) {
    if (!ps.codePath.delete()) {
      Log.w(TAG,"String_Node_Str" + ps.codePath);
    }
  }
  if (ps.resourcePath != null) {
    if (!ps.resourcePath.delete() && !ps.resourcePath.equals(ps.codePath)) {
      Log.w(TAG,"String_Node_Str" + ps.resourcePath);
    }
  }
  mSettings.removePackageLP(ps.name);
}
Program: 182677
Project: 182677
Buggy source:
ArrayList<String> getListOfIncompleteInstallPackages(){
  HashSet<String> kList=new HashSet<String>(mPackages.keySet());
  Iterator<String> its=kList.iterator();
  ArrayList<String> ret=new ArrayList<String>();
  while (its.hasNext()) {
    String key=its.next();
    PackageSetting ps=mPackages.get(key);
    if (ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
      ret.add(key);
    }
  }
  return ret;
}

Fixed version (ground truth):
ArrayList<PackageSetting> getListOfIncompleteInstallPackages(){
  HashSet<String> kList=new HashSet<String>(mPackages.keySet());
  Iterator<String> its=kList.iterator();
  ArrayList<PackageSetting> ret=new ArrayList<PackageSetting>();
  while (its.hasNext()) {
    String key=its.next();
    PackageSetting ps=mPackages.get(key);
    if (ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
      ret.add(ps);
    }
  }
  return ret;
}
Program: 182678
Project: 182678
Buggy source:
void cleanupInstallFailedPackage(String packageName){
  if (mInstaller != null) {
    int retCode=mInstaller.remove(packageName);
    if (retCode < 0) {
      Log.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ retCode);
    }
  }
 else {
    PackageParser.Package pkg=mPackages.get(packageName);
    File dataDir=new File(pkg.applicationInfo.dataDir);
    dataDir.delete();
  }
  mSettings.removePackageLP(packageName);
}

Fixed version (ground truth):
void cleanupInstallFailedPackage(PackageSetting ps){
  Log.i(TAG,"String_Node_Str" + ps.name);
  if (mInstaller != null) {
    int retCode=mInstaller.remove(ps.name);
    if (retCode < 0) {
      Log.w(TAG,"String_Node_Str" + ps.name + "String_Node_Str"+ retCode);
    }
  }
 else {
    PackageParser.Package pkg=mPackages.get(ps.name);
    File dataDir=new File(pkg.applicationInfo.dataDir);
    dataDir.delete();
  }
  if (ps.codePath != null) {
    if (!ps.codePath.delete()) {
      Log.w(TAG,"String_Node_Str" + ps.codePath);
    }
  }
  if (ps.resourcePath != null) {
    if (!ps.resourcePath.delete() && !ps.resourcePath.equals(ps.codePath)) {
      Log.w(TAG,"String_Node_Str" + ps.resourcePath);
    }
  }
  mSettings.removePackageLP(ps.name);
}
Program: 182679
Project: 182679
Buggy source:
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    mWakeLock.acquire();
    mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),1000);
  }
 else {
    sendIntents(mHeadsetState,mPrevHeadsetState,mHeadsetName);
  }
}

Fixed version (ground truth):
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  int delay=0;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    delay=1000;
  }
 else {
    if (mHandler.hasMessages(0)) {
      delay=1000;
    }
  }
  mWakeLock.acquire();
  mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),delay);
}
Program: 182680
Project: 182680
Buggy source:
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    mWakeLock.acquire();
    mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),1000);
  }
 else {
    sendIntents(mHeadsetState,mPrevHeadsetState,mHeadsetName);
  }
}

Fixed version (ground truth):
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  int delay=0;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    delay=1000;
  }
 else {
    if (mHandler.hasMessages(0)) {
      delay=1000;
    }
  }
  mWakeLock.acquire();
  mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),delay);
}
Program: 182682
Project: 182682
Buggy source:
public void postNotification(){
  if (foregroundId != 0 && foregroundNoti != null) {
    INotificationManager inm=NotificationManager.getService();
    if (inm != null) {
      try {
        int[] outId=new int[1];
        inm.enqueueNotification(packageName,foregroundId,foregroundNoti,outId);
      }
 catch (      RemoteException e) {
      }
    }
  }
}

Fixed version (ground truth):
public void postNotification(){
  if (foregroundId != 0 && foregroundNoti != null) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    final Notification localForegroundNoti=foregroundNoti;
    ams.mHandler.post(new Runnable(){
      public void run(){
        INotificationManager inm=NotificationManager.getService();
        if (inm == null) {
          return;
        }
        try {
          int[] outId=new int[1];
          inm.enqueueNotification(localPackageName,localForegroundId,localForegroundNoti,outId);
        }
 catch (        RemoteException e) {
        }
      }
    }
);
  }
}
Program: 182683
Project: 182683
Buggy source:
public void cancelNotification(){
  if (foregroundId != 0) {
    INotificationManager inm=NotificationManager.getService();
    if (inm != null) {
      try {
        inm.cancelNotification(packageName,foregroundId);
      }
 catch (      RemoteException e) {
      }
    }
  }
}

Fixed version (ground truth):
public void cancelNotification(){
  if (foregroundId != 0) {
    final String localPackageName=packageName;
    final int localForegroundId=foregroundId;
    ams.mHandler.post(new Runnable(){
      public void run(){
        INotificationManager inm=NotificationManager.getService();
        if (inm == null) {
          return;
        }
        try {
          inm.cancelNotification(localPackageName,localForegroundId);
        }
 catch (        RemoteException e) {
        }
      }
    }
);
  }
}
Program: 182684
Project: 182684
Buggy source:
ServiceRecord(BatteryStatsImpl.Uid.Pkg.Serv servStats,ComponentName name,Intent.FilterComparison intent,ServiceInfo sInfo,Runnable restarter){
  this.stats=servStats;
  this.name=name;
  shortName=name.flattenToShortString();
  this.intent=intent;
  serviceInfo=sInfo;
  appInfo=sInfo.applicationInfo;
  packageName=sInfo.applicationInfo.packageName;
  processName=sInfo.processName;
  permission=sInfo.permission;
  baseDir=sInfo.applicationInfo.sourceDir;
  resDir=sInfo.applicationInfo.publicSourceDir;
  dataDir=sInfo.applicationInfo.dataDir;
  exported=sInfo.exported;
  this.restarter=restarter;
  createTime=lastActivity=SystemClock.uptimeMillis();
}

Fixed version (ground truth):
ServiceRecord(ActivityManagerService ams,BatteryStatsImpl.Uid.Pkg.Serv servStats,ComponentName name,Intent.FilterComparison intent,ServiceInfo sInfo,Runnable restarter){
  this.ams=ams;
  this.stats=servStats;
  this.name=name;
  shortName=name.flattenToShortString();
  this.intent=intent;
  serviceInfo=sInfo;
  appInfo=sInfo.applicationInfo;
  packageName=sInfo.applicationInfo.packageName;
  processName=sInfo.processName;
  permission=sInfo.permission;
  baseDir=sInfo.applicationInfo.sourceDir;
  resDir=sInfo.applicationInfo.publicSourceDir;
  dataDir=sInfo.applicationInfo.dataDir;
  exported=sInfo.exported;
  this.restarter=restarter;
  createTime=lastActivity=SystemClock.uptimeMillis();
}
Program: 182685
Project: 182685
Buggy source:
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    mWakeLock.acquire();
    mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),1000);
  }
 else {
    sendIntents(mHeadsetState,mPrevHeadsetState,mHeadsetName);
  }
}

Fixed version (ground truth):
private synchronized final void update(String newName,int newState){
  int headsetState=newState & SUPPORTED_HEADSETS;
  int newOrOld=headsetState | mHeadsetState;
  int delay=0;
  if (mHeadsetState == headsetState || ((newOrOld & (newOrOld - 1)) != 0)) {
    return;
  }
  mHeadsetName=newName;
  mPrevHeadsetState=mHeadsetState;
  mHeadsetState=headsetState;
  if (headsetState == 0) {
    Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    mContext.sendBroadcast(intent);
    delay=1000;
  }
 else {
    if (mHandler.hasMessages(0)) {
      delay=1000;
    }
  }
  mWakeLock.acquire();
  mHandler.sendMessageDelayed(mHandler.obtainMessage(0,mHeadsetState,mPrevHeadsetState,mHeadsetName),delay);
}
Program: 182686
Project: 182686
Buggy source:
protected void startPhotoQuery(long photoId,Uri lookupKey){
  mQueryHandler.startQuery(TOKEN_PHOTO_QUERY,lookupKey,ContentUris.withAppendedId(Data.CONTENT_URI,photoId),PhotoQuery.COLUMNS,null,null,null);
}

Fixed version (ground truth):
/** 
 * startPhotoQuery internal method to query contact photo by photo id and uri.
 * @param photoId the photo id.
 * @param lookupKey the lookup uri.
 * @param resetQueryHandler whether to use a new AsyncQueryHandler or not.
 */
protected void startPhotoQuery(long photoId,Uri lookupKey,boolean resetQueryHandler){
  if (resetQueryHandler) {
    resetAsyncQueryHandler();
  }
  mQueryHandler.startQuery(TOKEN_PHOTO_QUERY,lookupKey,ContentUris.withAppendedId(Data.CONTENT_URI,photoId),PhotoQuery.COLUMNS,null,null,null);
}
Program: 182687
Project: 182687
Buggy source:
private void startContactQuery(Uri contactUri){
  mQueryHandler.startQuery(TOKEN_CONTACT_INFO,null,contactUri,ContactQuery.COLUMNS,null,null,null);
}

Fixed version (ground truth):
/** 
 * startContactQuery internal method to query contact by Uri.
 * @param contactUri the contact uri
 * @param resetQueryHandler whether to use a new AsyncQueryHandler or not
 */
private void startContactQuery(Uri contactUri,boolean resetQueryHandler){
  if (resetQueryHandler) {
    resetAsyncQueryHandler();
  }
  mQueryHandler.startQuery(TOKEN_CONTACT_INFO,null,contactUri,ContactQuery.COLUMNS,null,null,null);
}
Program: 182688
Project: 182688
Buggy source:
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param conatctUri a {Contacts.CONTENT_LOOKUP_URI} style URI.
 */
public void bindFromContactLookupUri(Uri contactLookupUri){
  mContactUri=contactLookupUri;
  startContactQuery(contactLookupUri);
}

Fixed version (ground truth):
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param contactLookupUri a {Contacts.CONTENT_LOOKUP_URI} style URI.
 */
public void bindFromContactLookupUri(Uri contactLookupUri){
  bindFromContactUriInternal(contactLookupUri,true);
}
Program: 182689
Project: 182689
Buggy source:
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param number The phone number used to do a reverse lookup inthe contacts database. If more than one contact contains this phone number, one of them will be chosen to bind to.
 */
public void bindFromPhoneNumber(String number){
  mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP,number,Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,Uri.encode(number)),PHONE_LOOKUP_PROJECTION,null,null,null);
}

Fixed version (ground truth):
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param number The phone number used to do a reverse lookup inthe contacts database. If more than one contact contains this phone number, one of them will be chosen to bind to.
 */
public void bindFromPhoneNumber(String number){
  resetAsyncQueryHandler();
  mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP,number,Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,Uri.encode(number)),PHONE_LOOKUP_PROJECTION,null,null,null);
}
Program: 182690
Project: 182690
Buggy source:
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param emailAddress The email address used to do a reverse lookup inthe contacts database. If more than one contact contains this email address, one of them will be chosen to bind to.
 */
public void bindFromEmail(String emailAddress){
  mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP,emailAddress,Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI,Uri.encode(emailAddress)),EMAIL_LOOKUP_PROJECTION,null,null,null);
}

Fixed version (ground truth):
/** 
 * Convenience method for binding all available data from an existing contact.
 * @param emailAddress The email address used to do a reverse lookup inthe contacts database. If more than one contact contains this email address, one of them will be chosen to bind to.
 */
public void bindFromEmail(String emailAddress){
  resetAsyncQueryHandler();
  mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP,emailAddress,Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI,Uri.encode(emailAddress)),EMAIL_LOOKUP_PROJECTION,null,null,null);
}
Program: 182691
Project: 182691
Buggy source:
/** 
 * Method to force this widget to forget everything it knows about the contact. The widget isn't automatically updated or redrawn.
 */
public void wipeClean(){
  setDisplayName(null,null);
  setPhoto(null);
  setSocialSnippet(null);
  mContactUri=null;
  mExcludeMimes=null;
}

Fixed version (ground truth):
/** 
 * Method to force this widget to forget everything it knows about the contact. We need to stop any existing async queries for phone, email, contact, and photos.
 */
public void wipeClean(){
  resetAsyncQueryHandler();
  setDisplayName(null,null);
  setPhoto(loadPlaceholderPhoto(null));
  setSocialSnippet(null);
  setPresence(0);
  mContactUri=null;
  mExcludeMimes=null;
}
Program: 182692
Project: 182692
Buggy source:
public ContactHeaderWidget(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mContentResolver=mContext.getContentResolver();
  LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.contact_header,this);
  mDisplayNameView=(TextView)findViewById(R.id.name);
  mAggregateBadge=findViewById(R.id.aggregate_badge);
  mAggregateBadge.setVisibility(View.GONE);
  mPhoneticNameView=(TextView)findViewById(R.id.phonetic_name);
  mStarredView=(CheckBox)findViewById(R.id.star);
  mStarredView.setOnClickListener(this);
  mPhotoView=(QuickContactBadge)findViewById(R.id.photo);
  mPresenceView=(ImageView)findViewById(R.id.presence);
  mStatusView=(TextView)findViewById(R.id.status);
  mStatusAttributionView=(TextView)findViewById(R.id.status_date);
  long now=SystemClock.elapsedRealtime();
  int num=(int)now & 0xf;
  if (num < 9) {
    mNoPhotoResource=R.drawable.ic_contact_picture;
  }
 else   if (num < 14) {
    mNoPhotoResource=R.drawable.ic_contact_picture_2;
  }
 else {
    mNoPhotoResource=R.drawable.ic_contact_picture_3;
  }
  mQueryHandler=new QueryHandler(mContentResolver);
}

Fixed version (ground truth):
public ContactHeaderWidget(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mContentResolver=mContext.getContentResolver();
  LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflater.inflate(R.layout.contact_header,this);
  mDisplayNameView=(TextView)findViewById(R.id.name);
  mAggregateBadge=findViewById(R.id.aggregate_badge);
  mAggregateBadge.setVisibility(View.GONE);
  mPhoneticNameView=(TextView)findViewById(R.id.phonetic_name);
  mStarredView=(CheckBox)findViewById(R.id.star);
  mStarredView.setOnClickListener(this);
  mPhotoView=(QuickContactBadge)findViewById(R.id.photo);
  mPresenceView=(ImageView)findViewById(R.id.presence);
  mStatusView=(TextView)findViewById(R.id.status);
  mStatusAttributionView=(TextView)findViewById(R.id.status_date);
  long now=SystemClock.elapsedRealtime();
  int num=(int)now & 0xf;
  if (num < 9) {
    mNoPhotoResource=R.drawable.ic_contact_picture;
  }
 else   if (num < 14) {
    mNoPhotoResource=R.drawable.ic_contact_picture_2;
  }
 else {
    mNoPhotoResource=R.drawable.ic_contact_picture_3;
  }
  resetAsyncQueryHandler();
}
Program: 182694
Project: 182694
Buggy source:
protected void startPhotoQuery(long photoId,Uri lookupKey){
  mQueryHandler.startQuery(TOKEN_PHOTO_QUERY,lookupKey,ContentUris.withAppendedId(Data.CONTENT_URI,photoId),PhotoQuery.COLUMNS,null,null,null);
}

Fixed version (ground truth):
/** 
 * startPhotoQuery internal method to query contact photo by photo id and uri.
 * @param photoId the photo id.
 * @param lookupKey the lookup uri.
 * @param resetQueryHandler whether to use a new AsyncQueryHandler or not.
 */
protected void startPhotoQuery(long photoId,Uri lookupKey,boolean resetQueryHandler){
  if (resetQueryHandler) {
    resetAsyncQueryHandler();
  }
  mQueryHandler.startQuery(TOKEN_PHOTO_QUERY,lookupKey,ContentUris.withAppendedId(Data.CONTENT_URI,photoId),PhotoQuery.COLUMNS,null,null,null);
}