Program: 84967
Project: 84967
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (action.equals(Intent.ACTION_BOOT_COMPLETED)) {
    context.startService(new Intent(context,BluetoothOppService.class));
  }
 else   if (action.equals(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION)) {
    if (BluetoothDevice.BLUETOOTH_STATE_ON == intent.getIntExtra(BluetoothIntent.BLUETOOTH_STATE,BluetoothError.ERROR)) {
      if (Constants.LOGVV) {
        Log.v(TAG,"String_Node_Str");
      }
      context.startService(new Intent(context,BluetoothOppService.class));
synchronized (this) {
        if (BluetoothOppManager.getInstance(context).mSendingFlag) {
          BluetoothOppManager.getInstance(context).mSendingFlag=false;
          Intent in1=new Intent(context,BluetoothDevicePickerActivity.class);
          in1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          context.startActivity(in1);
        }
      }
    }
  }
 else   if (action.equals(BluetoothShare.BLUETOOTH_DEVICE_SELECTED_ACTION)) {
    BluetoothOppManager mOppManager=BluetoothOppManager.getInstance(context);
    String btAddr=(String)intent.getStringExtra("String_Node_Str");
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str" + btAddr);
    }
    mOppManager.startTransfer(btAddr);
    String deviceName=mOppManager.getDeviceName(btAddr);
    String toastMsg;
    if (mOppManager.mMultipleFlag) {
      toastMsg=context.getString(R.string.bt_toast_5,Integer.toString(mOppManager.mfileNumInBatch),deviceName);
    }
 else {
      toastMsg=context.getString(R.string.bt_toast_4,deviceName);
    }
    Toast.makeText(context,toastMsg,Toast.LENGTH_SHORT).show();
  }
 else   if (action.equals(Constants.ACTION_INCOMING_FILE_CONFIRM)) {
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str");
    }
    Uri uri=intent.getData();
    Intent in=new Intent(context,BluetoothOppIncomingFileConfirmActivity.class);
    in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    in.setData(uri);
    context.startActivity(in);
    NotificationManager notMgr=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
    if (notMgr != null) {
      notMgr.cancel((int)ContentUris.parseId(intent.getData()));
      Log.v(TAG,"String_Node_Str");
    }
  }
 else   if (action.equals(BluetoothShare.INCOMING_FILE_CONFIRMATION_REQUEST_ACTION)) {
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str");
    }
    Toast.makeText(context,context.getString(R.string.incoming_file_toast_msg),Toast.LENGTH_SHORT).show();
  }
 else   if (action.equals(Constants.ACTION_OPEN) || action.equals(Constants.ACTION_LIST)) {
    if (Constants.LOGVV) {
      if (action.equals(Constants.ACTION_OPEN)) {
        Log.v(TAG,"String_Node_Str" + intent.getData());
      }
 else {
        Log.v(TAG,"String_Node_Str" + intent.getData());
      }
    }
    BluetoothOppTransferInfo transInfo=new BluetoothOppTransferInfo();
    Uri uri=intent.getData();
    transInfo=BluetoothOppUtility.queryRecord(context,uri);
    if (transInfo == null) {
      if (Constants.LOGVV) {
        Log.e(TAG,"String_Node_Str");
      }
      return;
    }
    if (transInfo.mDirection == BluetoothShare.DIRECTION_INBOUND && BluetoothShare.isStatusSuccess(transInfo.mStatus)) {
      BluetoothOppUtility.openReceivedFile(context,transInfo.mFileName,transInfo.mFileType,transInfo.mTimeStamp);
      BluetoothOppUtility.updateVisibilityToHidden(context,uri);
    }
 else {
      Intent in=new Intent(context,BluetoothOppTransferActivity.class);
      in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      in.setData(uri);
      context.startActivity(in);
    }
    NotificationManager notMgr=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
    if (notMgr != null) {
      notMgr.cancel((int)ContentUris.parseId(intent.getData()));
      Log.v(TAG,"String_Node_Str");
    }
  }
 else   if (action.equals(Constants.ACTION_HIDE)) {
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str" + intent.getData());
    }
    Cursor cursor=context.getContentResolver().query(intent.getData(),null,null,null,null);
    if (cursor != null) {
      if (cursor.moveToFirst()) {
        int statusColumn=cursor.getColumnIndexOrThrow(BluetoothShare.STATUS);
        int status=cursor.getInt(statusColumn);
        int visibilityColumn=cursor.getColumnIndexOrThrow(BluetoothShare.VISIBILITY);
        int visibility=cursor.getInt(visibilityColumn);
        int userConfirmationColumn=cursor.getColumnIndexOrThrow(BluetoothShare.USER_CONFIRMATION);
        int userConfirmation=cursor.getInt(userConfirmationColumn);
        if ((BluetoothShare.isStatusCompleted(status) || (userConfirmation == BluetoothShare.USER_CONFIRMATION_PENDING)) && visibility == BluetoothShare.VISIBILITY_VISIBLE) {
          ContentValues values=new ContentValues();
          values.put(BluetoothShare.VISIBILITY,BluetoothShare.VISIBILITY_HIDDEN);
          context.getContentResolver().update(intent.getData(),values,null,null);
          if (Constants.LOGVV) {
            Log.v(TAG,"String_Node_Str");
          }
        }
      }
      cursor.close();
    }
  }
 else   if (action.equals(BluetoothShare.TRANSFER_COMPLETED_ACTION)) {
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str" + intent.getData());
    }
    String toastMsg=null;
    BluetoothOppTransferInfo transInfo=new BluetoothOppTransferInfo();
    transInfo=BluetoothOppUtility.queryRecord(context,intent.getData());
    if (transInfo == null) {
      if (Constants.LOGVV) {
        Log.e(TAG,"String_Node_Str");
      }
      return;
    }
    if (BluetoothShare.isStatusSuccess(transInfo.mStatus)) {
      if (transInfo.mDirection == BluetoothShare.DIRECTION_OUTBOUND) {
        toastMsg=context.getString(R.string.notification_sent,transInfo.mFileName);
      }
 else       if (transInfo.mDirection == BluetoothShare.DIRECTION_INBOUND) {
        toastMsg=context.getString(R.string.notification_received,transInfo.mFileName);
      }
    }
 else     if (BluetoothShare.isStatusError(transInfo.mStatus)) {
      if (transInfo.mDirection == BluetoothShare.DIRECTION_OUTBOUND) {
        toastMsg=context.getString(R.string.notification_sent_fail,transInfo.mFileName);
      }
 else       if (transInfo.mDirection == BluetoothShare.DIRECTION_INBOUND) {
        toastMsg=context.getString(R.string.download_fail_line1);
      }
    }
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str" + toastMsg);
    }
    if (toastMsg != null) {
      Toast.makeText(context,toastMsg,Toast.LENGTH_SHORT).show();
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (action.equals(Intent.ACTION_BOOT_COMPLETED)) {
    context.startService(new Intent(context,BluetoothOppService.class));
  }
 else   if (action.equals(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION)) {
    if (BluetoothDevice.BLUETOOTH_STATE_ON == intent.getIntExtra(BluetoothIntent.BLUETOOTH_STATE,BluetoothError.ERROR)) {
      if (Constants.LOGVV) {
        Log.v(TAG,"String_Node_Str");
      }
      context.startService(new Intent(context,BluetoothOppService.class));
synchronized (this) {
        if (BluetoothOppManager.getInstance(context).mSendingFlag) {
          BluetoothOppManager.getInstance(context).mSendingFlag=false;
          Intent in1=new Intent(context,BluetoothDevicePickerActivity.class);
          in1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          context.startActivity(in1);
        }
      }
    }
  }
 else   if (action.equals(BluetoothShare.BLUETOOTH_DEVICE_SELECTED_ACTION)) {
    BluetoothOppManager mOppManager=BluetoothOppManager.getInstance(context);
    String btAddr=(String)intent.getStringExtra("String_Node_Str");
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str" + btAddr);
    }
    mOppManager.startTransfer(btAddr);
    String deviceName=mOppManager.getDeviceName(btAddr);
    String toastMsg;
    if (mOppManager.mMultipleFlag) {
      toastMsg=context.getString(R.string.bt_toast_5,Integer.toString(mOppManager.mfileNumInBatch),deviceName);
    }
 else {
      toastMsg=context.getString(R.string.bt_toast_4,deviceName);
    }
    Toast.makeText(context,toastMsg,Toast.LENGTH_SHORT).show();
  }
 else   if (action.equals(Constants.ACTION_INCOMING_FILE_CONFIRM)) {
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str");
    }
    Uri uri=intent.getData();
    Intent in=new Intent(context,BluetoothOppIncomingFileConfirmActivity.class);
    in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    in.setData(uri);
    context.startActivity(in);
    NotificationManager notMgr=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
    if (notMgr != null) {
      notMgr.cancel((int)ContentUris.parseId(intent.getData()));
      Log.v(TAG,"String_Node_Str");
    }
  }
 else   if (action.equals(BluetoothShare.INCOMING_FILE_CONFIRMATION_REQUEST_ACTION)) {
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str");
    }
    Toast.makeText(context,context.getString(R.string.incoming_file_toast_msg),Toast.LENGTH_SHORT).show();
  }
 else   if (action.equals(Constants.ACTION_OPEN) || action.equals(Constants.ACTION_LIST)) {
    if (Constants.LOGVV) {
      if (action.equals(Constants.ACTION_OPEN)) {
        Log.v(TAG,"String_Node_Str" + intent.getData());
      }
 else {
        Log.v(TAG,"String_Node_Str" + intent.getData());
      }
    }
    BluetoothOppTransferInfo transInfo=new BluetoothOppTransferInfo();
    Uri uri=intent.getData();
    transInfo=BluetoothOppUtility.queryRecord(context,uri);
    if (transInfo == null) {
      if (Constants.LOGVV) {
        Log.e(TAG,"String_Node_Str");
      }
      return;
    }
    if (transInfo.mDirection == BluetoothShare.DIRECTION_INBOUND && BluetoothShare.isStatusSuccess(transInfo.mStatus)) {
      BluetoothOppUtility.openReceivedFile(context,transInfo.mFileName,transInfo.mFileType,transInfo.mTimeStamp);
      BluetoothOppUtility.updateVisibilityToHidden(context,uri);
    }
 else {
      Intent in=new Intent(context,BluetoothOppTransferActivity.class);
      in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      in.setData(uri);
      context.startActivity(in);
    }
    NotificationManager notMgr=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
    if (notMgr != null) {
      notMgr.cancel((int)ContentUris.parseId(intent.getData()));
      if (Constants.LOGVV) {
        Log.v(TAG,"String_Node_Str");
      }
    }
  }
 else   if (action.equals(Constants.ACTION_HIDE)) {
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str" + intent.getData());
    }
    Cursor cursor=context.getContentResolver().query(intent.getData(),null,null,null,null);
    if (cursor != null) {
      if (cursor.moveToFirst()) {
        int statusColumn=cursor.getColumnIndexOrThrow(BluetoothShare.STATUS);
        int status=cursor.getInt(statusColumn);
        int visibilityColumn=cursor.getColumnIndexOrThrow(BluetoothShare.VISIBILITY);
        int visibility=cursor.getInt(visibilityColumn);
        int userConfirmationColumn=cursor.getColumnIndexOrThrow(BluetoothShare.USER_CONFIRMATION);
        int userConfirmation=cursor.getInt(userConfirmationColumn);
        if ((BluetoothShare.isStatusCompleted(status) || (userConfirmation == BluetoothShare.USER_CONFIRMATION_PENDING)) && visibility == BluetoothShare.VISIBILITY_VISIBLE) {
          ContentValues values=new ContentValues();
          values.put(BluetoothShare.VISIBILITY,BluetoothShare.VISIBILITY_HIDDEN);
          context.getContentResolver().update(intent.getData(),values,null,null);
          if (Constants.LOGVV) {
            Log.v(TAG,"String_Node_Str");
          }
        }
      }
      cursor.close();
    }
  }
 else   if (action.equals(BluetoothShare.TRANSFER_COMPLETED_ACTION)) {
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str" + intent.getData());
    }
    String toastMsg=null;
    BluetoothOppTransferInfo transInfo=new BluetoothOppTransferInfo();
    transInfo=BluetoothOppUtility.queryRecord(context,intent.getData());
    if (transInfo == null) {
      if (Constants.LOGVV) {
        Log.e(TAG,"String_Node_Str");
      }
      return;
    }
    if (BluetoothShare.isStatusSuccess(transInfo.mStatus)) {
      if (transInfo.mDirection == BluetoothShare.DIRECTION_OUTBOUND) {
        toastMsg=context.getString(R.string.notification_sent,transInfo.mFileName);
      }
 else       if (transInfo.mDirection == BluetoothShare.DIRECTION_INBOUND) {
        toastMsg=context.getString(R.string.notification_received,transInfo.mFileName);
      }
    }
 else     if (BluetoothShare.isStatusError(transInfo.mStatus)) {
      if (transInfo.mDirection == BluetoothShare.DIRECTION_OUTBOUND) {
        toastMsg=context.getString(R.string.notification_sent_fail,transInfo.mFileName);
      }
 else       if (transInfo.mDirection == BluetoothShare.DIRECTION_INBOUND) {
        toastMsg=context.getString(R.string.download_fail_line1);
      }
    }
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str" + toastMsg);
    }
    if (toastMsg != null) {
      Toast.makeText(context,toastMsg,Toast.LENGTH_SHORT).show();
    }
  }
}