nus-yam/ex-repair huggingface dataset:
Program: 93921
Project: 93921
Buggy source:
private boolean tryClassicDiscovery(final PA_StateTracker.E_Intent intent,final boolean suppressUhOh){
  if (m_manager.m_config.revertToClassicDiscoveryIfNeeded) {
    if (false == startClassicDiscovery()) {
      m_manager.getLogger().w("String_Node_Str");
      fail();
      m_manager.uhOh(BleManager.UhOhListener.UhOh.CLASSIC_DISCOVERY_FAILED);
      return false;
    }
 else {
      if (false == suppressUhOh) {
        m_manager.uhOh(BleManager.UhOhListener.UhOh.START_BLE_SCAN_FAILED__USING_CLASSIC);
      }
      m_mode=Mode_CLASSIC;
      m_manager.getStateTracker().update(PA_StateTracker.E_Intent.INTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE,BleManagerState.SCANNING,true,SCANNING_PAUSED,false,STARTING_SCAN,false);
      return true;
    }
  }
 else {
    fail();
    m_manager.uhOh(BleManager.UhOhListener.UhOh.START_BLE_SCAN_FAILED);
    return false;
  }
}

Fixed version (ground truth):
private boolean tryClassicDiscovery(final PA_StateTracker.E_Intent intent,final boolean suppressUhOh){
  if (m_manager.m_config.revertToClassicDiscoveryIfNeeded) {
    if (false == startClassicDiscovery()) {
      m_manager.getLogger().w("String_Node_Str");
      fail();
      m_manager.uhOh(BleManager.UhOhListener.UhOh.CLASSIC_DISCOVERY_FAILED);
      return false;
    }
 else {
      if (false == suppressUhOh) {
        m_manager.uhOh(BleManager.UhOhListener.UhOh.START_BLE_SCAN_FAILED__USING_CLASSIC);
      }
      m_mode=Mode_CLASSIC;
      setStateToScanning();
      return true;
    }
  }
 else {
    fail();
    m_manager.uhOh(BleManager.UhOhListener.UhOh.START_BLE_SCAN_FAILED);
    return false;
  }
}
Program: 93922
Project: 93922
Buggy source:
private boolean startScanPreLollipop(PA_StateTracker.E_Intent intent){
  int retryCount=0;
  while (retryCount <= m_retryCountMax) {
    final boolean success=startLeScan();
    if (success) {
      if (retryCount >= 1) {
      }
      break;
    }
    retryCount++;
    if (retryCount <= m_retryCountMax) {
      if (retryCount == 1) {
        m_manager.getLogger().w("String_Node_Str");
        stopLeScan();
      }
 else {
        m_manager.getLogger().w("String_Node_Str" + retryCount + "String_Node_Str");
      }
    }
  }
  if (retryCount > m_retryCountMax) {
    m_manager.getLogger().w("String_Node_Str");
    tryClassicDiscovery(intent,false);
    return true;
  }
 else {
    if (retryCount > 0) {
      m_manager.getLogger().w("String_Node_Str" + (retryCount + 1) + "String_Node_Str");
    }
    if (m_manager.m_config.enableCrashResolver) {
      m_manager.getCrashResolver().start();
    }
    m_mode=Mode_BLE;
    m_manager.getStateTracker().update(PA_StateTracker.E_Intent.INTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE,BleManagerState.SCANNING,true,SCANNING_PAUSED,false,STARTING_SCAN,false);
    return true;
  }
}

Fixed version (ground truth):
private boolean startScanPreLollipop(PA_StateTracker.E_Intent intent){
  int retryCount=0;
  while (retryCount <= m_retryCountMax) {
    final boolean success=startLeScan();
    if (success) {
      if (retryCount >= 1) {
      }
      break;
    }
    retryCount++;
    if (retryCount <= m_retryCountMax) {
      if (retryCount == 1) {
        m_manager.getLogger().w("String_Node_Str");
        stopLeScan();
      }
 else {
        m_manager.getLogger().w("String_Node_Str" + retryCount + "String_Node_Str");
      }
    }
  }
  if (retryCount > m_retryCountMax) {
    m_manager.getLogger().w("String_Node_Str");
    tryClassicDiscovery(intent,false);
    return true;
  }
 else {
    if (retryCount > 0) {
      m_manager.getLogger().w("String_Node_Str" + (retryCount + 1) + "String_Node_Str");
    }
    if (m_manager.m_config.enableCrashResolver) {
      m_manager.getCrashResolver().start();
    }
    m_mode=Mode_BLE;
    setStateToScanning();
    return true;
  }
}
Program: 93923
Project: 93923
Buggy source:
private boolean startScanPostLollipop(double scanTime,boolean m_isPoll){
  int nativePowerMode;
  BleScanPower power=m_manager.m_config.scanPower;
  if (power == BleScanPower.AUTO) {
    if (m_manager.isForegrounded()) {
      if (m_isPoll || scanTime == Double.POSITIVE_INFINITY) {
        power=BleScanPower.MEDIUM_POWER;
        nativePowerMode=BleScanPower.MEDIUM_POWER.getNativeMode();
      }
 else {
        power=BleScanPower.HIGH_POWER;
        nativePowerMode=BleScanPower.HIGH_POWER.getNativeMode();
      }
    }
 else {
      power=BleScanPower.LOW_POWER;
      nativePowerMode=BleScanPower.LOW_POWER.getNativeMode();
    }
  }
 else {
    if (power == BleScanPower.VERY_LOW_POWER) {
      if (!Utils.isMarshmallow()) {
        m_manager.getLogger().e("String_Node_Str");
        power=BleScanPower.LOW_POWER;
      }
    }
    nativePowerMode=power.getNativeMode();
  }
  if (Utils.isMarshmallow()) {
    startMScan(nativePowerMode);
  }
 else {
    startLScan(nativePowerMode);
  }
  m_mode=Mode_BLE_POST_LOLLIPOP;
  mCurrentPower.set(power);
  m_manager.getStateTracker().update(PA_StateTracker.E_Intent.INTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE,BleManagerState.SCANNING,true,SCANNING_PAUSED,false,STARTING_SCAN,false);
  return true;
}

