nus-yam/ex-repair huggingface dataset:
Program: 42648
Project: 42648
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: 42649
Project: 42649
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: 42650
Project: 42650
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: 42651
Project: 42651
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: 42652
Project: 42652
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: 42653
Project: 42653
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: 42655
Project: 42655
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: 42656
Project: 42656
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: 42657
Project: 42657
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: 42658
Project: 42658
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: 42659
Project: 42659
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: 42660
Project: 42660
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: 42661
Project: 42661
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: 42664
Project: 42664
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: 42665
Project: 42665
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: 42666
Project: 42666
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: 42668
Project: 42668
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: 42669
Project: 42669
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: 42670
Project: 42670
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: 42674
Project: 42674
Buggy source:
@Override public void onWindowFocusChanged(boolean hasWindowFocus){
  super.onWindowFocusChanged(hasWindowFocus);
  final int touchMode=isInTouchMode() ? TOUCH_MODE_ON : TOUCH_MODE_OFF;
  if (!hasWindowFocus) {
    setChildrenDrawingCacheEnabled(false);
    removeCallbacks(mFlingRunnable);
    dismissPopup();
    if (touchMode == TOUCH_MODE_OFF) {
      mResurrectToPosition=mSelectedPosition;
    }
  }
 else {
    if (mFiltered) {
      showPopup();
    }
    if (touchMode != mLastTouchMode && mLastTouchMode != TOUCH_MODE_UNKNOWN) {
      if (touchMode == TOUCH_MODE_OFF) {
        resurrectSelection();
      }
 else {
        hideSelector();
        mLayoutMode=LAYOUT_NORMAL;
        layoutChildren();
      }
    }
  }
  mLastTouchMode=touchMode;
}

Fixed version (ground truth):
@Override public void onWindowFocusChanged(boolean hasWindowFocus){
  super.onWindowFocusChanged(hasWindowFocus);
  final int touchMode=isInTouchMode() ? TOUCH_MODE_ON : TOUCH_MODE_OFF;
  if (!hasWindowFocus) {
    setChildrenDrawingCacheEnabled(false);
    if (mFlingRunnable != null) {
      removeCallbacks(mFlingRunnable);
      mFlingRunnable.endFling();
    }
    dismissPopup();
    if (touchMode == TOUCH_MODE_OFF) {
      mResurrectToPosition=mSelectedPosition;
    }
  }
 else {
    if (mFiltered) {
      showPopup();
    }
    if (touchMode != mLastTouchMode && mLastTouchMode != TOUCH_MODE_UNKNOWN) {
      if (touchMode == TOUCH_MODE_OFF) {
        resurrectSelection();
      }
 else {
        hideSelector();
        mLayoutMode=LAYOUT_NORMAL;
        layoutChildren();
      }
    }
  }
  mLastTouchMode=touchMode;
}
Program: 42675
Project: 42675
Buggy source:
@Override public void onWindowFocusChanged(boolean hasWindowFocus){
  super.onWindowFocusChanged(hasWindowFocus);
  final int touchMode=isInTouchMode() ? TOUCH_MODE_ON : TOUCH_MODE_OFF;
  if (!hasWindowFocus) {
    setChildrenDrawingCacheEnabled(false);
    removeCallbacks(mFlingRunnable);
    dismissPopup();
    if (touchMode == TOUCH_MODE_OFF) {
      mResurrectToPosition=mSelectedPosition;
    }
  }
 else {
    if (mFiltered) {
      showPopup();
    }
    if (touchMode != mLastTouchMode && mLastTouchMode != TOUCH_MODE_UNKNOWN) {
      if (touchMode == TOUCH_MODE_OFF) {
        resurrectSelection();
      }
 else {
        hideSelector();
        mLayoutMode=LAYOUT_NORMAL;
        layoutChildren();
      }
    }
  }
  mLastTouchMode=touchMode;
}

