Program: 84975
Project: 84975
Buggy source:
private void updateShare(Cursor cursor,int arrayPos,boolean userAccepted){
  BluetoothOppShareInfo info=mShares.get(arrayPos);
  int statusColumn=cursor.getColumnIndexOrThrow(BluetoothShare.STATUS);
  info.mId=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare._ID));
  info.mUri=stringFromCursor(info.mUri,cursor,BluetoothShare.URI);
  info.mHint=stringFromCursor(info.mHint,cursor,BluetoothShare.FILENAME_HINT);
  info.mFilename=stringFromCursor(info.mFilename,cursor,BluetoothShare._DATA);
  info.mMimetype=stringFromCursor(info.mMimetype,cursor,BluetoothShare.MIMETYPE);
  info.mDirection=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.DIRECTION));
  info.mDestination=stringFromCursor(info.mDestination,cursor,BluetoothShare.DESTINATION);
  int newVisibility=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.VISIBILITY));
  boolean confirmed=false;
  int newConfirm=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.USER_CONFIRMATION));
  if (info.mVisibility == BluetoothShare.VISIBILITY_VISIBLE && newVisibility != BluetoothShare.VISIBILITY_VISIBLE && (BluetoothShare.isStatusCompleted(info.mStatus) || newConfirm == BluetoothShare.USER_CONFIRMATION_PENDING)) {
    mNotifier.mNotificationMgr.cancel(info.mId);
  }
  info.mVisibility=newVisibility;
  if (info.mConfirm == BluetoothShare.USER_CONFIRMATION_PENDING && newConfirm != BluetoothShare.USER_CONFIRMATION_PENDING) {
    confirmed=true;
  }
  info.mConfirm=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.USER_CONFIRMATION));
  int newStatus=cursor.getInt(statusColumn);
  if (!BluetoothShare.isStatusCompleted(info.mStatus) && BluetoothShare.isStatusCompleted(newStatus)) {
    mNotifier.mNotificationMgr.cancel(info.mId);
  }
  info.mStatus=newStatus;
  info.mTotalBytes=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.TOTAL_BYTES));
  info.mCurrentBytes=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.CURRENT_BYTES));
  info.mTimestamp=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.TIMESTAMP));
  info.mMediaScanned=(cursor.getInt(cursor.getColumnIndexOrThrow(Constants.MEDIA_SCANNED)) != Constants.MEDIA_SCANNED_NOT_SCANNED);
  if (confirmed) {
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str" + info.mId + "String_Node_Str");
    }
    if (info.isReadyToStart()) {
      BluetoothOppBatch newBatch=new BluetoothOppBatch(this,info);
      newBatch.mId=mBatchId;
      mBatchId++;
      mBatchs.add(newBatch);
      if (Constants.LOGVV) {
        Log.v(TAG,"String_Node_Str" + newBatch.mId + "String_Node_Str"+ info.mId);
      }
      if (mServerSession == null) {
        Log.e(TAG,"String_Node_Str");
        Constants.updateShareStatus(this,info.mId,BluetoothShare.STATUS_UNKNOWN_ERROR);
      }
 else {
        mServerTransfer=new BluetoothOppTransfer(this,mPowerManager,newBatch,mServerSession);
        mServerTransfer.setConfirmed();
      }
    }
  }
  int i=findBatchWithTimeStamp(info.mTimestamp);
  if (i != -1) {
    BluetoothOppBatch batch=mBatchs.get(i);
    if (batch.mStatus == Constants.BATCH_STATUS_FINISHED || batch.mStatus == Constants.BATCH_STATUS_FAILED) {
      if (Constants.LOGVV) {
        Log.v(TAG,"String_Node_Str" + batch.mId + "String_Node_Str");
      }
      if (batch.mDirection == BluetoothShare.DIRECTION_OUTBOUND) {
        if (mTransfer == null) {
          Log.e(TAG,"String_Node_Str");
        }
 else         if (batch.mId == mTransfer.getBatchId()) {
          mTransfer.stop();
        }
 else {
          Log.e(TAG,"String_Node_Str" + batch.mId + "String_Node_Str"+ mTransfer.getBatchId());
        }
      }
 else {
        if (mServerTransfer == null) {
          Log.e(TAG,"String_Node_Str");
        }
 else         if (batch.mId == mServerTransfer.getBatchId()) {
          mServerTransfer.stop();
        }
 else {
          Log.e(TAG,"String_Node_Str" + batch.mId + "String_Node_Str"+ mServerTransfer.getBatchId());
        }
      }
      removeBatch(batch);
    }
  }
}