Fixed version (ground truth):
private boolean startScanPostLollipop(double scanTime,boolean m_isPoll){
  int nativePowerMode;
  BleScanPower power=m_manager.m_config.scanPower;
  if (power == BleScanPower.AUTO) {
    if (m_manager.isForegrounded()) {
      if (m_isPoll || scanTime == Double.POSITIVE_INFINITY) {
        power=BleScanPower.MEDIUM_POWER;
        nativePowerMode=BleScanPower.MEDIUM_POWER.getNativeMode();
      }
 else {
        power=BleScanPower.HIGH_POWER;
        nativePowerMode=BleScanPower.HIGH_POWER.getNativeMode();
      }
    }
 else {
      power=BleScanPower.LOW_POWER;
      nativePowerMode=BleScanPower.LOW_POWER.getNativeMode();
    }
  }
 else {
    if (power == BleScanPower.VERY_LOW_POWER) {
      if (!Utils.isMarshmallow()) {
        m_manager.getLogger().e("String_Node_Str");
        power=BleScanPower.LOW_POWER;
      }
    }
    nativePowerMode=power.getNativeMode();
  }
  if (Utils.isMarshmallow()) {
    startMScan(nativePowerMode);
  }
 else {
    startLScan(nativePowerMode);
  }
  m_mode=Mode_BLE_POST_LOLLIPOP;
  mCurrentPower.set(power);
  setStateToScanning();
  return true;
}
Program: 93924
Project: 93924
Buggy source:
private void stopScan_private(boolean stopping){
switch (mCurrentApi.get()) {
case CLASSIC:
    stopClassicDiscovery();
  break;
case POST_LOLLIPOP:
if (Utils.isLollipop()) {
  stopScanPostLollipop();
}
 else {
  stopScanPreLollipop();
}
break;
case AUTO:
case PRE_LOLLIPOP:
stopScanPreLollipop();
}
if (stopping) {
m_manager.getStateTracker().update(PA_StateTracker.E_Intent.INTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE,SCANNING,false);
}
 else {
m_manager.getStateTracker().update(PA_StateTracker.E_Intent.INTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE,SCANNING,false,SCANNING_PAUSED,true);
}
}

Fixed version (ground truth):
private void stopScan_private(boolean stopping){
switch (mCurrentApi.get()) {
case CLASSIC:
    stopClassicDiscovery();
  break;
case POST_LOLLIPOP:
if (Utils.isLollipop()) {
  stopScanPostLollipop();
}
 else {
  stopScanPreLollipop();
}
break;
case AUTO:
case PRE_LOLLIPOP:
stopScanPreLollipop();
}
if (stopping) {
m_manager.getStateTracker().update(PA_StateTracker.E_Intent.INTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE,SCANNING,false,BOOST_SCANNING,false);
}
 else {
m_manager.getStateTracker().update(PA_StateTracker.E_Intent.INTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE,SCANNING,false,SCANNING_PAUSED,true,BOOST_SCANNING,false);
}
}
Program: 93925
Project: 93925
Buggy source:
public final boolean classicBoost(double scanTime){
  m_classicBoost=true;
  m_classicLength=scanTime;
  return tryClassicDiscovery(PA_StateTracker.E_Intent.INTENTIONAL,true);
}

Fixed version (ground truth):
public final boolean classicBoost(double scanTime){
  m_classicLength=scanTime;
  return startClassicBoost();
}
Program: 93926
Project: 93926
Buggy source:
public final boolean startScan(PA_StateTracker.E_Intent intent,double scanTime,boolean m_isPoll){
switch (m_manager.m_config.scanApi) {
case CLASSIC:
    mCurrentApi.set(BleScanApi.CLASSIC);
  return tryClassicDiscovery(intent,true);
case POST_LOLLIPOP:
if (isBleScanReady()) {
  if (Utils.isLollipop()) {
    mCurrentApi.set(BleScanApi.POST_LOLLIPOP);
    return startScanPostLollipop(scanTime,m_isPoll);
  }
 else {
    m_manager.getLogger().e("String_Node_Str");
    mCurrentApi.set(BleScanApi.PRE_LOLLIPOP);
    return startScanPreLollipop(intent);
  }
}
 else {
  m_manager.getLogger().e("String_Node_Str");
  mCurrentApi.set(BleScanApi.CLASSIC);
  return startClassicDiscovery();
}
case AUTO:
case PRE_LOLLIPOP:
mCurrentApi.set(BleScanApi.PRE_LOLLIPOP);
return startScanPreLollipop(intent);
default :
return false;
}
}

Fixed version (ground truth):
public final boolean startScan(PA_StateTracker.E_Intent intent,double scanTime,boolean m_isPoll){
switch (m_manager.m_config.scanApi) {
case CLASSIC:
    mCurrentApi.set(BleScanApi.CLASSIC);
  return tryClassicDiscovery(intent,true);
case POST_LOLLIPOP:
if (isBleScanReady()) {
  if (Utils.isLollipop()) {
    mCurrentApi.set(BleScanApi.POST_LOLLIPOP);
    return startScanPostLollipop(scanTime,m_isPoll);
  }
 else {
    m_manager.getLogger().e("String_Node_Str");
    mCurrentApi.set(BleScanApi.PRE_LOLLIPOP);
    return startScanPreLollipop(intent);
  }
}
 else {
  m_manager.getLogger().e("String_Node_Str");
  mCurrentApi.set(BleScanApi.CLASSIC);
  return tryClassicDiscovery(intent,true);
}
case AUTO:
case PRE_LOLLIPOP:
mCurrentApi.set(BleScanApi.PRE_LOLLIPOP);
return startScanPreLollipop(intent);
default :
return false;
}
}
Program: 93928
Project: 93928
Buggy source:
/** 
 * Wrapper for   {@link BluetoothGatt#requestConnectionPriority(int)} which attempts to change the connection priority for a given connection.This will eventually update the value returned by  {@link #getConnectionPriority()} but it is notinstantaneous. When we receive confirmation from the native stack then this value will be updated. The device must be  {@link BleDeviceState#CONNECTED} forthis call to succeed.
 * @see #setConnectionPriority(BleConnectionPriority,ReadWriteListener)
 * @see #getConnectionPriority()
 * @return (see similar comment for return value of {@link #connect(BleTransaction.Auth,BleTransaction.Init,StateListener,ConnectionFailListener)}).
 */
@Advanced public @Nullable(Prevalence.NEVER) ReadWriteListener.ReadWriteEvent setConnectionPriority(final BleConnectionPriority connectionPriority,final ReadWriteListener listener){
  return setConnectionPriority_private(connectionPriority,listener,getOverrideReadWritePriority());
}

Fixed version (ground truth):
/** 
 * Wrapper for   {@link BluetoothGatt#requestConnectionPriority(int)} which attempts to change the connection priority for a given connection.This will eventually update the value returned by  {@link #getConnectionPriority()} but it is notinstantaneous. When we receive confirmation from the native stack then this value will be updated. The device must be  {@link BleDeviceState#CONNECTED} forthis call to succeed.
 * @return (see similar comment for return value of {@link #connect(BleTransaction.Auth,BleTransaction.Init,StateListener,ConnectionFailListener)}).
 * @see #setConnectionPriority(BleConnectionPriority,ReadWriteListener)
 * @see #getConnectionPriority()
 */