Fixed version (ground truth):
@Override public void onWindowFocusChanged(boolean hasWindowFocus){
  super.onWindowFocusChanged(hasWindowFocus);
  final int touchMode=isInTouchMode() ? TOUCH_MODE_ON : TOUCH_MODE_OFF;
  if (!hasWindowFocus) {
    setChildrenDrawingCacheEnabled(false);
    if (mFlingRunnable != null) {
      removeCallbacks(mFlingRunnable);
      mFlingRunnable.endFling();
    }
    dismissPopup();
    if (touchMode == TOUCH_MODE_OFF) {
      mResurrectToPosition=mSelectedPosition;
    }
  }
 else {
    if (mFiltered) {
      showPopup();
    }
    if (touchMode != mLastTouchMode && mLastTouchMode != TOUCH_MODE_UNKNOWN) {
      if (touchMode == TOUCH_MODE_OFF) {
        resurrectSelection();
      }
 else {
        hideSelector();
        mLayoutMode=LAYOUT_NORMAL;
        layoutChildren();
      }
    }
  }
  mLastTouchMode=touchMode;
}
Program: 42676
Project: 42676
Buggy source:
private void handleSinkStateChange(BluetoothDevice device,int prevState,int state){
  if (state != prevState) {
    if (state == BluetoothA2dp.STATE_DISCONNECTED || state == BluetoothA2dp.STATE_DISCONNECTING) {
      if (prevState == BluetoothA2dp.STATE_CONNECTED || prevState == BluetoothA2dp.STATE_PLAYING) {
        Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
        mContext.sendBroadcast(intent);
      }
      mSinkCount--;
    }
 else     if (state == BluetoothA2dp.STATE_CONNECTED) {
      mSinkCount++;
    }
    mAudioDevices.put(device,state);
    checkSinkSuspendState(state);
    mTargetA2dpState=-1;
    if (state == BluetoothA2dp.STATE_CONNECTING) {
      mAudioManager.setParameters("String_Node_Str");
    }
    if (getSinkPriority(device) > BluetoothA2dp.PRIORITY_OFF && state == BluetoothA2dp.STATE_CONNECTING || state == BluetoothA2dp.STATE_CONNECTED) {
      setSinkPriority(device,BluetoothA2dp.PRIORITY_AUTO_CONNECT);
    }
    Intent intent=new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
    intent.putExtra(BluetoothDevice.EXTRA_DEVICE,device);
    intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE,prevState);
    intent.putExtra(BluetoothA2dp.EXTRA_SINK_STATE,state);
    mContext.sendBroadcast(intent,BLUETOOTH_PERM);
    if (DBG)     log("String_Node_Str" + device + "String_Node_Str"+ prevState+ "String_Node_Str"+ state);
  }
}

