Program: 25926
Project: 25926
Buggy source:
private void performAction(String id,int type){
  Api api=App.api;
  String where=BasicColumns.ID + "String_Node_Str";
  String[] whereArgs=new String[]{id};
  try {
switch (type) {
case Commons.ACTION_STATUS_SHOW:
{
        Status s=api.statusesShow(id,FanFouApiConfig.FORMAT_HTML,FanFouApiConfig.MODE_LITE);
        if (s == null || s.isNull()) {
          receiver.send(Commons.RESULT_CODE_FINISH,null);
        }
 else {
          if (!FanFouProvider.updateUserInfo(this,s.user)) {
            FanFouProvider.insertUserInfo(this,s.user);
          }
          FanFouProvider.updateUserInfo(this,s.user);
          Bundle data=new Bundle();
          data.putInt(Commons.EXTRA_TYPE,type);
          data.putParcelable(Commons.EXTRA_STATUS,s);
          receiver.send(Commons.RESULT_CODE_FINISH,data);
        }
      }
    break;
case Commons.ACTION_STATUS_DELETE:
{
    Status s=api.statusesDelete(id,FanFouApiConfig.FORMAT_HTML,FanFouApiConfig.MODE_LITE);
    if (s == null || s.isNull()) {
      receiver.send(Commons.RESULT_CODE_FINISH,null);
    }
 else {
      ContentResolver cr=getContentResolver();
      Uri uri=Uri.parse(StatusInfo.CONTENT_URI + "String_Node_Str" + id);
      int result=cr.delete(uri,null,null);
      Bundle data=new Bundle();
      data.putInt(Commons.EXTRA_TYPE,type);
      data.putParcelable(Commons.EXTRA_STATUS,s);
      receiver.send(Commons.RESULT_CODE_FINISH,data);
    }
  }
break;
case Commons.ACTION_STATUS_FAVORITE:
{
Status s=api.favoritesCreate(id,FanFouApiConfig.FORMAT_HTML,FanFouApiConfig.MODE_LITE);
if (s == null || s.isNull()) {
  receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
  ContentResolver cr=getContentResolver();
  ContentValues values=new ContentValues();
  values.put(StatusInfo.FAVORITED,true);
  int result=cr.update(StatusInfo.CONTENT_URI,values,where,whereArgs);
  FanFouProvider.updateUserInfo(this,s.user);
  Bundle data=new Bundle();
  data.putInt(Commons.EXTRA_TYPE,type);
  data.putParcelable(Commons.EXTRA_STATUS,s);
  receiver.send(Commons.RESULT_CODE_FINISH,data);
}
}
break;
case Commons.ACTION_STATUS_UNFAVORITE:
{
Status s=api.favoritesDelete(id,FanFouApiConfig.FORMAT_HTML,FanFouApiConfig.MODE_LITE);
if (s == null || s.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
ContentResolver cr=getContentResolver();
ContentValues values=new ContentValues();
values.put(StatusInfo.FAVORITED,false);
int result=cr.update(StatusInfo.CONTENT_URI,values,where,whereArgs);
FanFouProvider.updateUserInfo(this,s.user);
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_STATUS,s);
receiver.send(Commons.RESULT_CODE_FINISH,data);
}
}
break;
case Commons.ACTION_USER_SHOW:
{
User u=api.userShow(id,FanFouApiConfig.MODE_LITE);
if (u == null || u.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
if (!FanFouProvider.updateUserInfo(this,u)) {
FanFouProvider.insertUserInfo(this,u);
}
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_USER,u);
receiver.send(Commons.RESULT_CODE_FINISH,data);
}
}
break;
case Commons.ACTION_USER_FOLLOW:
{
User u=api.friendshipsCreate(id,FanFouApiConfig.MODE_LITE);
if (u == null || u.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
u.type=User.TYPE_FRIENDS;
getContentResolver().insert(UserInfo.CONTENT_URI,u.toContentValues());
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_USER,u);
receiver.send(Commons.RESULT_CODE_FINISH,data);
}
break;
}
case Commons.ACTION_USER_UNFOLLOW:
{
User u=api.friendshipsDelete(id,FanFouApiConfig.MODE_LITE);
if (u == null || u.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
u.type=Commons.TYPE_NONE;
ContentResolver cr=getContentResolver();
cr.delete(UserInfo.CONTENT_URI,BasicColumns.ID + "String_Node_Str",new String[]{id});
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_USER,u);
receiver.send(Commons.RESULT_CODE_FINISH,data);
cr.delete(StatusInfo.CONTENT_URI,StatusInfo.USER_ID + "String_Node_Str",new String[]{id});
}
}
break;
case Commons.ACTION_USER_BLOCK:
{
User u=api.blocksCreate(id,FanFouApiConfig.MODE_LITE);
if (u == null || u.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
getContentResolver().delete(UserInfo.CONTENT_URI,where,whereArgs);
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_USER,u);
receiver.send(Commons.RESULT_CODE_FINISH,data);
}
}
break;
case Commons.ACTION_USER_UNBLOCK:
{
User u=api.blocksDelete(id,FanFouApiConfig.MODE_LITE);
if (u == null || u.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_USER,u);
receiver.send(Commons.RESULT_CODE_FINISH,data);
}
}
break;
case Commons.ACTION_DIRECT_MESSAGE_DELETE:
{
DirectMessage dm=api.directMessagesDelete(id,FanFouApiConfig.MODE_LITE);
if (dm == null || dm.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
ContentResolver cr=getContentResolver();
int result=cr.delete(DirectMessageInfo.CONTENT_URI,where,whereArgs);
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_MESSAGE,dm);
receiver.send(Commons.RESULT_CODE_FINISH,data);
}
}
break;
case Commons.ACTION_DIRECT_MESSAGE_SHOW:
break;
case Commons.ACTION_DIRECT_MESSAGE_CREATE:
break;
default :
break;
}
}
 catch (ApiException e) {
if (App.DEBUG) {
Log.e(TAG,"String_Node_Str" + id + "String_Node_Str"+ type+ e.getMessage());
}
String message=e.getMessage();
if (e.statusCode == ResponseCode.ERROR_NOT_CONNECTED || e.statusCode >= 500) {
message=getString(R.string.connection_error_msg);
}
Bundle b=new Bundle();
b.putInt(Commons.EXTRA_TYPE,type);
b.putInt(Commons.EXTRA_ERROR_CODE,e.statusCode);
b.putString(Commons.EXTRA_ERROR_MESSAGE,message);
receiver.send(Commons.RESULT_CODE_ERROR,b);
}
}