@Advanced public @Nullable(Prevalence.NEVER) ReadWriteListener.ReadWriteEvent setConnectionPriority(final BleConnectionPriority connectionPriority,final ReadWriteListener listener){
  return setConnectionPriority_private(connectionPriority,listener,getOverrideReadWritePriority());
}
Program: 93929
Project: 93929
Buggy source:
/** 
 * Returns the cached data from the lastest successful read or notify received for a given uuid. Basically if you receive a   {@link ReadWriteListener.ReadWriteEvent} for which {@link ReadWriteListener.ReadWriteEvent#isRead()}and   {@link ReadWriteListener.ReadWriteEvent#wasSuccess()} both return <code>true</code> then {@link ReadWriteListener.ReadWriteEvent#data()}, will be cached and is retrievable by this method.
 * @see BleNodeConfig.HistoricalDataLogFilter
 * @see BleNodeConfig.DefaultHistoricalDataLogFilter
 * @return The cached value from a previous read or notify, or {@link HistoricalData#NULL} otherwise.
 */
@Advanced public @Nullable(Nullable.Prevalence.NEVER) HistoricalData getHistoricalData_latest(final UUID uuid){
  return getHistoricalData_atOffset(uuid,getHistoricalDataCount(uuid) - 1);
}

Fixed version (ground truth):
/** 
 * Returns the cached data from the lastest successful read or notify received for a given uuid. Basically if you receive a   {@link ReadWriteListener.ReadWriteEvent} for which {@link ReadWriteListener.ReadWriteEvent#isRead()}and   {@link ReadWriteListener.ReadWriteEvent#wasSuccess()} both return <code>true</code> then {@link ReadWriteListener.ReadWriteEvent#data()}, will be cached and is retrievable by this method.
 * @return The cached value from a previous read or notify, or {@link HistoricalData#NULL} otherwise.
 * @see BleNodeConfig.HistoricalDataLogFilter
 * @see BleNodeConfig.DefaultHistoricalDataLogFilter
 */
@Advanced public @Nullable(Nullable.Prevalence.NEVER) HistoricalData getHistoricalData_latest(final UUID uuid){
  return getHistoricalData_atOffset(uuid,getHistoricalDataCount(uuid) - 1);
}
Program: 93932
Project: 93932
Buggy source:
/** 
 * Provides all historical data through the "for each" provided within the range provided.
 * @see BleNodeConfig.HistoricalDataLogFilter
 * @see BleNodeConfig.DefaultHistoricalDataLogFilter
 * @return <code>true</code> if there are any entries, <code>false</code> otherwise.
 */
@Advanced public boolean getHistoricalData_forEach(final UUID uuid,final EpochTimeRange range,final ForEach_Breakable<HistoricalData> forEach){
  if (isNull())   return false;
  return m_historicalDataMngr.doForEach(uuid,EpochTimeRange.denull(range),forEach);
}

Fixed version (ground truth):
/** 
 * Provides all historical data through the "for each" provided within the range provided.
 * @return <code>true</code> if there are any entries, <code>false</code> otherwise.
 * @see BleNodeConfig.HistoricalDataLogFilter
 * @see BleNodeConfig.DefaultHistoricalDataLogFilter
 */
@Advanced public boolean getHistoricalData_forEach(final UUID uuid,final EpochTimeRange range,final ForEach_Breakable<HistoricalData> forEach){
  if (isNull())   return false;
  return m_historicalDataMngr.doForEach(uuid,EpochTimeRange.denull(range),forEach);
}
Program: 93933
Project: 93933
Buggy source:
void invokeReadWriteCallback(final ReadWriteListener listener_nullable,final ReadWriteListener.ReadWriteEvent event){
  if (event.wasSuccess() && event.isRead() && event.target() == ReadWriteListener.Target.CHARACTERISTIC) {
    final EpochTime timestamp=new EpochTime();
    final BleNodeConfig.HistoricalDataLogFilter.Source source=event.type().toHistoricalDataSource();
    m_historicalDataMngr.add_single(event.charUuid(),event.data(),timestamp,source);
  }
  m_txnMngr.onReadWriteResult(event);
  if (listener_nullable != null) {
    postEvent(listener_nullable,event);
  }
  if (m_defaultReadWriteListener != null) {
    postEvent(m_defaultReadWriteListener,event);
  }
  if (getManager() != null && getManager().m_defaultReadWriteListener != null) {
    postEvent(getManager().m_defaultReadWriteListener,event);
  }
  if (m_defaultNotificationListener != null && (event.type().isNotification() || event.type() == Type.DISABLING_NOTIFICATION || event.type() == Type.ENABLING_NOTIFICATION)) {
    m_defaultNotificationListener.onEvent(fromReadWriteEvent(event));
  }
  m_txnMngr.onReadWriteResultCallbacksCalled();
}