Fixed version (ground truth):
private void handleSinkStateChange(BluetoothDevice device,int prevState,int state){
  if (state != prevState) {
    if (state == BluetoothA2dp.STATE_DISCONNECTED || state == BluetoothA2dp.STATE_DISCONNECTING) {
      if (prevState == BluetoothA2dp.STATE_CONNECTED || prevState == BluetoothA2dp.STATE_PLAYING) {
        Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
        mContext.sendBroadcast(intent);
      }
      mSinkCount--;
    }
 else     if (state == BluetoothA2dp.STATE_CONNECTED) {
      mSinkCount++;
    }
    mAudioDevices.put(device,state);
    checkSinkSuspendState(state);
    mTargetA2dpState=-1;
    if (getSinkPriority(device) > BluetoothA2dp.PRIORITY_OFF && state == BluetoothA2dp.STATE_CONNECTING || state == BluetoothA2dp.STATE_CONNECTED) {
      setSinkPriority(device,BluetoothA2dp.PRIORITY_AUTO_CONNECT);
    }
    Intent intent=new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
    intent.putExtra(BluetoothDevice.EXTRA_DEVICE,device);
    intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE,prevState);
    intent.putExtra(BluetoothA2dp.EXTRA_SINK_STATE,state);
    mContext.sendBroadcast(intent,BLUETOOTH_PERM);
    if (DBG)     log("String_Node_Str" + device + "String_Node_Str"+ prevState+ "String_Node_Str"+ state);
  }
}
Program: 42678
Project: 42678
Buggy source:
public String[] listAsec() throws IllegalStateException {
  ArrayList<String> rsp=doCommand("String_Node_Str");
  String[] rdata=new String[rsp.size()];
  int idx=0;
  for (  String line : rsp) {
    String[] tok=line.split("String_Node_Str");
    int code=Integer.parseInt(tok[0]);
    if (code == ResponseCode.AsecPathResult) {
      rdata[idx++]=tok[1];
    }
 else     if (code == ResponseCode.CommandOkay) {
      return rdata;
    }
 else {
      throw new IllegalStateException(String.format("String_Node_Str",code));
    }
  }
  throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
public String[] listAsec() throws IllegalStateException {
  ArrayList<String> rsp=doCommand("String_Node_Str");
  String[] rdata=new String[rsp.size()];
  int idx=0;
  for (  String line : rsp) {
    String[] tok=line.split("String_Node_Str");
    int code=Integer.parseInt(tok[0]);
    if (code == ResponseCode.AsecListResult) {
      rdata[idx++]=tok[1];
    }
 else     if (code == ResponseCode.CommandOkay) {
      return rdata;
    }
 else {
      throw new IllegalStateException(String.format("String_Node_Str",code));
    }
  }
  throw new IllegalStateException("String_Node_Str");
}
Program: 42679
Project: 42679
Buggy source:
public String[] listAsec() throws IllegalStateException {
  ArrayList<String> rsp=doCommand("String_Node_Str");
  String[] rdata=new String[rsp.size()];
  int idx=0;
  for (  String line : rsp) {
    String[] tok=line.split("String_Node_Str");
    int code=Integer.parseInt(tok[0]);
    if (code == ResponseCode.AsecPathResult) {
      rdata[idx++]=tok[1];
    }
 else     if (code == ResponseCode.CommandOkay) {
      return rdata;
    }
 else {
      throw new IllegalStateException(String.format("String_Node_Str",code));
    }
  }
  throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
public String[] listAsec() throws IllegalStateException {
  ArrayList<String> rsp=doCommand("String_Node_Str");
  String[] rdata=new String[rsp.size()];
  int idx=0;
  for (  String line : rsp) {
    String[] tok=line.split("String_Node_Str");
    int code=Integer.parseInt(tok[0]);
    if (code == ResponseCode.AsecListResult) {
      rdata[idx++]=tok[1];
    }
 else     if (code == ResponseCode.CommandOkay) {
      return rdata;
    }
 else {
      throw new IllegalStateException(String.format("String_Node_Str",code));
    }
  }
  throw new IllegalStateException("String_Node_Str");
}
Program: 42680
Project: 42680
Buggy source:
/** 
 * Run on the webcore thread set the local values with the current ones
 */
private void syncValues(){
  Set<String> tmp=nativeGetOrigins();
  mOrigins=new HashMap<String,Origin>();
  for (  String origin : tmp) {
    Origin website=new Origin(origin,nativeGetUsageForOrigin(origin),nativeGetQuotaForOrigin(origin));
    mOrigins.put(origin,website);
  }
}

Fixed version (ground truth):
/** 
 * Run on the webcore thread set the local values with the current ones
 */
private void syncValues(){
  Set<String> tmp=nativeGetOrigins();
  mOrigins=new HashMap<String,Origin>();
  for (  String origin : tmp) {
    Origin website=new Origin(origin,nativeGetQuotaForOrigin(origin),nativeGetUsageForOrigin(origin));
    mOrigins.put(origin,website);
  }
}
Program: 42681
Project: 42681
Buggy source:
private void handleSinkStateChange(BluetoothDevice device,int prevState,int state){
  if (state != prevState) {
    if (state == BluetoothA2dp.STATE_DISCONNECTED || state == BluetoothA2dp.STATE_DISCONNECTING) {
      if (prevState == BluetoothA2dp.STATE_CONNECTED || prevState == BluetoothA2dp.STATE_PLAYING) {
        Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
        mContext.sendBroadcast(intent);
      }
      mSinkCount--;
    }
 else     if (state == BluetoothA2dp.STATE_CONNECTED) {
      mSinkCount++;
    }
    mAudioDevices.put(device,state);
    checkSinkSuspendState(state);
    mTargetA2dpState=-1;
    if (state == BluetoothA2dp.STATE_CONNECTING) {
      mAudioManager.setParameters("String_Node_Str");
    }
    if (getSinkPriority(device) > BluetoothA2dp.PRIORITY_OFF && state == BluetoothA2dp.STATE_CONNECTING || state == BluetoothA2dp.STATE_CONNECTED) {
      setSinkPriority(device,BluetoothA2dp.PRIORITY_AUTO_CONNECT);
    }
    Intent intent=new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
    intent.putExtra(BluetoothDevice.EXTRA_DEVICE,device);
    intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE,prevState);
    intent.putExtra(BluetoothA2dp.EXTRA_SINK_STATE,state);
    mContext.sendBroadcast(intent,BLUETOOTH_PERM);
    if (DBG)     log("String_Node_Str" + device + "String_Node_Str"+ prevState+ "String_Node_Str"+ state);
  }
}

Fixed version (ground truth):
private void handleSinkStateChange(BluetoothDevice device,int prevState,int state){
  if (state != prevState) {
    if (state == BluetoothA2dp.STATE_DISCONNECTED || state == BluetoothA2dp.STATE_DISCONNECTING) {
      if (prevState == BluetoothA2dp.STATE_CONNECTED || prevState == BluetoothA2dp.STATE_PLAYING) {
        Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
        mContext.sendBroadcast(intent);
      }
      mSinkCount--;
    }
 else     if (state == BluetoothA2dp.STATE_CONNECTED) {
      mSinkCount++;
    }
    mAudioDevices.put(device,state);
    checkSinkSuspendState(state);
    mTargetA2dpState=-1;
    if (getSinkPriority(device) > BluetoothA2dp.PRIORITY_OFF && state == BluetoothA2dp.STATE_CONNECTING || state == BluetoothA2dp.STATE_CONNECTED) {
      setSinkPriority(device,BluetoothA2dp.PRIORITY_AUTO_CONNECT);
    }
    Intent intent=new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
    intent.putExtra(BluetoothDevice.EXTRA_DEVICE,device);
    intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE,prevState);
    intent.putExtra(BluetoothA2dp.EXTRA_SINK_STATE,state);
    mContext.sendBroadcast(intent,BLUETOOTH_PERM);
    if (DBG)     log("String_Node_Str" + device + "String_Node_Str"+ prevState+ "String_Node_Str"+ state);
  }
}
Program: 42683
Project: 42683
Buggy source:
/** 
 * Run on the webcore thread set the local values with the current ones
 */
