Program: 7410
Project: 7410
Buggy source:
@Override public void bindView(View view,Context context,Cursor cursor){
  final ContactListItemCache cache=(ContactListItemCache)view.getTag();
  TextView dataView=cache.dataView;
  TextView labelView=cache.labelView;
  int typeColumnIndex;
  int dataColumnIndex;
  int labelColumnIndex;
  int defaultType;
  int nameColumnIndex;
  boolean displayAdditionalData=mDisplayAdditionalData;
switch (mMode) {
case MODE_PICK_PHONE:
case MODE_LEGACY_PICK_PHONE:
{
      nameColumnIndex=PHONE_DISPLAY_NAME_COLUMN_INDEX;
      dataColumnIndex=PHONE_NUMBER_COLUMN_INDEX;
      typeColumnIndex=PHONE_TYPE_COLUMN_INDEX;
      labelColumnIndex=PHONE_LABEL_COLUMN_INDEX;
      defaultType=Phone.TYPE_HOME;
      break;
    }
case MODE_PICK_POSTAL:
case MODE_LEGACY_PICK_POSTAL:
{
    nameColumnIndex=POSTAL_DISPLAY_NAME_COLUMN_INDEX;
    dataColumnIndex=POSTAL_ADDRESS_COLUMN_INDEX;
    typeColumnIndex=POSTAL_TYPE_COLUMN_INDEX;
    labelColumnIndex=POSTAL_LABEL_COLUMN_INDEX;
    defaultType=StructuredPostal.TYPE_HOME;
    break;
  }
default :
{
  nameColumnIndex=SUMMARY_NAME_COLUMN_INDEX;
  dataColumnIndex=-1;
  typeColumnIndex=-1;
  labelColumnIndex=-1;
  defaultType=Phone.TYPE_HOME;
  displayAdditionalData=false;
}
}
cursor.copyStringToBuffer(nameColumnIndex,cache.nameBuffer);
int size=cache.nameBuffer.sizeCopied;
if (size != 0) {
cache.nameView.setText(cache.nameBuffer.data,0,size);
}
 else {
cache.nameView.setText(mUnknownNameText);
}
if (mDisplayPhotos) {
long photoId=0;
if (!cursor.isNull(SUMMARY_PHOTO_ID_COLUMN_INDEX)) {
photoId=cursor.getLong(SUMMARY_PHOTO_ID_COLUMN_INDEX);
}
if (photoId == 0) {
cache.photoView.setImageResource(R.drawable.ic_contact_list_picture);
}
 else {
cache.photoView.setImageBitmap(null);
Bitmap photo=null;
SoftReference<Bitmap> ref=mBitmapCache.get(photoId);
if (ref != null) {
  photo=ref.get();
  if (photo == null) {
    mBitmapCache.remove(photoId);
  }
}
if (photo != null) {
  cache.photoView.setImageBitmap(photo);
}
 else {
  cache.photoView.setTag(photoId);
  cache.photoView.setImageResource(R.drawable.ic_contact_list_picture);
  if (mScrollState == OnScrollListener.SCROLL_STATE_IDLE) {
    sendFetchImageMessage(cache.photoView);
  }
 else {
    mItemsMissingImages.add(cache.photoView);
  }
}
}
}
if (!displayAdditionalData) {
cache.dataView.setVisibility(View.GONE);
cache.labelView.setVisibility(View.GONE);
cache.presenceView.setVisibility(View.GONE);
return;
}
cursor.copyStringToBuffer(dataColumnIndex,cache.dataBuffer);
size=cache.dataBuffer.sizeCopied;
if (size != 0) {
dataView.setText(cache.dataBuffer.data,0,size);
dataView.setVisibility(View.VISIBLE);
}
 else {
dataView.setVisibility(View.GONE);
}
if (!cursor.isNull(typeColumnIndex)) {
labelView.setVisibility(View.VISIBLE);
int type=cursor.getInt(typeColumnIndex);
if (type != CommonDataKinds.BaseTypes.TYPE_CUSTOM) {
try {
  labelView.setText(mLocalizedLabels[type - 1]);
}
 catch (ArrayIndexOutOfBoundsException e) {
  labelView.setText(mLocalizedLabels[defaultType - 1]);
}
}
 else {
cursor.copyStringToBuffer(labelColumnIndex,cache.labelBuffer);
labelView.setText(cache.labelBuffer.data,0,cache.labelBuffer.sizeCopied);
}
}
 else {
labelView.setVisibility(View.GONE);
}
ImageView presenceView=cache.presenceView;
if ((mMode & MODE_MASK_NO_PRESENCE) == 0) {
int serverStatus;
if (!cursor.isNull(SUMMARY_PRESENCE_STATUS_COLUMN_INDEX)) {
serverStatus=cursor.getInt(SUMMARY_PRESENCE_STATUS_COLUMN_INDEX);
presenceView.setImageResource(Presence.getPresenceIconResourceId(serverStatus));
presenceView.setVisibility(View.VISIBLE);
}
 else {
presenceView.setVisibility(View.GONE);
}
}
 else {
presenceView.setVisibility(View.GONE);
}
}