Fixed version (ground truth):
void invokeReadWriteCallback(final ReadWriteListener listener_nullable,final ReadWriteListener.ReadWriteEvent event){
  if (event.wasSuccess() && event.isRead() && event.target() == ReadWriteListener.Target.CHARACTERISTIC) {
    final EpochTime timestamp=new EpochTime();
    final BleNodeConfig.HistoricalDataLogFilter.Source source=event.type().toHistoricalDataSource();
    m_historicalDataMngr.add_single(event.charUuid(),event.data(),timestamp,source);
  }
  m_txnMngr.onReadWriteResult(event);
  if (listener_nullable != null) {
    postEvent(listener_nullable,event);
  }
  if (m_defaultReadWriteListener != null) {
    postEvent(m_defaultReadWriteListener,event);
  }
  if (getManager() != null && getManager().m_defaultReadWriteListener != null) {
    postEvent(getManager().m_defaultReadWriteListener,event);
  }
  if (m_defaultNotificationListener != null && (event.type().isNotification() || event.type() == Type.DISABLING_NOTIFICATION || event.type() == Type.ENABLING_NOTIFICATION)) {
    postEvent(m_defaultNotificationListener,fromReadWriteEvent(event));
  }
  m_txnMngr.onReadWriteResultCallbacksCalled();
}
Program: 93934
Project: 93934
Buggy source:
public void tryExecuting(){
  if (m_state == PE_TaskState.ARMED) {
{
      if (m_softlyCancelled) {
        softlyCancel();
        return;
      }
      if (isExecutable()) {
        setState(PE_TaskState.EXECUTING);
        execute_wrapper();
        return;
      }
 else {
        onNotExecutable();
        return;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if   {@link P_TaskQueue#print()} ends up getting called.
 */
public boolean tryExecuting(){
  if (m_state == PE_TaskState.ARMED) {
{
      if (m_softlyCancelled) {
        softlyCancel();
        return false;
      }
      if (isExecutable()) {
        boolean printCalled=setState(PE_TaskState.EXECUTING);
        execute_wrapper();
        return printCalled;
      }
 else {
        onNotExecutable();
      }
    }
  }
  return false;
}
Program: 93935
Project: 93935
Buggy source:
private void setState(PE_TaskState newState){
  if (!m_manager.ASSERT(newState != m_state))   return;
  m_state=newState;
  if (getLogger().isEnabled()) {
    if (m_state.isEndingState()) {
      String logText=this.toString();
      if (m_queue != null) {
        logText+="String_Node_Str" + m_queue.getUpdateCount();
      }
      getLogger().i(logText);
    }
 else     if (m_state == PE_TaskState.EXECUTING) {
      getQueue().print();
    }
  }
  if (m_stateListener != null)   m_stateListener.onStateChange(this,m_state);
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if   {@link P_TaskQueue#print()} was called.
 */
private boolean setState(PE_TaskState newState){
  if (!m_manager.ASSERT(newState != m_state))   return false;
  m_state=newState;
  if (getLogger().isEnabled()) {
    if (m_state.isEndingState()) {
      String logText=this.toString();
      if (m_queue != null) {
        logText+="String_Node_Str" + m_queue.getUpdateCount();
      }
      getLogger().i(logText);
    }
 else     if (m_state == PE_TaskState.EXECUTING) {
      getQueue().print();
      return true;
    }
  }
  if (m_stateListener != null)   m_stateListener.onStateChange(this,m_state);
  return false;
}
Program: 93936
Project: 93936
Buggy source:
private void resetFailCount(){
  m_failCount=0;
  m_highestStateReached_total=null;
  m_timeOfFirstConnect=m_timeOfLastConnectFail=null;
  m_history.clear();
}

Fixed version (ground truth):
private void resetFailCount(){
  m_device.getManager().getPostManager().postToUpdateThread(new Runnable(){
    @Override public void run(){
      m_failCount=0;
      m_highestStateReached_total=null;
      m_timeOfFirstConnect=m_timeOfLastConnectFail=null;
      m_history.clear();
    }
  }
);
}
Program: 93937
Project: 93937
Buggy source:
public final void postToUpdateThread(Runnable action){
  if (isOnSweetBlueThread()) {
    action.run();
  }
 else {
    m_updateHandler.post(action);
  }
}

Fixed version (ground truth):
public final void postToUpdateThread(Runnable action){
  m_updateHandler.post(action);
}
Program: 93938
Project: 93938
Buggy source:
private synchronized boolean dequeue(){
  if (!m_mngr.ASSERT(m_current == null))   return false;
  if (m_queue.size() == 0)   return false;
  for (int i=0; i < m_queue.size(); i++) {
    PA_Task newPotentialCurrent=m_queue.get(i);
    if (newPotentialCurrent.isArmable()) {
      m_queue.remove(i);
      m_current=newPotentialCurrent;
      m_current.arm();
      m_current.tryExecuting();
      print();
      return true;
    }
  }
  print();
  return false;
}

Fixed version (ground truth):
private synchronized boolean dequeue(){
  if (!m_mngr.ASSERT(m_current == null))   return false;
  if (m_queue.size() == 0)   return false;
  for (int i=0; i < m_queue.size(); i++) {
    PA_Task newPotentialCurrent=m_queue.get(i);
    if (newPotentialCurrent.isArmable()) {
      m_queue.remove(i);
      m_current=newPotentialCurrent;
      m_current.arm();
      if (!m_current.tryExecuting()) {
        print();
      }
      return true;
    }
  }
  return false;
}
Program: 93939
Project: 93939
Buggy source:
@Override protected void update(double timeStep){
  if (m_gattRefresh) {
    m_curGattDelay+=timeStep;
    if (m_curGattDelay >= m_gattDelayTarget) {
      if (!getDevice().gattLayer().discoverServices()) {
        failImmediately();
        getManager().uhOh(UhOh.SERVICE_DISCOVERY_IMMEDIATELY_FAILED);
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void update(double timeStep){
  if (m_gattRefresh && !m_discoverAttempted) {
    m_curGattDelay+=timeStep;
    if (m_curGattDelay >= m_gattDelayTarget) {
      m_discoverAttempted=true;
      if (!getDevice().gattLayer().discoverServices()) {
        failImmediately();
        getManager().uhOh(UhOh.SERVICE_DISCOVERY_IMMEDIATELY_FAILED);
      }
    }
  }
}
Program: 93940
Project: 93940
Buggy source:
@Override public void execute(){
{
    if (m_gattRefresh) {
      getDevice().gattLayer().refreshGatt();
      return;
    }
  }
  if (!getDevice().gattLayer().discoverServices()) {
    failImmediately();
    getManager().uhOh(UhOh.SERVICE_DISCOVERY_IMMEDIATELY_FAILED);
  }
}

Fixed version (ground truth):
@Override public void execute(){
{
    if (m_gattRefresh) {
      getDevice().gattLayer().refreshGatt();
      return;
    }
  }
  if (!getDevice().gattLayer().discoverServices()) {
    failImmediately();
    getManager().uhOh(UhOh.SERVICE_DISCOVERY_IMMEDIATELY_FAILED);
  }
  m_discoverAttempted=true;
}
Program: 93941
Project: 93941
Buggy source:
void invokeReadWriteCallback(final ReadWriteListener listener_nullable,final ReadWriteListener.ReadWriteEvent event){
  if (event.wasSuccess() && event.isRead() && event.target() == ReadWriteListener.Target.CHARACTERISTIC) {
    final EpochTime timestamp=new EpochTime();
    final BleNodeConfig.HistoricalDataLogFilter.Source source=event.type().toHistoricalDataSource();
    m_historicalDataMngr.add_single(event.charUuid(),event.data(),timestamp,source);
  }
  m_txnMngr.onReadWriteResult(event);
  if (listener_nullable != null) {
    postEvent(listener_nullable,event);
  }
  if (m_defaultReadWriteListener != null) {
    postEvent(m_defaultReadWriteListener,event);
  }
  if (getManager() != null && getManager().m_defaultReadWriteListener != null) {
    postEvent(getManager().m_defaultReadWriteListener,event);
  }
  if (m_defaultNotificationListener != null && event.type().isNotification() || event.type() == Type.DISABLING_NOTIFICATION || event.type() == Type.ENABLING_NOTIFICATION) {
    m_defaultNotificationListener.onEvent(fromReadWriteEvent(event));
  }
  m_txnMngr.onReadWriteResultCallbacksCalled();
}

Fixed version (ground truth):
void invokeReadWriteCallback(final ReadWriteListener listener_nullable,final ReadWriteListener.ReadWriteEvent event){
  if (event.wasSuccess() && event.isRead() && event.target() == ReadWriteListener.Target.CHARACTERISTIC) {
    final EpochTime timestamp=new EpochTime();
    final BleNodeConfig.HistoricalDataLogFilter.Source source=event.type().toHistoricalDataSource();
    m_historicalDataMngr.add_single(event.charUuid(),event.data(),timestamp,source);
  }
  m_txnMngr.onReadWriteResult(event);
  if (listener_nullable != null) {
    postEvent(listener_nullable,event);
  }
  if (m_defaultReadWriteListener != null) {
    postEvent(m_defaultReadWriteListener,event);
  }
  if (getManager() != null && getManager().m_defaultReadWriteListener != null) {
    postEvent(getManager().m_defaultReadWriteListener,event);
  }
  if (m_defaultNotificationListener != null && (event.type().isNotification() || event.type() == Type.DISABLING_NOTIFICATION || event.type() == Type.ENABLING_NOTIFICATION)) {
    m_defaultNotificationListener.onEvent(fromReadWriteEvent(event));
  }
  m_txnMngr.onReadWriteResultCallbacksCalled();
}
Program: 93943
Project: 93943
Buggy source:
/** 
 * A constructor which taken an activity and a custom implementation of   {@link BluetoothEnablerFilter}.
 */
private void BluetoothEnabler(Activity activity,BluetoothEnablerFilter enablerFilter){
  m_defaultActivity=activity;
  m_enablerFilter=enablerFilter;
  m_lifecycleCallback=newLifecycleCallbacks();
  m_defaultActivity.getApplication().registerActivityLifecycleCallbacks(m_lifecycleCallback);
  m_isForegrounded=true;
  m_currentStage=BluetoothEnablerFilter.Stage.START;
  dispatchEvent(getStage(),getStage().next(),BluetoothEnablerFilter.Status.NULL);
}

Fixed version (ground truth):
/** 
 * A constructor which taken an activity and a custom implementation of   {@link BluetoothEnablerFilter}.
 */
private void BluetoothEnabler(Activity activity,BluetoothEnablerFilter enablerFilter){
  m_defaultActivity=activity;
  m_enablerFilter=enablerFilter;
  m_lifecycleCallback=newLifecycleCallbacks();
  m_defaultActivity.getApplication().registerActivityLifecycleCallbacks(m_lifecycleCallback);
  m_isForegrounded=true;
  m_currentStage=BluetoothEnablerFilter.Stage.START;
}
Program: 93944
Project: 93944
Buggy source:
/** 
 * Kicks off the complex flow needed to fully enable Bluetooth on Build versions greater than or equal to   {@link android.os.Build.VERSION_CODES#M}.
 */
public static BluetoothEnabler start(final Activity activity,final BluetoothEnablerFilter filter){
  if (s_instance != null && false == s_instance.isDone()) {
    s_instance.setNewFilter(filter);
  }
 else {
    s_instance=new BluetoothEnabler(activity,filter);
  }
  return s_instance;
}

Fixed version (ground truth):
/** 
 * Kicks off the complex flow needed to fully enable Bluetooth on Build versions greater than or equal to   {@link android.os.Build.VERSION_CODES#M}.
 */
public static BluetoothEnabler start(final Activity activity,final BluetoothEnablerFilter filter){
  if (s_instance != null && false == s_instance.isDone()) {
    s_instance.setNewFilter(filter);
  }
 else {
    s_instance=new BluetoothEnabler(activity,filter);
    s_instance.dispatchEvent(s_instance.getStage(),s_instance.getStage().next(),BluetoothEnablerFilter.Status.NULL);
  }
  return s_instance;
}
Program: 93945
Project: 93945
Buggy source:
private int getBleState(){
  if (Utils.isMarshmallow()) {
    try {
      final Method method=BluetoothAdapter.class.getDeclaredMethod("String_Node_Str");
      final Integer state=(Integer)method.invoke(m_mngr.getNativeAdapter());
      return state;
    }
 catch (    Exception e) {
      return m_mngr.getNativeAdapter().getState();
    }
  }
 else {
    return m_mngr.getNativeAdapter().getState();
  }
}

Fixed version (ground truth):
private int getBleState(){
  if (Utils.isMarshmallow()) {
    try {
      final Method method=BluetoothAdapter.class.getDeclaredMethod("String_Node_Str");
      final Integer state=(Integer)method.invoke(m_mngr.getNativeAdapter());
      final Integer state2=m_mngr.getNativeAdapter().getState();
      if (state == BleStatuses.STATE_BLE_ON && state2 == OFF.getNativeCode()) {
        return state2;
      }
      return state;
    }
 catch (    Exception e) {
      return m_mngr.getNativeAdapter().getState();
    }
  }
 else {
    return m_mngr.getNativeAdapter().getState();
  }
}
Program: 93946
Project: 93946
Buggy source:
/** 
 * Returns <code>true</code> if   {@link #turnOnLocationWithIntent_forPermissions(Activity,int)} will pop a system dialog, <code>false</code> if it will bringyou to the OS's Application Settings. The <code>true</code> case happens if the app has never shown a request Location Permissions dialog or has shown a request Location Permission dialog and the user has yet to select "Never ask again". This method is used to weed out the false negative from  {@link Activity#shouldShowRequestPermissionRationale(String)} when the Location Permission has never been requested. Make sure to use this in conjunction with {@link #isLocationEnabledForScanning_byRuntimePermissions()}which will tell you if permissions are already enabled.
 * @see com.idevicesinc.sweetblue.utils.BluetoothEnabler
 */
public boolean willLocationPermissionSystemDialogBeShown(Activity callingActivity){
  SharedPreferences preferences=callingActivity.getSharedPreferences(LOCATION_PERMISSION_NAMESPACE,Context.MODE_PRIVATE);
  boolean hasNeverAskAgainBeenSelected=!callingActivity.shouldShowRequestPermissionRationale(Manifest.permission.ACCESS_COARSE_LOCATION);
  boolean hasLocationPermissionSystemDialogShownOnce=preferences.getBoolean(LOCATION_PERMISSION_KEY,false);
  return (!hasLocationPermissionSystemDialogShownOnce) || (hasLocationPermissionSystemDialogShownOnce && !hasNeverAskAgainBeenSelected);
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if   {@link #turnOnLocationWithIntent_forPermissions(Activity,int)} will pop a system dialog, <code>false</code> if it will bringyou to the OS's Application Settings. The <code>true</code> case happens if the app has never shown a request Location Permissions dialog or has shown a request Location Permission dialog and the user has yet to select "Never ask again". This method is used to weed out the false negative from  {@link Activity#shouldShowRequestPermissionRationale(String)} when the Location Permission has never been requested. Make sure to use this in conjunction with {@link #isLocationEnabledForScanning_byRuntimePermissions()}which will tell you if permissions are already enabled.
 * @see com.idevicesinc.sweetblue.utils.BluetoothEnabler
 */
@TargetApi(Build.VERSION_CODES.M) public boolean willLocationPermissionSystemDialogBeShown(Activity callingActivity){
  SharedPreferences preferences=callingActivity.getSharedPreferences(LOCATION_PERMISSION_NAMESPACE,Context.MODE_PRIVATE);
  boolean hasNeverAskAgainBeenSelected=!callingActivity.shouldShowRequestPermissionRationale(Manifest.permission.ACCESS_COARSE_LOCATION);
  boolean hasLocationPermissionSystemDialogShownOnce=preferences.getBoolean(LOCATION_PERMISSION_KEY,false);
  return (!hasLocationPermissionSystemDialogShownOnce) || (hasLocationPermissionSystemDialogShownOnce && !hasNeverAskAgainBeenSelected);
}
Program: 93947
Project: 93947
Buggy source:
@Override public void onClick(DialogInterface dialog,int which){
  dialog.dismiss();
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialog,int which){
}
Program: 93948
Project: 93948
Buggy source:
private void updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status newStatus){
  m_currentEvent=new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentEvent.stage(),newStatus);
  m_lastPlease=m_startupListener.onEvent(m_currentEvent);
  handlePleaseResponse();
}

Fixed version (ground truth):
private void updateEventStatusAndPassEventToUser(BluetoothEnablerListener.Status newStatus){
  BluetoothEnablerListener.BluetoothEnablerEvent currentEvent=new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentStage,newStatus);
  m_lastPlease=m_startupListener.onEvent(currentEvent);
  handlePleaseResponse();
}
Program: 93949
Project: 93949
Buggy source:
public void BluetoothEnabler(Activity activity,BluetoothEnablerListener startupListener){
  m_bleManager=BleManager.get(activity);
  m_passedActivity=activity;
  m_currentStage=BluetoothEnablerListener.Stage.START;
  m_currentEvent=new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentStage,BluetoothEnablerListener.Status.NULL);
  m_startupListener=startupListener;
  nextStage();
}

Fixed version (ground truth):
public void BluetoothEnabler(Activity activity,BluetoothEnablerListener startupListener){
  m_bleManager=BleManager.get(activity);
  m_passedActivity=activity;
  m_currentStage=BluetoothEnablerListener.Stage.START;
  BluetoothEnablerListener.BluetoothEnablerEvent startEvent=new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentStage,BluetoothEnablerListener.Status.NULL);
  m_startupListener=startupListener;
  nextStage(startEvent);
}
Program: 93951
Project: 93951
Buggy source:
private void finishPleaseResponse(boolean wasCancelledByDialog){
  if (m_lastPlease.m_stateCode == BluetoothEnablerListener.Please.DO_NEXT) {
    m_currentStage=m_currentStage.next();
    m_currentEvent=wasCancelledByDialog ? new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentStage,BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG) : new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentStage);
    nextStage();
  }
 else   if (m_lastPlease.m_stateCode == BluetoothEnablerListener.Please.SKIP_NEXT) {
    m_currentStage=m_currentStage.next();
    m_currentEvent=wasCancelledByDialog ? new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentStage,BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG) : new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentStage,BluetoothEnablerListener.Status.SKIPPED);
    nextStage();
  }
 else   if (m_lastPlease.m_stateCode == BluetoothEnablerListener.Please.END) {
    m_currentStage=BluetoothEnablerListener.Stage.LOCATION_SERVICES;
    m_currentEvent=wasCancelledByDialog ? new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentStage,BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG) : new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentStage);
  }
}

Fixed version (ground truth):
private void finishPleaseResponse(boolean wasCancelledByDialog){
  if (m_lastPlease.m_stateCode == BluetoothEnablerListener.Please.DO_NEXT) {
    m_currentStage=m_currentStage.next();
    BluetoothEnablerListener.BluetoothEnablerEvent nextEvent=wasCancelledByDialog ? new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentStage,BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG) : new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentStage);
    nextStage(nextEvent);
  }
 else   if (m_lastPlease.m_stateCode == BluetoothEnablerListener.Please.SKIP_NEXT) {
    m_currentStage=m_currentStage.next();
    BluetoothEnablerListener.BluetoothEnablerEvent nextEvent=wasCancelledByDialog ? new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentStage,BluetoothEnablerListener.Status.CANCELLED_BY_DIALOG) : new BluetoothEnablerListener.BluetoothEnablerEvent(m_currentStage,BluetoothEnablerListener.Status.SKIPPED);
    nextStage(nextEvent);
  }
 else   if (m_lastPlease.m_stateCode == BluetoothEnablerListener.Please.END) {
  }
}
Program: 93953
Project: 93953
Buggy source:
private Part_Function function(final String function,final HistoricalDataColumn column){
  if (!m_query.m_select.isEmpty()) {
    m_query.m_select+="String_Node_Str";
  }
  m_query.m_select+="String_Node_Str" + function + "String_Node_Str"+ column.getColumnName()+ "String_Node_Str";
  return new Part_Function(m_query);
}