private void syncValues(){
  Set<String> tmp=nativeGetOrigins();
  mOrigins=new HashMap<String,Origin>();
  for (  String origin : tmp) {
    Origin website=new Origin(origin,nativeGetUsageForOrigin(origin),nativeGetQuotaForOrigin(origin));
    mOrigins.put(origin,website);
  }
}

Fixed version (ground truth):
/** 
 * Run on the webcore thread set the local values with the current ones
 */
private void syncValues(){
  Set<String> tmp=nativeGetOrigins();
  mOrigins=new HashMap<String,Origin>();
  for (  String origin : tmp) {
    Origin website=new Origin(origin,nativeGetQuotaForOrigin(origin),nativeGetUsageForOrigin(origin));
    mOrigins.put(origin,website);
  }
}
Program: 42684
Project: 42684
Buggy source:
private void handleSinkStateChange(BluetoothDevice device,int prevState,int state){
  if (state != prevState) {
    if (state == BluetoothA2dp.STATE_DISCONNECTED || state == BluetoothA2dp.STATE_DISCONNECTING) {
      if (prevState == BluetoothA2dp.STATE_CONNECTED || prevState == BluetoothA2dp.STATE_PLAYING) {
        Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
        mContext.sendBroadcast(intent);
      }
      mSinkCount--;
    }
 else     if (state == BluetoothA2dp.STATE_CONNECTED) {
      mSinkCount++;
    }
    mAudioDevices.put(device,state);
    checkSinkSuspendState(state);
    mTargetA2dpState=-1;
    if (state == BluetoothA2dp.STATE_CONNECTING) {
      mAudioManager.setParameters("String_Node_Str");
    }
    if (getSinkPriority(device) > BluetoothA2dp.PRIORITY_OFF && state == BluetoothA2dp.STATE_CONNECTING || state == BluetoothA2dp.STATE_CONNECTED) {
      setSinkPriority(device,BluetoothA2dp.PRIORITY_AUTO_CONNECT);
    }
    Intent intent=new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
    intent.putExtra(BluetoothDevice.EXTRA_DEVICE,device);
    intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE,prevState);
    intent.putExtra(BluetoothA2dp.EXTRA_SINK_STATE,state);
    mContext.sendBroadcast(intent,BLUETOOTH_PERM);
    if (DBG)     log("String_Node_Str" + device + "String_Node_Str"+ prevState+ "String_Node_Str"+ state);
  }
}

