Program: 93885
Project: 93885
Buggy source:
/** 
 * Overload of   {@link #enableNotify(UUID,Interval,ReadWriteListener)} for when you have characteristics with identical uuids under different services.
 */
public final ReadWriteListener.ReadWriteEvent enableNotify(final UUID serviceUuid,final UUID characteristicUuid,final Interval forceReadTimeout,final DescriptorFilter descriptorFilter,final ReadWriteListener listener){
  final ReadWriteEvent earlyOutResult=serviceMngr_device().getEarlyOutEvent(serviceUuid,characteristicUuid,Uuids.INVALID,descriptorFilter,P_Const.EMPTY_FUTURE_DATA,Type.ENABLING_NOTIFICATION,ReadWriteListener.Target.CHARACTERISTIC);
  if (earlyOutResult != null) {
    invokeReadWriteCallback(listener,earlyOutResult);
    if (earlyOutResult.status() == ReadWriteListener.Status.NO_MATCHING_TARGET || (Interval.INFINITE.equals(forceReadTimeout) || Interval.DISABLED.equals(forceReadTimeout))) {
      return earlyOutResult;
    }
  }
  final NativeBleCharacteristic characteristic=getServiceManager().getCharacteristic(serviceUuid,characteristicUuid);
  final int notifyState=m_pollMngr.getNotifyState(serviceUuid,characteristicUuid);
  final boolean shouldSendOutNotifyEnable=notifyState == P_PollManager.E_NotifyState__NOT_ENABLED && (earlyOutResult == null || earlyOutResult.status() != ReadWriteListener.Status.OPERATION_NOT_SUPPORTED);
  final ReadWriteEvent result;
  final boolean isConnected=is(CONNECTED);
  if (shouldSendOutNotifyEnable && characteristic != null && isConnected) {
    m_bondMngr.bondIfNeeded(characteristicUuid,CharacteristicEventType.ENABLE_NOTIFY);
    final P_Task_ToggleNotify task;
    if (descriptorFilter == null) {
      task=new P_Task_ToggleNotify(this,characteristic.getCharacteristic(),true,m_txnMngr.getCurrent(),listener,getOverrideReadWritePriority());
    }
 else {
      task=new P_Task_ToggleNotify(this,serviceUuid,characteristicUuid,descriptorFilter,true,m_txnMngr.getCurrent(),listener,getOverrideReadWritePriority());
    }
    queue().add(task);
    m_pollMngr.onNotifyStateChange(serviceUuid,characteristicUuid,P_PollManager.E_NotifyState__ENABLING);
    result=NULL_READWRITE_EVENT();
  }
 else   if (notifyState == P_PollManager.E_NotifyState__ENABLED) {
    if (listener != null && isConnected) {
      result=m_pollMngr.newAlreadyEnabledEvent(characteristic.getCharacteristic(),serviceUuid,characteristicUuid,descriptorFilter);
      invokeReadWriteCallback(listener,result);
    }
 else {
      result=NULL_READWRITE_EVENT();
    }
    if (!isConnected) {
      getManager().ASSERT(false,"String_Node_Str");
    }
  }
 else {
    result=NULL_READWRITE_EVENT();
  }
  m_pollMngr.startPoll(serviceUuid,characteristicUuid,descriptorFilter,forceReadTimeout.secs(),listener,true,true);
  return result;
}

Fixed version (ground truth):
/** 
 * Overload of   {@link #enableNotify(UUID,Interval,ReadWriteListener)} for when you have characteristics with identical uuids under different services.
 */
public final ReadWriteListener.ReadWriteEvent enableNotify(final UUID serviceUuid,final UUID characteristicUuid,final Interval forceReadTimeout,final DescriptorFilter descriptorFilter,final ReadWriteListener listener){
  final ReadWriteEvent earlyOutResult=serviceMngr_device().getEarlyOutEvent(serviceUuid,characteristicUuid,Uuids.INVALID,descriptorFilter,P_Const.EMPTY_FUTURE_DATA,Type.ENABLING_NOTIFICATION,ReadWriteListener.Target.CHARACTERISTIC);
  if (earlyOutResult != null) {
    invokeReadWriteCallback(listener,earlyOutResult);
    if (earlyOutResult.status() == ReadWriteListener.Status.NO_MATCHING_TARGET || (Interval.INFINITE.equals(forceReadTimeout) || Interval.DISABLED.equals(forceReadTimeout))) {
      return earlyOutResult;
    }
  }
  final BleCharacteristicWrapper characteristic=getServiceManager().getCharacteristic(serviceUuid,characteristicUuid);
  final int notifyState=m_pollMngr.getNotifyState(serviceUuid,characteristicUuid);
  final boolean shouldSendOutNotifyEnable=notifyState == P_PollManager.E_NotifyState__NOT_ENABLED && (earlyOutResult == null || earlyOutResult.status() != ReadWriteListener.Status.OPERATION_NOT_SUPPORTED);
  final ReadWriteEvent result;
  final boolean isConnected=is(CONNECTED);
  if (shouldSendOutNotifyEnable && characteristic != null && isConnected) {
    m_bondMngr.bondIfNeeded(characteristicUuid,CharacteristicEventType.ENABLE_NOTIFY);
    final P_Task_ToggleNotify task;
    if (descriptorFilter == null) {
      task=new P_Task_ToggleNotify(this,characteristic.getCharacteristic(),true,m_txnMngr.getCurrent(),listener,getOverrideReadWritePriority());
    }
 else {
      task=new P_Task_ToggleNotify(this,serviceUuid,characteristicUuid,descriptorFilter,true,m_txnMngr.getCurrent(),listener,getOverrideReadWritePriority());
    }
    queue().add(task);
    m_pollMngr.onNotifyStateChange(serviceUuid,characteristicUuid,P_PollManager.E_NotifyState__ENABLING);
    result=NULL_READWRITE_EVENT();
  }
 else   if (notifyState == P_PollManager.E_NotifyState__ENABLED) {
    if (listener != null && isConnected) {
      result=m_pollMngr.newAlreadyEnabledEvent(characteristic.getCharacteristic(),serviceUuid,characteristicUuid,descriptorFilter);
      invokeReadWriteCallback(listener,result);
    }
 else {
      result=NULL_READWRITE_EVENT();
    }
    if (!isConnected) {
      getManager().ASSERT(false,"String_Node_Str");
    }
  }
 else {
    result=NULL_READWRITE_EVENT();
  }
  m_pollMngr.startPoll(serviceUuid,characteristicUuid,descriptorFilter,forceReadTimeout.secs(),listener,true,true);
  return result;
}