Fixed version (ground truth):
private Part_Function function(final String function,final HistoricalDataColumn column){
  if (!m_query.m_select.isEmpty()) {
    m_query.m_select+="String_Node_Str";
  }
  m_query.m_select+="String_Node_Str" + function + "String_Node_Str";
  return new Part_Function(m_query);
}
Program: 93954
Project: 93954
Buggy source:
public static byte[] subBytes(byte[] source,int sourceBegin,int sourceEnd){
  byte[] destination=new byte[sourceEnd - sourceBegin];
  System.arraycopy(source,sourceBegin,destination,0,sourceEnd - sourceBegin);
  return destination;
}

Fixed version (ground truth):
public static byte[] subBytes(final byte[] source,final int sourceBegin){
  return subBytes(source,sourceBegin,source.length - 1);
}
Program: 93955
Project: 93955
Buggy source:
public static String normalizeDeviceName(String deviceName){
  if (deviceName == null || deviceName.length() == 0)   return "String_Node_Str";
  String[] nameParts=deviceName.split("String_Node_Str");
  String consistentName=nameParts[0];
  consistentName=consistentName.toLowerCase();
  consistentName=consistentName.replace("String_Node_Str","String_Node_Str");
  return consistentName;
}

Fixed version (ground truth):
public static String normalizeDeviceName(String deviceName){
  if (deviceName == null || deviceName.length() == 0)   return "String_Node_Str";
  String[] nameParts=deviceName.split("String_Node_Str");
  String consistentName=nameParts[0];
  consistentName=consistentName.toLowerCase();
  consistentName=consistentName.trim();
  consistentName=consistentName.replace("String_Node_Str","String_Node_Str");
  return consistentName;
}
Program: 93957
Project: 93957
Buggy source:
/** 
 * Returns the cached data from the lastest successful read or notify received for a given uuid. Basically if you receive a   {@link ReadWriteListener.ReadWriteEvent} for which {@link ReadWriteListener.ReadWriteEvent#isRead()}and   {@link ReadWriteListener.ReadWriteEvent#wasSuccess()} both return <code>true</code> then {@link ReadWriteListener.ReadWriteEvent#data()}, will be cached and is retrievable by this method.
 * @see com.idevicesinc.sweetblue.BleDeviceConfig.HistoricalDataLogFilter
 * @see com.idevicesinc.sweetblue.BleDeviceConfig.DefaultHistoricalDataLogFilter
 * @return The cached value from a previous read or notify, or {@link HistoricalData#NULL} otherwise.
 */
