Program: 93950
Project: 93950
Buggy source:
private void nextStage(){
  if (m_currentEvent.stage() == BluetoothEnablerListener.Stage.START) {
    if (m_bleManager.isBleSupported() && !m_bleManager.is(BleManagerState.ON)) {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.NEEDS_ENABLING);
    }
 else {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.ALREADY_ENABLED);
    }
  }
 else   if (m_currentStage == BluetoothEnablerListener.Stage.BLUETOOTH) {
    if (m_currentEvent.status() == BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG) {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG);
    }
 else     if (m_currentEvent.status() == BluetoothEnablerListener.Status.SKIPPED) {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.SKIPPED);
    }
 else     if (m_bleManager.isBleSupported() && !m_bleManager.is(BleManagerState.ON)) {
      Activity resultActivity=m_lastPlease.m_activity != null ? m_lastPlease.m_activity : m_passedActivity;
      m_bleManager.turnOnWithIntent(resultActivity,m_lastPlease.m_requestCode);
    }
 else {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.ALREADY_ENABLED);
    }
  }
 else   if (m_currentStage == BluetoothEnablerListener.Stage.LOCATION_PERMISSION) {
    if (!Utils.isMarshmallow()) {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.NOT_NEEDED);
    }
 else {
      if (m_currentEvent.status() == BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG) {
        updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG);
      }
 else       if (m_currentEvent.status() == BluetoothEnablerListener.Status.SKIPPED) {
        updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.SKIPPED);
      }
 else       if (!m_bleManager.isLocationEnabledForScanning_byRuntimePermissions()) {
        Activity resultActivity=m_lastPlease.m_activity != null ? m_lastPlease.m_activity : m_passedActivity;
        m_bleManager.turnOnLocationWithIntent_forPermissions(resultActivity,m_lastPlease.m_requestCode);
      }
 else {
        updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.ALREADY_ENABLED);
      }
    }
  }
 else   if (m_currentStage == BluetoothEnablerListener.Stage.LOCATION_SERVICES) {
    if (m_currentEvent.status() == BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG) {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG);
    }
 else     if (m_currentEvent.status() == BluetoothEnablerListener.Status.SKIPPED) {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.SKIPPED);
    }
 else     if (!m_bleManager.isLocationEnabledForScanning_byOsServices()) {
      Activity resultActivity=m_lastPlease.m_activity != null ? m_lastPlease.m_activity : m_passedActivity;
      m_bleManager.turnOnLocationWithIntent_forOsServices(resultActivity,m_lastPlease.m_requestCode);
    }
 else {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.ALREADY_ENABLED);
    }
  }
}

Fixed version (ground truth):
private void nextStage(BluetoothEnablerListener.BluetoothEnablerEvent nextEvent){
  if (m_currentStage == BluetoothEnablerListener.Stage.START) {
    if (m_bleManager.isBleSupported() && !m_bleManager.is(BleManagerState.ON)) {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.NEEDS_ENABLING);
    }
 else {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.ALREADY_ENABLED);
    }
  }
 else   if (m_currentStage == BluetoothEnablerListener.Stage.BLUETOOTH) {
    if (nextEvent.status() == BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG) {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG);
    }
 else     if (nextEvent.status() == BluetoothEnablerListener.Status.SKIPPED) {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.SKIPPED);
    }
 else     if (m_bleManager.isBleSupported() && !m_bleManager.is(BleManagerState.ON)) {
      Activity resultActivity=m_lastPlease.m_activity != null ? m_lastPlease.m_activity : m_passedActivity;
      m_bleManager.turnOnWithIntent(resultActivity,m_lastPlease.m_requestCode);
    }
 else {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.ALREADY_ENABLED);
    }
  }
 else   if (m_currentStage == BluetoothEnablerListener.Stage.LOCATION_PERMISSION) {
    if (!Utils.isMarshmallow()) {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.NOT_NEEDED);
    }
 else {
      if (nextEvent.status() == BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG) {
        updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG);
      }
 else       if (nextEvent.status() == BluetoothEnablerListener.Status.SKIPPED) {
        updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.SKIPPED);
      }
 else       if (!m_bleManager.isLocationEnabledForScanning_byRuntimePermissions()) {
        Activity resultActivity=m_lastPlease.m_activity != null ? m_lastPlease.m_activity : m_passedActivity;
        m_bleManager.turnOnLocationWithIntent_forPermissions(resultActivity,m_lastPlease.m_requestCode);
      }
 else {
        updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.ALREADY_ENABLED);
      }
    }
  }
 else   if (m_currentStage == BluetoothEnablerListener.Stage.LOCATION_SERVICES) {
    if (nextEvent.status() == BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG) {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG);
    }
 else     if (nextEvent.status() == BluetoothEnablerListener.Status.SKIPPED) {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.SKIPPED);
    }
 else     if (!m_bleManager.isLocationEnabledForScanning_byOsServices()) {
      Activity resultActivity=m_lastPlease.m_activity != null ? m_lastPlease.m_activity : m_passedActivity;
      m_bleManager.turnOnLocationWithIntent_forOsServices(resultActivity,m_lastPlease.m_requestCode);
    }
 else {
      updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status.ALREADY_ENABLED);
    }
  }
}