Fixed version (ground truth):
private void performAction(String id,int type){
  Api api=App.api;
  String where=BasicColumns.ID + "String_Node_Str";
  String[] whereArgs=new String[]{id};
  try {
switch (type) {
case Commons.ACTION_STATUS_SHOW:
{
        Status s=api.statusesShow(id,FanFouApiConfig.FORMAT_HTML,FanFouApiConfig.MODE_LITE);
        if (s == null || s.isNull()) {
          receiver.send(Commons.RESULT_CODE_FINISH,null);
        }
 else {
          if (!FanFouProvider.updateUserInfo(this,s.user)) {
            FanFouProvider.insertUserInfo(this,s.user);
          }
          FanFouProvider.updateUserInfo(this,s.user);
          Bundle data=new Bundle();
          data.putInt(Commons.EXTRA_TYPE,type);
          data.putParcelable(Commons.EXTRA_STATUS,s);
          receiver.send(Commons.RESULT_CODE_FINISH,data);
        }
      }
    break;
case Commons.ACTION_STATUS_DELETE:
{
    Status s=api.statusesDelete(id,FanFouApiConfig.FORMAT_HTML,FanFouApiConfig.MODE_LITE);
    if (s == null || s.isNull()) {
      receiver.send(Commons.RESULT_CODE_FINISH,null);
    }
 else {
      ContentResolver cr=getContentResolver();
      Uri uri=Uri.parse(StatusInfo.CONTENT_URI + "String_Node_Str" + id);
      int result=cr.delete(uri,null,null);
      Bundle data=new Bundle();
      data.putInt(Commons.EXTRA_TYPE,type);
      data.putParcelable(Commons.EXTRA_STATUS,s);
      receiver.send(Commons.RESULT_CODE_FINISH,data);
    }
  }
break;
case Commons.ACTION_STATUS_FAVORITE:
{
Status s=api.favoritesCreate(id,FanFouApiConfig.FORMAT_HTML,FanFouApiConfig.MODE_LITE);
if (s == null || s.isNull()) {
  receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
  ContentResolver cr=getContentResolver();
  ContentValues values=new ContentValues();
  values.put(StatusInfo.FAVORITED,true);
  int result=cr.update(StatusInfo.CONTENT_URI,values,where,whereArgs);
  FanFouProvider.updateUserInfo(this,s.user);
  Bundle data=new Bundle();
  data.putInt(Commons.EXTRA_TYPE,type);
  data.putParcelable(Commons.EXTRA_STATUS,s);
  receiver.send(Commons.RESULT_CODE_FINISH,data);
}
}
break;
case Commons.ACTION_STATUS_UNFAVORITE:
{
Status s=api.favoritesDelete(id,FanFouApiConfig.FORMAT_HTML,FanFouApiConfig.MODE_LITE);
if (s == null || s.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
ContentResolver cr=getContentResolver();
ContentValues values=new ContentValues();
values.put(StatusInfo.FAVORITED,false);
int result=cr.update(StatusInfo.CONTENT_URI,values,where,whereArgs);
FanFouProvider.updateUserInfo(this,s.user);
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_STATUS,s);
receiver.send(Commons.RESULT_CODE_FINISH,data);
}
}
break;
case Commons.ACTION_USER_SHOW:
{
User u=api.userShow(id,FanFouApiConfig.MODE_LITE);
if (u == null || u.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
if (!FanFouProvider.updateUserInfo(this,u)) {
FanFouProvider.insertUserInfo(this,u);
}
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_USER,u);
receiver.send(Commons.RESULT_CODE_FINISH,data);
}
}
break;
case Commons.ACTION_USER_FOLLOW:
{
User u=api.friendshipsCreate(id,FanFouApiConfig.MODE_LITE);
if (u == null || u.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
u.type=User.TYPE_FRIENDS;
getContentResolver().insert(UserInfo.CONTENT_URI,u.toContentValues());
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_USER,u);
receiver.send(Commons.RESULT_CODE_FINISH,data);
}
break;
}
case Commons.ACTION_USER_UNFOLLOW:
{
User u=api.friendshipsDelete(id,FanFouApiConfig.MODE_LITE);
if (u == null || u.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
u.type=Commons.TYPE_NONE;
ContentResolver cr=getContentResolver();
cr.delete(UserInfo.CONTENT_URI,BasicColumns.ID + "String_Node_Str",new String[]{id});
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_USER,u);
receiver.send(Commons.RESULT_CODE_FINISH,data);
cr.delete(StatusInfo.CONTENT_URI,StatusInfo.USER_ID + "String_Node_Str",new String[]{id});
}
}
break;
case Commons.ACTION_USER_BLOCK:
{
User u=api.blocksCreate(id,FanFouApiConfig.MODE_LITE);
if (u == null || u.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
getContentResolver().delete(UserInfo.CONTENT_URI,where,whereArgs);
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_USER,u);
receiver.send(Commons.RESULT_CODE_FINISH,data);
}
}
break;
case Commons.ACTION_USER_UNBLOCK:
{
User u=api.blocksDelete(id,FanFouApiConfig.MODE_LITE);
if (u == null || u.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_USER,u);
receiver.send(Commons.RESULT_CODE_FINISH,data);
}
}
break;
case Commons.ACTION_DIRECT_MESSAGE_DELETE:
{
DirectMessage dm=api.directMessagesDelete(id,FanFouApiConfig.MODE_LITE);
if (dm == null || dm.isNull()) {
receiver.send(Commons.RESULT_CODE_FINISH,null);
}
 else {
ContentResolver cr=getContentResolver();
int result=cr.delete(DirectMessageInfo.CONTENT_URI,where,whereArgs);
Bundle data=new Bundle();
data.putInt(Commons.EXTRA_TYPE,type);
data.putParcelable(Commons.EXTRA_MESSAGE,dm);
receiver.send(Commons.RESULT_CODE_FINISH,data);
}
}
break;
case Commons.ACTION_DIRECT_MESSAGE_SHOW:
break;
case Commons.ACTION_DIRECT_MESSAGE_CREATE:
break;
default :
break;
}
}
 catch (ApiException e) {
if (App.DEBUG) {
Log.e(TAG,"String_Node_Str" + id + "String_Node_Str"+ type+ e.getMessage());
}
String message=e.getMessage();
if (e.statusCode == ResponseCode.ERROR_IO_EXCEPTION || e.statusCode >= 500) {
message=getString(R.string.connection_error_msg);
}
Bundle b=new Bundle();
b.putInt(Commons.EXTRA_TYPE,type);
b.putInt(Commons.EXTRA_ERROR_CODE,e.statusCode);
b.putString(Commons.EXTRA_ERROR_MESSAGE,message);
receiver.send(Commons.RESULT_CODE_ERROR,b);
}
}