@com.idevicesinc.sweetblue.annotations.Advanced public @Nullable(Nullable.Prevalence.NEVER) HistoricalData getHistoricalData_latest(final UUID uuid){
  return getHistoricalData_atOffset(uuid,getHistoricalDataCount(uuid) - 1);
}

Fixed version (ground truth):
/** 
 * Returns the cached data from the lastest successful read or notify received for a given uuid. Basically if you receive a   {@link ReadWriteListener.ReadWriteEvent} for which {@link ReadWriteListener.ReadWriteEvent#isRead()}and   {@link ReadWriteListener.ReadWriteEvent#wasSuccess()} both return <code>true</code> then {@link ReadWriteListener.ReadWriteEvent#data()}, will be cached and is retrievable by this method.
 * @see BleNodeConfig.HistoricalDataLogFilter
 * @see BleNodeConfig.DefaultHistoricalDataLogFilter
 * @return The cached value from a previous read or notify, or {@link HistoricalData#NULL} otherwise.
 */
@com.idevicesinc.sweetblue.annotations.Advanced public @Nullable(Nullable.Prevalence.NEVER) HistoricalData getHistoricalData_latest(final UUID uuid){
  return getHistoricalData_atOffset(uuid,getHistoricalDataCount(uuid) - 1);
}
Program: 93958
Project: 93958
Buggy source:
/** 
 * Returns the   {@link BleDeviceConfig.HistoricalDataLogFilter.Source} equivalentfor this  {@link BleDevice.ReadWriteListener.Type}, or   {@link BleDeviceConfig.HistoricalDataLogFilter.Source#NULL}.
 */