Fixed version (ground truth):
private void updateShare(Cursor cursor,int arrayPos,boolean userAccepted){
  BluetoothOppShareInfo info=mShares.get(arrayPos);
  int statusColumn=cursor.getColumnIndexOrThrow(BluetoothShare.STATUS);
  info.mId=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare._ID));
  info.mUri=stringFromCursor(info.mUri,cursor,BluetoothShare.URI);
  info.mHint=stringFromCursor(info.mHint,cursor,BluetoothShare.FILENAME_HINT);
  info.mFilename=stringFromCursor(info.mFilename,cursor,BluetoothShare._DATA);
  info.mMimetype=stringFromCursor(info.mMimetype,cursor,BluetoothShare.MIMETYPE);
  info.mDirection=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.DIRECTION));
  info.mDestination=stringFromCursor(info.mDestination,cursor,BluetoothShare.DESTINATION);
  int newVisibility=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.VISIBILITY));
  boolean confirmed=false;
  int newConfirm=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.USER_CONFIRMATION));
  if (info.mVisibility == BluetoothShare.VISIBILITY_VISIBLE && newVisibility != BluetoothShare.VISIBILITY_VISIBLE && (BluetoothShare.isStatusCompleted(info.mStatus) || newConfirm == BluetoothShare.USER_CONFIRMATION_PENDING)) {
    mNotifier.mNotificationMgr.cancel(info.mId);
  }
  info.mVisibility=newVisibility;
  if (info.mConfirm == BluetoothShare.USER_CONFIRMATION_PENDING && newConfirm != BluetoothShare.USER_CONFIRMATION_PENDING) {
    confirmed=true;
  }
  info.mConfirm=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.USER_CONFIRMATION));
  int newStatus=cursor.getInt(statusColumn);
  if (!BluetoothShare.isStatusCompleted(info.mStatus) && BluetoothShare.isStatusCompleted(newStatus)) {
    mNotifier.mNotificationMgr.cancel(info.mId);
  }
  info.mStatus=newStatus;
  info.mTotalBytes=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.TOTAL_BYTES));
  info.mCurrentBytes=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.CURRENT_BYTES));
  info.mTimestamp=cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare.TIMESTAMP));
  info.mMediaScanned=(cursor.getInt(cursor.getColumnIndexOrThrow(Constants.MEDIA_SCANNED)) != Constants.MEDIA_SCANNED_NOT_SCANNED);
  if (confirmed) {
    if (Constants.LOGVV) {
      Log.v(TAG,"String_Node_Str" + info.mId + "String_Node_Str");
    }
    int i=findBatchWithTimeStamp(info.mTimestamp);
    BluetoothOppBatch batch=mBatchs.get(i);
    if (batch.mId == mServerTransfer.getBatchId()) {
      mServerTransfer.setConfirmed();
    }
  }
  int i=findBatchWithTimeStamp(info.mTimestamp);
  if (i != -1) {
    BluetoothOppBatch batch=mBatchs.get(i);
    if (batch.mStatus == Constants.BATCH_STATUS_FINISHED || batch.mStatus == Constants.BATCH_STATUS_FAILED) {
      if (Constants.LOGVV) {
        Log.v(TAG,"String_Node_Str" + batch.mId + "String_Node_Str");
      }
      if (batch.mDirection == BluetoothShare.DIRECTION_OUTBOUND) {
        if (mTransfer == null) {
          Log.e(TAG,"String_Node_Str");
        }
 else         if (batch.mId == mTransfer.getBatchId()) {
          mTransfer.stop();
        }
 else {
          Log.e(TAG,"String_Node_Str" + batch.mId + "String_Node_Str"+ mTransfer.getBatchId());
        }
      }
 else {
        if (mServerTransfer == null) {
          Log.e(TAG,"String_Node_Str");
        }
 else         if (batch.mId == mServerTransfer.getBatchId()) {
          mServerTransfer.stop();
        }
 else {
          Log.e(TAG,"String_Node_Str" + batch.mId + "String_Node_Str"+ mServerTransfer.getBatchId());
        }
      }
      removeBatch(batch);
    }
  }
}