Fixed version (ground truth):
private void handleSinkStateChange(BluetoothDevice device,int prevState,int state){
  if (state != prevState) {
    if (state == BluetoothA2dp.STATE_DISCONNECTED || state == BluetoothA2dp.STATE_DISCONNECTING) {
      if (prevState == BluetoothA2dp.STATE_CONNECTED || prevState == BluetoothA2dp.STATE_PLAYING) {
        Intent intent=new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
        mContext.sendBroadcast(intent);
      }
      mSinkCount--;
    }
 else     if (state == BluetoothA2dp.STATE_CONNECTED) {
      mSinkCount++;
    }
    mAudioDevices.put(device,state);
    checkSinkSuspendState(state);
    mTargetA2dpState=-1;
    if (getSinkPriority(device) > BluetoothA2dp.PRIORITY_OFF && state == BluetoothA2dp.STATE_CONNECTING || state == BluetoothA2dp.STATE_CONNECTED) {
      setSinkPriority(device,BluetoothA2dp.PRIORITY_AUTO_CONNECT);
    }
    Intent intent=new Intent(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
    intent.putExtra(BluetoothDevice.EXTRA_DEVICE,device);
    intent.putExtra(BluetoothA2dp.EXTRA_PREVIOUS_SINK_STATE,prevState);
    intent.putExtra(BluetoothA2dp.EXTRA_SINK_STATE,state);
    mContext.sendBroadcast(intent,BLUETOOTH_PERM);
    if (DBG)     log("String_Node_Str" + device + "String_Node_Str"+ prevState+ "String_Node_Str"+ state);
  }
}
Program: 42687
Project: 42687
Buggy source:
/** 
 * Move all views remaining in mActiveViews to mScrapViews.
 */
void scrapActiveViews(){
  final View[] activeViews=mActiveViews;
  final boolean hasListener=mRecyclerListener != null;
  final boolean multipleScraps=mViewTypeCount > 1;
  ArrayList<View> scrapViews=mCurrentScrap;
  final int count=activeViews.length;
  for (int i=0; i < count; ++i) {
    final View victim=activeViews[i];
    if (victim != null) {
      int whichScrap=((AbsListView.LayoutParams)victim.getLayoutParams()).viewType;
      activeViews[i]=null;
      if (whichScrap == AdapterView.ITEM_VIEW_TYPE_IGNORE) {
        continue;
      }
      if (multipleScraps) {
        scrapViews=mScrapViews[whichScrap];
      }
      scrapViews.add(victim);
      if (hasListener) {
        mRecyclerListener.onMovedToScrapHeap(victim);
      }
      if (ViewDebug.TRACE_RECYCLER) {
        ViewDebug.trace(victim,ViewDebug.RecyclerTraceType.MOVE_FROM_ACTIVE_TO_SCRAP_HEAP,mFirstActivePosition + i,-1);
      }
    }
  }
  pruneScrapViews();
}

Fixed version (ground truth):
/** 
 * Move all views remaining in mActiveViews to mScrapViews.
 */
void scrapActiveViews(){
  final View[] activeViews=mActiveViews;
  final boolean hasListener=mRecyclerListener != null;
  final boolean multipleScraps=mViewTypeCount > 1;
  ArrayList<View> scrapViews=mCurrentScrap;
  final int count=activeViews.length;
  for (int i=0; i < count; ++i) {
    final View victim=activeViews[i];
    if (victim != null) {
      int whichScrap=((AbsListView.LayoutParams)victim.getLayoutParams()).viewType;
      activeViews[i]=null;
      if (whichScrap == AdapterView.ITEM_VIEW_TYPE_IGNORE) {
        removeDetachedView(victim,false);
        continue;
      }
      if (multipleScraps) {
        scrapViews=mScrapViews[whichScrap];
      }
      scrapViews.add(victim);
      if (hasListener) {
        mRecyclerListener.onMovedToScrapHeap(victim);
      }
      if (ViewDebug.TRACE_RECYCLER) {
        ViewDebug.trace(victim,ViewDebug.RecyclerTraceType.MOVE_FROM_ACTIVE_TO_SCRAP_HEAP,mFirstActivePosition + i,-1);
      }
    }
  }
  pruneScrapViews();
}
Program: 42688
Project: 42688
Buggy source:
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  if (treeObserver != null) {
    treeObserver.removeOnTouchModeChangeListener(this);
    if (mTextFilterEnabled && mPopup != null) {
      treeObserver.removeGlobalOnLayoutListener(this);
      mGlobalLayoutListenerAddedFilter=false;
    }
  }
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dismissPopup();
  mRecycler.clear();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  if (treeObserver != null) {
    treeObserver.removeOnTouchModeChangeListener(this);
    if (mTextFilterEnabled && mPopup != null) {
      treeObserver.removeGlobalOnLayoutListener(this);
      mGlobalLayoutListenerAddedFilter=false;
    }
  }
}
Program: 42689
Project: 42689
Buggy source:
/** 
 * <p>Avoids jarring scrolling effect by ensuring that list elements made of a text view fit on a single line.</p>
 * @param position the item index in the list to get a view for
 * @return the view for the specified item
 */
