Program: 23260
Project: 23260
Buggy source:
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
  try {
switch (token) {
case TOKEN_PHOTO_QUERY:
{
        Bitmap photoBitmap=null;
        if (cursor != null && cursor.moveToFirst() && !cursor.isNull(PhotoQuery.PHOTO)) {
          byte[] photoData=cursor.getBlob(PhotoQuery.PHOTO);
          photoBitmap=BitmapFactory.decodeByteArray(photoData,0,photoData.length,null);
        }
        if (photoBitmap == null) {
          photoBitmap=loadPlaceholderPhoto(null);
        }
        mPhotoView.setImageBitmap(photoBitmap);
        if (cookie != null && cookie instanceof Uri) {
          mPhotoView.assignContactUri((Uri)cookie);
        }
        invalidate();
        break;
      }
case TOKEN_CONTACT_INFO:
{
      if (cursor != null && cursor.moveToFirst()) {
        bindContactInfo(cursor);
        Uri lookupUri=Contacts.getLookupUri(cursor.getLong(ContactQuery._ID),cursor.getString(ContactQuery.LOOKUP_KEY));
        startPhotoQuery(cursor.getLong(ContactQuery.PHOTO_ID),lookupUri);
        invalidate();
      }
      break;
    }
case TOKEN_PHONE_LOOKUP:
{
    if (cursor != null && cursor.moveToFirst()) {
      long contactId=cursor.getLong(PHONE_LOOKUP_CONTACT_ID_COLUMN_INDEX);
      String lookupKey=cursor.getString(PHONE_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
      bindFromContactUri(Contacts.getLookupUri(contactId,lookupKey));
    }
 else {
      String phoneNumber=(String)cookie;
      setDisplayName(phoneNumber,null);
      setSocialSnippet(null);
      mPhotoView.assignContactFromPhone(phoneNumber,true);
    }
    break;
  }
case TOKEN_EMAIL_LOOKUP:
{
  if (cursor != null && cursor.moveToFirst()) {
    long contactId=cursor.getLong(EMAIL_LOOKUP_CONTACT_ID_COLUMN_INDEX);
    String lookupKey=cursor.getString(EMAIL_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
    bindFromContactUri(Contacts.getLookupUri(contactId,lookupKey));
  }
 else {
    String emailAddress=(String)cookie;
    setDisplayName(emailAddress,null);
    setSocialSnippet(null);
    mPhotoView.assignContactFromEmail(emailAddress,true);
  }
  break;
}
}
}
  finally {
if (cursor != null) {
cursor.close();
}
}
}

Fixed version (ground truth):
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
  try {
    if (this != mQueryHandler) {
      Log.d(TAG,"String_Node_Str");
      return;
    }
switch (token) {
case TOKEN_PHOTO_QUERY:
{
        Bitmap photoBitmap=null;
        if (cursor != null && cursor.moveToFirst() && !cursor.isNull(PhotoQuery.PHOTO)) {
          byte[] photoData=cursor.getBlob(PhotoQuery.PHOTO);
          photoBitmap=BitmapFactory.decodeByteArray(photoData,0,photoData.length,null);
        }
        if (photoBitmap == null) {
          photoBitmap=loadPlaceholderPhoto(null);
        }
        mPhotoView.setImageBitmap(photoBitmap);
        if (cookie != null && cookie instanceof Uri) {
          mPhotoView.assignContactUri((Uri)cookie);
        }
        invalidate();
        break;
      }
case TOKEN_CONTACT_INFO:
{
      if (cursor != null && cursor.moveToFirst()) {
        bindContactInfo(cursor);
        Uri lookupUri=Contacts.getLookupUri(cursor.getLong(ContactQuery._ID),cursor.getString(ContactQuery.LOOKUP_KEY));
        startPhotoQuery(cursor.getLong(ContactQuery.PHOTO_ID),lookupUri,false);
        invalidate();
      }
 else {
        setDisplayName(null,null);
        setSocialSnippet(null);
        setPhoto(loadPlaceholderPhoto(null));
      }
      break;
    }
case TOKEN_PHONE_LOOKUP:
{
    if (cursor != null && cursor.moveToFirst()) {
      long contactId=cursor.getLong(PHONE_LOOKUP_CONTACT_ID_COLUMN_INDEX);
      String lookupKey=cursor.getString(PHONE_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
      bindFromContactUriInternal(Contacts.getLookupUri(contactId,lookupKey),false);
    }
 else {
      String phoneNumber=(String)cookie;
      setDisplayName(phoneNumber,null);
      setSocialSnippet(null);
      setPhoto(loadPlaceholderPhoto(null));
      mPhotoView.assignContactFromPhone(phoneNumber,true);
    }
    break;
  }
case TOKEN_EMAIL_LOOKUP:
{
  if (cursor != null && cursor.moveToFirst()) {
    long contactId=cursor.getLong(EMAIL_LOOKUP_CONTACT_ID_COLUMN_INDEX);
    String lookupKey=cursor.getString(EMAIL_LOOKUP_CONTACT_LOOKUP_KEY_COLUMN_INDEX);
    bindFromContactUriInternal(Contacts.getLookupUri(contactId,lookupKey),false);
  }
 else {
    String emailAddress=(String)cookie;
    setDisplayName(emailAddress,null);
    setSocialSnippet(null);
    setPhoto(loadPlaceholderPhoto(null));
    mPhotoView.assignContactFromEmail(emailAddress,true);
  }
  break;
}
}
}
  finally {
if (cursor != null) {
cursor.close();
}
}
}