nus-yam/ex-repair huggingface dataset:
Program: 42579
Project: 42579
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: 42580
Project: 42580
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: 42581
Project: 42581
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: 42582
Project: 42582
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: 42584
Project: 42584
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: 42585
Project: 42585
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: 42586
Project: 42586
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: 42587
Project: 42587
Buggy source:
public void contextBindProgramFragmentStore(ProgramStore p){
  nContextBindProgramFragmentStore(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramFragmentStore(ProgramStore p){
  validate();
  nContextBindProgramFragmentStore(safeID(p));
}
Program: 42588
Project: 42588
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: 42589
Project: 42589
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: 42590
Project: 42590
Buggy source:
public void contextBindProgramVertex(ProgramVertex p){
  nContextBindProgramVertex(safeID(p));
}

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

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

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

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

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

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

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

Fixed version (ground truth):
public void contextSetPriority(Priority p){
  validate();
  nContextSetPriority(p.mID);
}
Program: 42598
Project: 42598
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: 42599
Project: 42599
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: 42600
Project: 42600
Buggy source:
public void contextBindProgramFragmentStore(ProgramStore p){
  nContextBindProgramFragmentStore(safeID(p));
}

Fixed version (ground truth):
public void contextBindProgramFragmentStore(ProgramStore p){
  validate();
  nContextBindProgramFragmentStore(safeID(p));
}
Program: 42601
Project: 42601
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: 42602
Project: 42602
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: 42603
Project: 42603
Buggy source:
public void contextBindProgramVertex(ProgramVertex p){
  nContextBindProgramVertex(safeID(p));
}

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

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

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

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

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

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

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

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

Fixed version (ground truth):
private native void nativeUpdateLayers(int updates);
Program: 42617
Project: 42617
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: 42618
Project: 42618
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: 42619
Project: 42619
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: 42620
Project: 42620
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: 42621
Project: 42621
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: 42622
Project: 42622
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: 42624
Project: 42624
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: 42625
Project: 42625
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: 42627
Project: 42627
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: 42628
Project: 42628
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: 42630
Project: 42630
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: 42631
Project: 42631
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: 42632
Project: 42632
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: 42633
Project: 42633
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: 42634
Project: 42634
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: 42636
Project: 42636
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: 42637
Project: 42637
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: 42638
Project: 42638
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: 42639
Project: 42639
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: 42640
Project: 42640
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: 42641
Project: 42641
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: 42642
Project: 42642
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: 42643
Project: 42643
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: 42644
Project: 42644
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: 42645
Project: 42645
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: 42647
Project: 42647
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);
}