@Override protected View obtainView(int position){
  View view=super.obtainView(position);
  if (view instanceof TextView) {
    ((TextView)view).setHorizontallyScrolling(true);
  }
  return view;
}

Fixed version (ground truth):
/** 
 * <p>Avoids jarring scrolling effect by ensuring that list elements made of a text view fit on a single line.</p>
 * @param position the item index in the list to get a view for
 * @return the view for the specified item
 */
@Override View obtainView(int position,boolean[] isScrap){
  View view=super.obtainView(position,isScrap);
  if (view instanceof TextView) {
    ((TextView)view).setHorizontallyScrolling(true);
  }
  return view;
}
Program: 42690
Project: 42690
Buggy source:
/** 
 * Obtain the view and add it to our list of children. The view can be made fresh, converted from an unused view, or used as is if it was in the recycle bin.
 * @param position Logical position in the list
 * @param y Top or bottom edge of the view to add
 * @param flow if true, align top edge to y. If false, align bottom edge toy.
 * @param childrenLeft Left edge where children should be positioned
 * @param selected Is this position selected?
 * @param where to add new item in the list
 * @return View that was added
 */
private View makeAndAddView(int position,int y,boolean flow,int childrenLeft,boolean selected,int where){
  View child;
  if (!mDataChanged) {
    child=mRecycler.getActiveView(position);
    if (child != null) {
      setupChild(child,position,y,flow,childrenLeft,selected,true,where);
      return child;
    }
  }
  child=obtainView(position);
  setupChild(child,position,y,flow,childrenLeft,selected,false,where);
  return child;
}