Fixed version (ground truth):
@Override public void bindView(View view,Context context,Cursor cursor){
  final ContactListItemCache cache=(ContactListItemCache)view.getTag();
  TextView dataView=cache.dataView;
  TextView labelView=cache.labelView;
  int typeColumnIndex;
  int dataColumnIndex;
  int labelColumnIndex;
  int defaultType;
  int nameColumnIndex;
  boolean displayAdditionalData=mDisplayAdditionalData;
switch (mMode) {
case MODE_PICK_PHONE:
case MODE_LEGACY_PICK_PHONE:
{
      nameColumnIndex=PHONE_DISPLAY_NAME_COLUMN_INDEX;
      dataColumnIndex=PHONE_NUMBER_COLUMN_INDEX;
      typeColumnIndex=PHONE_TYPE_COLUMN_INDEX;
      labelColumnIndex=PHONE_LABEL_COLUMN_INDEX;
      defaultType=Phone.TYPE_HOME;
      break;
    }
case MODE_PICK_POSTAL:
case MODE_LEGACY_PICK_POSTAL:
{
    nameColumnIndex=POSTAL_DISPLAY_NAME_COLUMN_INDEX;
    dataColumnIndex=POSTAL_ADDRESS_COLUMN_INDEX;
    typeColumnIndex=POSTAL_TYPE_COLUMN_INDEX;
    labelColumnIndex=POSTAL_LABEL_COLUMN_INDEX;
    defaultType=StructuredPostal.TYPE_HOME;
    break;
  }
default :
{
  nameColumnIndex=SUMMARY_NAME_COLUMN_INDEX;
  dataColumnIndex=-1;
  typeColumnIndex=-1;
  labelColumnIndex=-1;
  defaultType=Phone.TYPE_HOME;
  displayAdditionalData=false;
}
}
cursor.copyStringToBuffer(nameColumnIndex,cache.nameBuffer);
int size=cache.nameBuffer.sizeCopied;
if (size != 0) {
cache.nameView.setText(cache.nameBuffer.data,0,size);
}
 else {
cache.nameView.setText(mUnknownNameText);
}
if (mDisplayPhotos) {
long photoId=0;
if (!cursor.isNull(SUMMARY_PHOTO_ID_COLUMN_INDEX)) {
photoId=cursor.getLong(SUMMARY_PHOTO_ID_COLUMN_INDEX);
}
cache.photoView.setTag(photoId);
if (photoId == 0) {
cache.photoView.setImageResource(R.drawable.ic_contact_list_picture);
}
 else {
Bitmap photo=null;
SoftReference<Bitmap> ref=mBitmapCache.get(photoId);
if (ref != null) {
  photo=ref.get();
  if (photo == null) {
    mBitmapCache.remove(photoId);
  }
}
if (photo != null) {
  cache.photoView.setImageBitmap(photo);
}
 else {
  cache.photoView.setImageResource(R.drawable.ic_contact_list_picture);
  mItemsMissingImages.add(cache.photoView);
  if (mScrollState != OnScrollListener.SCROLL_STATE_FLING) {
    sendFetchImageMessage(cache.photoView);
  }
}
}
}
if (!displayAdditionalData) {
cache.dataView.setVisibility(View.GONE);
cache.labelView.setVisibility(View.GONE);
cache.presenceView.setVisibility(View.GONE);
return;
}
cursor.copyStringToBuffer(dataColumnIndex,cache.dataBuffer);
size=cache.dataBuffer.sizeCopied;
if (size != 0) {
dataView.setText(cache.dataBuffer.data,0,size);
dataView.setVisibility(View.VISIBLE);
}
 else {
dataView.setVisibility(View.GONE);
}
if (!cursor.isNull(typeColumnIndex)) {
labelView.setVisibility(View.VISIBLE);
int type=cursor.getInt(typeColumnIndex);
if (type != CommonDataKinds.BaseTypes.TYPE_CUSTOM) {
try {
  labelView.setText(mLocalizedLabels[type - 1]);
}
 catch (ArrayIndexOutOfBoundsException e) {
  labelView.setText(mLocalizedLabels[defaultType - 1]);
}
}
 else {
cursor.copyStringToBuffer(labelColumnIndex,cache.labelBuffer);
labelView.setText(cache.labelBuffer.data,0,cache.labelBuffer.sizeCopied);
}
}
 else {
labelView.setVisibility(View.GONE);
}
ImageView presenceView=cache.presenceView;
if ((mMode & MODE_MASK_NO_PRESENCE) == 0) {
int serverStatus;
if (!cursor.isNull(SUMMARY_PRESENCE_STATUS_COLUMN_INDEX)) {
serverStatus=cursor.getInt(SUMMARY_PRESENCE_STATUS_COLUMN_INDEX);
presenceView.setImageResource(Presence.getPresenceIconResourceId(serverStatus));
presenceView.setVisibility(View.VISIBLE);
}
 else {
presenceView.setVisibility(View.GONE);
}
}
 else {
presenceView.setVisibility(View.GONE);
}
}