public BleDeviceConfig.HistoricalDataLogFilter.Source toHistoricalDataSource(){
switch (this) {
case READ:
    return BleDeviceConfig.HistoricalDataLogFilter.Source.READ;
case POLL:
  return BleDeviceConfig.HistoricalDataLogFilter.Source.POLL;
case NOTIFICATION:
return BleDeviceConfig.HistoricalDataLogFilter.Source.NOTIFICATION;
case INDICATION:
return BleDeviceConfig.HistoricalDataLogFilter.Source.INDICATION;
case PSUEDO_NOTIFICATION:
return BleDeviceConfig.HistoricalDataLogFilter.Source.PSUEDO_NOTIFICATION;
}
return BleDeviceConfig.HistoricalDataLogFilter.Source.NULL;
}

Fixed version (ground truth):
/** 
 * Returns the   {@link BleNodeConfig.HistoricalDataLogFilter.Source} equivalentfor this  {@link BleDevice.ReadWriteListener.Type}, or   {@link BleNodeConfig.HistoricalDataLogFilter.Source#NULL}.
 */
public BleNodeConfig.HistoricalDataLogFilter.Source toHistoricalDataSource(){
switch (this) {
case READ:
    return BleNodeConfig.HistoricalDataLogFilter.Source.READ;
case POLL:
  return BleNodeConfig.HistoricalDataLogFilter.Source.POLL;
case NOTIFICATION:
return BleNodeConfig.HistoricalDataLogFilter.Source.NOTIFICATION;
case INDICATION:
return BleNodeConfig.HistoricalDataLogFilter.Source.INDICATION;
case PSUEDO_NOTIFICATION:
return BleNodeConfig.HistoricalDataLogFilter.Source.PSUEDO_NOTIFICATION;
}
return BleNodeConfig.HistoricalDataLogFilter.Source.NULL;
}
Program: 93959
Project: 93959
Buggy source:
/** 
 * Clears the first <code>count</code> number of   {@link com.idevicesinc.sweetblue.utils.HistoricalData} tracked by this device for a particularcharacteristic  {@link java.util.UUID} within the given range.
 * @see com.idevicesinc.sweetblue.BleDeviceConfig.HistoricalDataLogFilter
 * @see com.idevicesinc.sweetblue.BleDeviceConfig.DefaultHistoricalDataLogFilter
 */
@com.idevicesinc.sweetblue.annotations.Advanced public void clearHistoricalData_memoryOnly(final UUID characteristicUuid,final EpochTimeRange range,final long count){
  if (isNull())   return;
  m_historicalDataMngr.delete(characteristicUuid,range,count,true);
}

Fixed version (ground truth):
/** 
 * Clears the first <code>count</code> number of   {@link com.idevicesinc.sweetblue.utils.HistoricalData} tracked by this device for a particularcharacteristic  {@link java.util.UUID} within the given range.
 * @see com.idevicesinc.sweetblue.BleNodeConfig.HistoricalDataLogFilter
 * @see com.idevicesinc.sweetblue.BleNodeConfig.DefaultHistoricalDataLogFilter
 */
@com.idevicesinc.sweetblue.annotations.Advanced public void clearHistoricalData_memoryOnly(final UUID characteristicUuid,final EpochTimeRange range,final long count){
  if (isNull())   return;
  m_historicalDataMngr.delete(characteristicUuid,range,count,true);
}
Program: 93960
Project: 93960
Buggy source:
/** 
 * Same as   {@link #getHistoricalData_atOffset(java.util.UUID,int)} but offset is relative to the time range provided.
 * @see com.idevicesinc.sweetblue.BleDeviceConfig.HistoricalDataLogFilter
 * @see com.idevicesinc.sweetblue.BleDeviceConfig.DefaultHistoricalDataLogFilter
 */
@com.idevicesinc.sweetblue.annotations.Advanced public @Nullable(Nullable.Prevalence.NEVER) HistoricalData getHistoricalData_atOffset(final UUID uuid,final EpochTimeRange range,final int offsetFromStart){
  if (isNull())   return HistoricalData.NULL;
  return m_historicalDataMngr.getWithOffset(uuid,EpochTimeRange.denull(range),offsetFromStart);
}