Fixed version (ground truth):
/** 
 * Obtain the view and add it to our list of children. The view can be made fresh, converted from an unused view, or used as is if it was in the recycle bin.
 * @param position Logical position in the list
 * @param y Top or bottom edge of the view to add
 * @param flow if true, align top edge to y. If false, align bottom edge toy.
 * @param childrenLeft Left edge where children should be positioned
 * @param selected Is this position selected?
 * @param where to add new item in the list
 * @return View that was added
 */
private View makeAndAddView(int position,int y,boolean flow,int childrenLeft,boolean selected,int where){
  View child;
  if (!mDataChanged) {
    child=mRecycler.getActiveView(position);
    if (child != null) {
      setupChild(child,position,y,flow,childrenLeft,selected,true,where);
      return child;
    }
  }
  child=obtainView(position,mIsScrap);
  setupChild(child,position,y,flow,childrenLeft,selected,mIsScrap[0],where);
  return child;
}
Program: 42692
Project: 42692
Buggy source:
private View addViewAbove(View theView,int position){
  int abovePosition=position - 1;
  View view=obtainView(abovePosition);
  int edgeOfNewChild=theView.getTop() - mDividerHeight;
  setupChild(view,abovePosition,edgeOfNewChild,false,mListPadding.left,false,false);
  return view;
}

Fixed version (ground truth):
private View addViewAbove(View theView,int position){
  int abovePosition=position - 1;
  View view=obtainView(abovePosition,mIsScrap);
  int edgeOfNewChild=theView.getTop() - mDividerHeight;
  setupChild(view,abovePosition,edgeOfNewChild,false,mListPadding.left,false,mIsScrap[0]);
  return view;
}
Program: 42693
Project: 42693
Buggy source:
private View addViewBelow(View theView,int position){
  int belowPosition=position + 1;
  View view=obtainView(belowPosition);
  int edgeOfNewChild=theView.getBottom() + mDividerHeight;
  setupChild(view,belowPosition,edgeOfNewChild,true,mListPadding.left,false,false);
  return view;
}

Fixed version (ground truth):
private View addViewBelow(View theView,int position){
  int belowPosition=position + 1;
  View view=obtainView(belowPosition,mIsScrap);
  int edgeOfNewChild=theView.getBottom() + mDividerHeight;
  setupChild(view,belowPosition,edgeOfNewChild,true,mListPadding.left,false,mIsScrap[0]);
  return view;
}
Program: 42694
Project: 42694
Buggy source:
/** 
 * Obtain the view and add it to our list of children. The view can be made fresh, converted from an unused view, or used as is if it was in the recycle bin.
 * @param position Logical position in the list
 * @param y Top or bottom edge of the view to add
 * @param flow If flow is true, align top edge to y. If false, align bottomedge to y.
 * @param childrenLeft Left edge where children should be positioned
 * @param selected Is this position selected?
 * @return View that was added
 */
private View makeAndAddView(int position,int y,boolean flow,int childrenLeft,boolean selected){
  View child;
  if (!mDataChanged) {
    child=mRecycler.getActiveView(position);
    if (child != null) {
      if (ViewDebug.TRACE_RECYCLER) {
        ViewDebug.trace(child,ViewDebug.RecyclerTraceType.RECYCLE_FROM_ACTIVE_HEAP,position,getChildCount());
      }
      setupChild(child,position,y,flow,childrenLeft,selected,true);
      return child;
    }
  }
  child=obtainView(position);
  setupChild(child,position,y,flow,childrenLeft,selected,false);
  return child;
}

Fixed version (ground truth):
/** 
 * Obtain the view and add it to our list of children. The view can be made fresh, converted from an unused view, or used as is if it was in the recycle bin.
 * @param position Logical position in the list
 * @param y Top or bottom edge of the view to add
 * @param flow If flow is true, align top edge to y. If false, align bottomedge to y.
 * @param childrenLeft Left edge where children should be positioned
 * @param selected Is this position selected?
 * @return View that was added
 */
private View makeAndAddView(int position,int y,boolean flow,int childrenLeft,boolean selected){
  View child;
  if (!mDataChanged) {
    child=mRecycler.getActiveView(position);
    if (child != null) {
      if (ViewDebug.TRACE_RECYCLER) {
        ViewDebug.trace(child,ViewDebug.RecyclerTraceType.RECYCLE_FROM_ACTIVE_HEAP,position,getChildCount());
      }
      setupChild(child,position,y,flow,childrenLeft,selected,true);
      return child;
    }
  }
  child=obtainView(position,mIsScrap);
  setupChild(child,position,y,flow,childrenLeft,selected,mIsScrap[0]);
  return child;
}
Program: 42696
Project: 42696
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  int widthMode=MeasureSpec.getMode(widthMeasureSpec);
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  int widthSize=MeasureSpec.getSize(widthMeasureSpec);
  int heightSize=MeasureSpec.getSize(heightMeasureSpec);
  int childWidth=0;
  int childHeight=0;
  mItemCount=mAdapter == null ? 0 : mAdapter.getCount();
  if (mItemCount > 0 && (widthMode == MeasureSpec.UNSPECIFIED || heightMode == MeasureSpec.UNSPECIFIED)) {
    final View child=obtainView(0);
    measureScrapChild(child,0,widthMeasureSpec);
    childWidth=child.getMeasuredWidth();
    childHeight=child.getMeasuredHeight();
    if (recycleOnMeasure()) {
      mRecycler.addScrapView(child);
    }
  }
  if (widthMode == MeasureSpec.UNSPECIFIED) {
    widthSize=mListPadding.left + mListPadding.right + childWidth+ getVerticalScrollbarWidth();
  }
  if (heightMode == MeasureSpec.UNSPECIFIED) {
    heightSize=mListPadding.top + mListPadding.bottom + childHeight+ getVerticalFadingEdgeLength() * 2;
  }
  if (heightMode == MeasureSpec.AT_MOST) {
    heightSize=measureHeightOfChildren(widthMeasureSpec,0,NO_POSITION,heightSize,-1);
  }
  setMeasuredDimension(widthSize,heightSize);
  mWidthMeasureSpec=widthMeasureSpec;
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  int widthMode=MeasureSpec.getMode(widthMeasureSpec);
  int heightMode=MeasureSpec.getMode(heightMeasureSpec);
  int widthSize=MeasureSpec.getSize(widthMeasureSpec);
  int heightSize=MeasureSpec.getSize(heightMeasureSpec);
  int childWidth=0;
  int childHeight=0;
  mItemCount=mAdapter == null ? 0 : mAdapter.getCount();
  if (mItemCount > 0 && (widthMode == MeasureSpec.UNSPECIFIED || heightMode == MeasureSpec.UNSPECIFIED)) {
    final View child=obtainView(0,mIsScrap);
    measureScrapChild(child,0,widthMeasureSpec);
    childWidth=child.getMeasuredWidth();
    childHeight=child.getMeasuredHeight();
    if (recycleOnMeasure()) {
      mRecycler.addScrapView(child);
    }
  }
  if (widthMode == MeasureSpec.UNSPECIFIED) {
    widthSize=mListPadding.left + mListPadding.right + childWidth+ getVerticalScrollbarWidth();
  }
  if (heightMode == MeasureSpec.UNSPECIFIED) {
    heightSize=mListPadding.top + mListPadding.bottom + childHeight+ getVerticalFadingEdgeLength() * 2;
  }
  if (heightMode == MeasureSpec.AT_MOST) {
    heightSize=measureHeightOfChildren(widthMeasureSpec,0,NO_POSITION,heightSize,-1);
  }
  setMeasuredDimension(widthSize,heightSize);
  mWidthMeasureSpec=widthMeasureSpec;
}