Fixed version (ground truth):
/** 
 * Same as   {@link #getHistoricalData_atOffset(java.util.UUID,int)} but offset is relative to the time range provided.
 * @see com.idevicesinc.sweetblue.BleNodeConfig.HistoricalDataLogFilter
 * @see com.idevicesinc.sweetblue.BleNodeConfig.DefaultHistoricalDataLogFilter
 */
@com.idevicesinc.sweetblue.annotations.Advanced public @Nullable(Nullable.Prevalence.NEVER) HistoricalData getHistoricalData_atOffset(final UUID uuid,final EpochTimeRange range,final int offsetFromStart){
  if (isNull())   return HistoricalData.NULL;
  return m_historicalDataMngr.getWithOffset(uuid,EpochTimeRange.denull(range),offsetFromStart);
}
Program: 93961
Project: 93961
Buggy source:
/** 
 * Forwards   {@link com.idevicesinc.sweetblue.BleDevice.ConnectionFailListener.Status#shouldBeReportedToUser()}using   {@link #status()}.
 */
public boolean shouldBeReportedToUser(){
  return status().shouldBeReportedToUser();
}

Fixed version (ground truth):
/** 
 * Forwards   {@link BleDevice.ConnectionFailListener.Status#shouldBeReportedToUser()} using {@link #status()}.
 */
public boolean shouldBeReportedToUser(){
  return status().shouldBeReportedToUser();
}
Program: 93962
Project: 93962
Buggy source:
/** 
 * Returns an iterator that will iterate through all   {@link HistoricalData} entries within the range provided.
 * @see com.idevicesinc.sweetblue.BleDeviceConfig.HistoricalDataLogFilter
 * @see com.idevicesinc.sweetblue.BleDeviceConfig.DefaultHistoricalDataLogFilter
 */
@com.idevicesinc.sweetblue.annotations.Advanced public @Nullable(Nullable.Prevalence.NEVER) Iterator<HistoricalData> getHistoricalData_iterator(final UUID uuid,final EpochTimeRange range){
  if (isNull())   return new EmptyIterator<HistoricalData>();
  return m_historicalDataMngr.getIterator(uuid,EpochTimeRange.denull(range));
}

Fixed version (ground truth):
/** 
 * Returns an iterator that will iterate through all   {@link HistoricalData} entries within the range provided.
 * @see com.idevicesinc.sweetblue.BleNodeConfig.HistoricalDataLogFilter
 * @see com.idevicesinc.sweetblue.BleNodeConfig.DefaultHistoricalDataLogFilter
 */
@com.idevicesinc.sweetblue.annotations.Advanced public @Nullable(Nullable.Prevalence.NEVER) Iterator<HistoricalData> getHistoricalData_iterator(final UUID uuid,final EpochTimeRange range){
  if (isNull())   return new EmptyIterator<HistoricalData>();
  return m_historicalDataMngr.getIterator(uuid,EpochTimeRange.denull(range));
}
Program: 93963
Project: 93963
Buggy source:
/** 
 * Sets a default backup   {@link com.idevicesinc.sweetblue.BleDevice.HistoricalDataLoadListener} that will be invokedfor all historical data loads to memory for all uuids.
 */
public void setListener_HistoricalDataLoad(@Nullable(Prevalence.NORMAL) final HistoricalDataLoadListener listener_nullable){
  if (isNull())   return;
  m_historicalDataMngr.setListener(listener_nullable);
}

Fixed version (ground truth):
/** 
 * Sets a default backup   {@link BleNode.HistoricalDataLoadListener} that will be invokedfor all historical data loads to memory for all uuids.
 */
public void setListener_HistoricalDataLoad(@Nullable(Prevalence.NORMAL) final BleNode.HistoricalDataLoadListener listener_nullable){
  if (isNull())   return;
  m_historicalDataMngr.setListener(listener_nullable);
}
Program: 93964
Project: 93964
Buggy source:
/** 
 * Clears the first <code>count</code> number of   {@link com.idevicesinc.sweetblue.utils.HistoricalData} tracked by this device for a particularcharacteristic  {@link java.util.UUID} within the given range.
 * @see com.idevicesinc.sweetblue.BleDeviceConfig.HistoricalDataLogFilter
 * @see com.idevicesinc.sweetblue.BleDeviceConfig.DefaultHistoricalDataLogFilter
 */
@com.idevicesinc.sweetblue.annotations.Advanced public void clearHistoricalData(final UUID uuid,final EpochTimeRange range,final long count){
  if (isNull())   return;
  m_historicalDataMngr.delete(uuid,range,count,false);
}

Fixed version (ground truth):
/** 
 * Clears the first <code>count</code> number of   {@link com.idevicesinc.sweetblue.utils.HistoricalData} tracked by this device for a particularcharacteristic  {@link java.util.UUID} within the given range.
 * @see com.idevicesinc.sweetblue.BleNodeConfig.HistoricalDataLogFilter
 * @see com.idevicesinc.sweetblue.BleNodeConfig.DefaultHistoricalDataLogFilter
 */
@com.idevicesinc.sweetblue.annotations.Advanced public void clearHistoricalData(final UUID uuid,final EpochTimeRange range,final long count){
  if (isNull())   return;
  m_historicalDataMngr.delete(uuid,range,count,false);
}
Program: 93965
Project: 93965
Buggy source:
/** 
 * Provides all historical data through the "for each" provided within the range provided.
 * @see com.idevicesinc.sweetblue.BleDeviceConfig.HistoricalDataLogFilter
 * @see com.idevicesinc.sweetblue.BleDeviceConfig.DefaultHistoricalDataLogFilter
 * @return <code>true</code> if there are any entries, <code>false</code> otherwise.
 */
@com.idevicesinc.sweetblue.annotations.Advanced public boolean getHistoricalData_forEach(final UUID uuid,final EpochTimeRange range,final ForEach_Breakable<HistoricalData> forEach){
  if (isNull())   return false;
  return m_historicalDataMngr.doForEach(uuid,EpochTimeRange.denull(range),forEach);
}

Fixed version (ground truth):
/** 
 * Provides all historical data through the "for each" provided within the range provided.
 * @see com.idevicesinc.sweetblue.BleNodeConfig.HistoricalDataLogFilter
 * @see com.idevicesinc.sweetblue.BleNodeConfig.DefaultHistoricalDataLogFilter
 * @return <code>true</code> if there are any entries, <code>false</code> otherwise.
 */
@com.idevicesinc.sweetblue.annotations.Advanced public boolean getHistoricalData_forEach(final UUID uuid,final EpochTimeRange range,final ForEach_Breakable<HistoricalData> forEach){
  if (isNull())   return false;
  return m_historicalDataMngr.doForEach(uuid,EpochTimeRange.denull(range),forEach);
}