nus-yam/ex-repair huggingface dataset:
Program: 93884
Project: 93884
Buggy source:
private void turnOff_private(final boolean removeAllBonds){
  if (isAny(TURNING_OFF,OFF))   return;
  if (is(ON)) {
    m_stateTracker.update(E_Intent.INTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE,TURNING_OFF,true,ON,false);
  }
  m_deviceMngr.disconnectAllForTurnOff(PE_TaskPriority.CRITICAL);
  if (removeAllBonds) {
    m_deviceMngr.unbondAll(PE_TaskPriority.CRITICAL,BondListener.Status.CANCELLED_FROM_BLE_TURNING_OFF);
  }
  if (m_server != null) {
    m_server.disconnect_internal(BleServer.ServiceAddListener.Status.CANCELLED_FROM_BLE_TURNING_OFF,BleServer.ConnectionFailListener.Status.CANCELLED_FROM_BLE_TURNING_OFF,ChangeIntent.INTENTIONAL);
  }
  final P_Task_TurnBleOff task=new P_Task_TurnBleOff(this,false,new PA_Task.I_StateListener(){
    @Override public void onStateChange(    PA_Task taskClass,    PE_TaskState state){
      if (state == PE_TaskState.EXECUTING) {
        if (is(RESETTING)) {
          m_nativeStateTracker.append(RESETTING,E_Intent.INTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE);
        }
        m_deviceMngr.undiscoverAllForTurnOff(m_deviceMngr_cache,E_Intent.INTENTIONAL);
      }
    }
  }
);
  m_taskQueue.add(task);
}

Fixed version (ground truth):
private void turnOff_private(final boolean removeAllBonds){
  if (isAny(TURNING_OFF,OFF))   return;
  if (is(ON)) {
    m_stateTracker.update(E_Intent.INTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE,TURNING_OFF,true,ON,false);
  }
  m_deviceMngr.disconnectAllForTurnOff(PE_TaskPriority.CRITICAL);
  if (removeAllBonds) {
    m_deviceMngr.unbondAll(PE_TaskPriority.CRITICAL,BondListener.Status.CANCELLED_FROM_BLE_TURNING_OFF);
  }
  if (m_server != null) {
    m_server.disconnect_internal(BleServer.ServiceAddListener.Status.CANCELLED_FROM_BLE_TURNING_OFF,BleServer.ConnectionFailListener.Status.CANCELLED_FROM_BLE_TURNING_OFF,State.ChangeIntent.INTENTIONAL);
  }
  final P_Task_TurnBleOff task=new P_Task_TurnBleOff(this,false,new PA_Task.I_StateListener(){
    @Override public void onStateChange(    PA_Task taskClass,    PE_TaskState state){
      if (state == PE_TaskState.EXECUTING) {
        if (is(RESETTING)) {
          m_nativeStateTracker.append(RESETTING,E_Intent.INTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE);
        }
        m_deviceMngr.undiscoverAllForTurnOff(m_deviceMngr_cache,E_Intent.INTENTIONAL);
      }
    }
  }
);
  m_taskQueue.add(task);
}
Program: 93886
Project: 93886
Buggy source:
/** 
 * Read the battery level of this device. This method is intended to be used if the device being read has two battery characteristics in the battery service. This method allows you to state which descriptor to match the @param valueToMatch to, to pick the correct characteristic to read the battery level from. This method is needed if you do not implement dual battery level exactly to the Bluetooth spec.
 * @deprecated - Use any of the read() methods which accept a {@link DescriptorFilter} instead, so you're not locked into the default service/char for battery.
 */
@Deprecated @Advanced public final ReadWriteEvent readBatteryLevel(byte[] valueToMatch,UUID descriptorUuid,ReadWriteListener listener){
  final ReadWriteEvent earlyOutResult=serviceMngr_device().getEarlyOutEvent(Uuids.BATTERY_SERVICE_UUID,Uuids.BATTERY_LEVEL,Uuids.INVALID,null,P_Const.EMPTY_FUTURE_DATA,Type.READ,ReadWriteListener.Target.CHARACTERISTIC);
  if (earlyOutResult != null) {
    invokeReadWriteCallback(listener,earlyOutResult);
    return earlyOutResult;
  }
  final NativeBleCharacteristic characteristic=getServiceManager().getCharacteristic(Uuids.BATTERY_SERVICE_UUID,Uuids.BATTERY_LEVEL);
  final boolean requiresBonding=m_bondMngr.bondIfNeeded(characteristic.getCharacteristic().getUuid(),BondFilter.CharacteristicEventType.READ);
  queue().add(new P_Task_BatteryLevel(this,valueToMatch,descriptorUuid,listener,requiresBonding,m_txnMngr.getCurrent(),getOverrideReadWritePriority()));
  return NULL_READWRITE_EVENT();
}

Fixed version (ground truth):
/** 
 * Read the battery level of this device. This method is intended to be used if the device being read has two battery characteristics in the battery service. This method allows you to state which descriptor to match the @param valueToMatch to, to pick the correct characteristic to read the battery level from. This method is needed if you do not implement dual battery level exactly to the Bluetooth spec.
 * @deprecated - Use any of the read() methods which accept a {@link DescriptorFilter} instead, so you're not locked into the default service/char for battery.
 */
@Deprecated @Advanced public final ReadWriteEvent readBatteryLevel(byte[] valueToMatch,UUID descriptorUuid,ReadWriteListener listener){
  final ReadWriteEvent earlyOutResult=serviceMngr_device().getEarlyOutEvent(Uuids.BATTERY_SERVICE_UUID,Uuids.BATTERY_LEVEL,Uuids.INVALID,null,P_Const.EMPTY_FUTURE_DATA,Type.READ,ReadWriteListener.Target.CHARACTERISTIC);
  if (earlyOutResult != null) {
    invokeReadWriteCallback(listener,earlyOutResult);
    return earlyOutResult;
  }
  final BleCharacteristicWrapper characteristic=getServiceManager().getCharacteristic(Uuids.BATTERY_SERVICE_UUID,Uuids.BATTERY_LEVEL);
  final boolean requiresBonding=m_bondMngr.bondIfNeeded(characteristic.getCharacteristic().getUuid(),BondFilter.CharacteristicEventType.READ);
  queue().add(new P_Task_BatteryLevel(this,valueToMatch,descriptorUuid,listener,requiresBonding,m_txnMngr.getCurrent(),getOverrideReadWritePriority()));
  return NULL_READWRITE_EVENT();
}
Program: 93887
Project: 93887
Buggy source:
final ReadWriteListener.ReadWriteEvent write_internal(final com.idevicesinc.sweetblue.WriteBuilder wb){
  final ReadWriteEvent earlyOutResult=serviceMngr_device().getEarlyOutEvent(wb.serviceUuid,wb.charUuid,wb.descriptorUuid,wb.descriptorFilter,wb.data,Type.WRITE,ReadWriteListener.Target.CHARACTERISTIC);
  if (earlyOutResult != null) {
    invokeReadWriteCallback(wb.readWriteListener,earlyOutResult);
    return earlyOutResult;
  }
  if (wb.descriptorUuid == null || wb.descriptorUuid.equals(Uuids.INVALID)) {
    final NativeBleCharacteristic characteristic=getServiceManager().getCharacteristic(wb.serviceUuid,wb.charUuid);
    final boolean requiresBonding=m_bondMngr.bondIfNeeded(characteristic.getCharacteristic().getUuid(),BondFilter.CharacteristicEventType.WRITE);
    addWriteTasks(characteristic.getCharacteristic(),wb.data,requiresBonding,wb.writeType,wb.descriptorFilter,wb.readWriteListener);
  }
 else {
    final boolean requiresBonding=false;
    final BluetoothGattDescriptor descriptor=getNativeDescriptor(wb.serviceUuid,wb.charUuid,wb.descriptorUuid);
    addWriteDescriptorTasks(descriptor,wb.data,requiresBonding,wb.readWriteListener);
  }
  return NULL_READWRITE_EVENT();
}

Fixed version (ground truth):
final ReadWriteListener.ReadWriteEvent write_internal(final com.idevicesinc.sweetblue.WriteBuilder wb){
  final ReadWriteEvent earlyOutResult=serviceMngr_device().getEarlyOutEvent(wb.serviceUuid,wb.charUuid,wb.descriptorUuid,wb.descriptorFilter,wb.data,Type.WRITE,ReadWriteListener.Target.CHARACTERISTIC);
  if (earlyOutResult != null) {
    invokeReadWriteCallback(wb.readWriteListener,earlyOutResult);
    return earlyOutResult;
  }
  if (wb.descriptorUuid == null || wb.descriptorUuid.equals(Uuids.INVALID)) {
    final BleCharacteristicWrapper characteristic=getServiceManager().getCharacteristic(wb.serviceUuid,wb.charUuid);
    final boolean requiresBonding=m_bondMngr.bondIfNeeded(characteristic.getCharacteristic().getUuid(),BondFilter.CharacteristicEventType.WRITE);
    addWriteTasks(characteristic.getCharacteristic(),wb.data,requiresBonding,wb.writeType,wb.descriptorFilter,wb.readWriteListener);
  }
 else {
    final boolean requiresBonding=false;
    final BluetoothGattDescriptor descriptor=getNativeDescriptor(wb.serviceUuid,wb.charUuid,wb.descriptorUuid);
    addWriteDescriptorTasks(descriptor,wb.data,requiresBonding,wb.readWriteListener);
  }
  return NULL_READWRITE_EVENT();
}
Program: 93889
Project: 93889
Buggy source:
private ReadWriteListener.ReadWriteEvent disableNotify_private(UUID serviceUuid,UUID characteristicUuid,Double forceReadTimeout,DescriptorFilter descriptorFilter,ReadWriteListener listener){
  final ReadWriteEvent earlyOutResult=serviceMngr_device().getEarlyOutEvent(serviceUuid,characteristicUuid,Uuids.INVALID,descriptorFilter,P_Const.EMPTY_FUTURE_DATA,Type.DISABLING_NOTIFICATION,ReadWriteListener.Target.CHARACTERISTIC);
  if (earlyOutResult != null) {
    invokeReadWriteCallback(listener,earlyOutResult);
    return earlyOutResult;
  }
  final NativeBleCharacteristic characteristic=getServiceManager().getCharacteristic(serviceUuid,characteristicUuid);
  if (characteristic != null && is(CONNECTED)) {
    final P_Task_ToggleNotify task;
    if (descriptorFilter == null) {
      task=new P_Task_ToggleNotify(this,characteristic.getCharacteristic(),false,m_txnMngr.getCurrent(),listener,getOverrideReadWritePriority());
    }
 else {
      task=new P_Task_ToggleNotify(this,serviceUuid,characteristicUuid,descriptorFilter,false,m_txnMngr.getCurrent(),listener,getOverrideReadWritePriority());
    }
    queue().add(task);
  }
  m_pollMngr.stopPoll(serviceUuid,characteristicUuid,descriptorFilter,forceReadTimeout,listener,true);
  return NULL_READWRITE_EVENT();
}

Fixed version (ground truth):
private ReadWriteListener.ReadWriteEvent disableNotify_private(UUID serviceUuid,UUID characteristicUuid,Double forceReadTimeout,DescriptorFilter descriptorFilter,ReadWriteListener listener){
  final ReadWriteEvent earlyOutResult=serviceMngr_device().getEarlyOutEvent(serviceUuid,characteristicUuid,Uuids.INVALID,descriptorFilter,P_Const.EMPTY_FUTURE_DATA,Type.DISABLING_NOTIFICATION,ReadWriteListener.Target.CHARACTERISTIC);
  if (earlyOutResult != null) {
    invokeReadWriteCallback(listener,earlyOutResult);
    return earlyOutResult;
  }
  final BleCharacteristicWrapper characteristic=getServiceManager().getCharacteristic(serviceUuid,characteristicUuid);
  if (characteristic != null && is(CONNECTED)) {
    final P_Task_ToggleNotify task;
    if (descriptorFilter == null) {
      task=new P_Task_ToggleNotify(this,characteristic.getCharacteristic(),false,m_txnMngr.getCurrent(),listener,getOverrideReadWritePriority());
    }
 else {
      task=new P_Task_ToggleNotify(this,serviceUuid,characteristicUuid,descriptorFilter,false,m_txnMngr.getCurrent(),listener,getOverrideReadWritePriority());
    }
    queue().add(task);
  }
  m_pollMngr.stopPoll(serviceUuid,characteristicUuid,descriptorFilter,forceReadTimeout,listener,true);
  return NULL_READWRITE_EVENT();
}
Program: 93890
Project: 93890
Buggy source:
/** 
 * Overload of   {@link #getNativeCharacteristic(UUID)} for when you have characteristics with identical uuids under different services.Note that this will never return a <code>null</code> instance. You need to call  {@link NativeBleCharacteristic#isNull()} to check if the {@link BluetoothGattCharacteristic}actually exists (in other words, it will return <code>true</code> if we were unable to find the requested characteristic).
 */
public @Nullable(Nullable.Prevalence.NEVER) NativeBleCharacteristic getNativeBleCharacteristic(final UUID serviceUuid,final UUID charUuid){
  return m_serviceMngr.getCharacteristic(serviceUuid,charUuid);
}

Fixed version (ground truth):
/** 
 * Overload of   {@link #getNativeCharacteristic(UUID)} for when you have characteristics with identical uuids under different services.Note that this will never return a <code>null</code> instance. You need to call  {@link BleCharacteristicWrapper#isNull()} to check if the {@link BluetoothGattCharacteristic}actually exists (in other words, it will return <code>true</code> if we were unable to find the requested characteristic).
 */
public @Nullable(Nullable.Prevalence.NEVER) BleCharacteristicWrapper getNativeBleCharacteristic(final UUID serviceUuid,final UUID charUuid){
  return m_serviceMngr.getCharacteristic(serviceUuid,charUuid);
}
Program: 93891
Project: 93891
Buggy source:
/** 
 * Overload of   {@link #getNativeCharacteristic(UUID,UUID)} for when you have characteristics with identical uuids within the same service.
 */
public @Nullable(Nullable.Prevalence.NORMAL) BluetoothGattCharacteristic getNativeCharacteristic(final UUID serviceUuid,final UUID charUuid,final DescriptorFilter descriptorFilter){
  return m_serviceMngr.getCharacteristic(serviceUuid,charUuid,descriptorFilter);
}

Fixed version (ground truth):
/** 
 * Overload of   {@link #getNativeCharacteristic(UUID,UUID)} for when you have characteristics with identical uuids within the same service.
 */
public @Nullable(Nullable.Prevalence.NORMAL) BluetoothGattCharacteristic getNativeCharacteristic(final UUID serviceUuid,final UUID charUuid,final DescriptorFilter descriptorFilter){
  return m_serviceMngr.getCharacteristic(serviceUuid,charUuid,descriptorFilter).getCharacteristic();
}
Program: 93892
Project: 93892
Buggy source:
/** 
 * Overload of   {@link #getNativeDescriptor(UUID,UUID,UUID)} that will return the first descriptor we findinside the given service matching the given  {@link UUID}. Note that this will never return a <code>null</code> instance. You need to call   {@link NativeBleDescriptor#isNull()} to check if the {@link BluetoothGattDescriptor}actually exists (in other words, it will return <code>true</code> if we were unable to find the requested descriptor).
 */
public @Nullable(Nullable.Prevalence.NEVER) NativeBleDescriptor getNativeBleDescriptor_inService(final UUID serviceUuid,final UUID descUuid){
  return getNativeBleDescriptor(serviceUuid,null,descUuid);
}

Fixed version (ground truth):
/** 
 * Overload of   {@link #getNativeDescriptor(UUID,UUID,UUID)} that will return the first descriptor we findinside the given service matching the given  {@link UUID}. Note that this will never return a <code>null</code> instance. You need to call   {@link BleDescriptorWrapper#isNull()} to check if the {@link BluetoothGattDescriptor}actually exists (in other words, it will return <code>true</code> if we were unable to find the requested descriptor).
 */
public @Nullable(Nullable.Prevalence.NEVER) BleDescriptorWrapper getNativeBleDescriptor_inService(final UUID serviceUuid,final UUID descUuid){
  return getNativeBleDescriptor(serviceUuid,null,descUuid);
}
Program: 93893
Project: 93893
Buggy source:
/** 
 * Overload of   {@link #getNativeDescriptor(UUID,UUID,UUID)} that will return the first descriptor we findinside the given characteristic matching the given  {@link UUID}. Note that this will never return a <code>null</code> instance. You need to call   {@link NativeBleDescriptor#isNull()} to check if the {@link BluetoothGattDescriptor}actually exists (in other words, it will return <code>true</code> if we were unable to find the requested descriptor).
 */
public @Nullable(Nullable.Prevalence.NEVER) NativeBleDescriptor getNativeBleDescriptor_inChar(final UUID charUuid,final UUID descUuid){
  return getNativeBleDescriptor(null,charUuid,descUuid);
}

Fixed version (ground truth):
/** 
 * Overload of   {@link #getNativeDescriptor(UUID,UUID,UUID)} that will return the first descriptor we findinside the given characteristic matching the given  {@link UUID}. Note that this will never return a <code>null</code> instance. You need to call   {@link BleDescriptorWrapper#isNull()} to check if the {@link BluetoothGattDescriptor}actually exists (in other words, it will return <code>true</code> if we were unable to find the requested descriptor).
 */
public @Nullable(Nullable.Prevalence.NEVER) BleDescriptorWrapper getNativeBleDescriptor_inChar(final UUID charUuid,final UUID descUuid){
  return getNativeBleDescriptor(null,charUuid,descUuid);
}
Program: 93894
Project: 93894
Buggy source:
/** 
 * Returns the   {@link NativeBleDescriptor} for the given UUID in case you need lower-level access.Note that this will never return a <code>null</code> instance. You need to call  {@link NativeBleDescriptor#isNull()} to check if the {@link BluetoothGattDescriptor}actually exists (in other words, it will return <code>true</code> if we were unable to find the requested descriptor).
 */
public @Nullable(Nullable.Prevalence.NEVER) NativeBleDescriptor getNativeBleDescriptor(final UUID serviceUuid,final UUID charUuid,final UUID descUuid){
  return m_serviceMngr.getDescriptor(serviceUuid,charUuid,descUuid);
}

Fixed version (ground truth):
/** 
 * Returns the   {@link BleDescriptorWrapper} for the given UUID in case you need lower-level access.Note that this will never return a <code>null</code> instance. You need to call  {@link BleDescriptorWrapper#isNull()} to check if the {@link BluetoothGattDescriptor}actually exists (in other words, it will return <code>true</code> if we were unable to find the requested descriptor).
 */
public @Nullable(Nullable.Prevalence.NEVER) BleDescriptorWrapper getNativeBleDescriptor(final UUID serviceUuid,final UUID charUuid,final UUID descUuid){
  return m_serviceMngr.getDescriptor(serviceUuid,charUuid,descUuid);
}
Program: 93895
Project: 93895
Buggy source:
/** 
 * Returns the native service for the given UUID in case you need lower-level access. Note that this will never return a <code>null</code> instance. You need to call   {@link NativeBleGattService#isNull()} to check if the {@link BluetoothGattService}actually exists (in other words, it will return <code>true</code> if we were unable to find the requested service).
 */
@com.idevicesinc.sweetblue.annotations.Advanced public @Nullable(Nullable.Prevalence.NEVER) NativeBleGattService getNativeBleService(final UUID serviceUuid){
  return m_serviceMngr.getServiceDirectlyFromNativeNode(serviceUuid);
}

Fixed version (ground truth):
/** 
 * Returns the native service for the given UUID in case you need lower-level access. Note that this will never return a <code>null</code> instance. You need to call   {@link BleServiceWrapper#isNull()} to check if the {@link BluetoothGattService}actually exists (in other words, it will return <code>true</code> if we were unable to find the requested service).
 */
@com.idevicesinc.sweetblue.annotations.Advanced public @Nullable(Nullable.Prevalence.NEVER) BleServiceWrapper getNativeBleService(final UUID serviceUuid){
  return m_serviceMngr.getServiceDirectlyFromNativeNode(serviceUuid);
}
Program: 93896
Project: 93896
Buggy source:
@NonNull @Override public View getView(int position,@Nullable View convertView,@NonNull ViewGroup parent){
  ViewHolder h;
  if (convertView == null) {
    convertView=View.inflate(getContext(),R.layout.service_layout,null);
    h=new ViewHolder();
    h.name=(TextView)convertView.findViewById(R.id.serviceName);
    h.uuid=(TextView)convertView.findViewById(R.id.uuid);
    h.type=(TextView)convertView.findViewById(R.id.serviceType);
    convertView.setTag(h);
  }
 else {
    h=(ViewHolder)convertView.getTag();
  }
  final BluetoothGattService service=m_serviceList.get(position);
  final String serviceName=UuidUtil.getServiceName(service);
  h.name.setText(serviceName);
  final String uuid=serviceName.equals(UuidUtil.CUSTOM_SERVICE) ? service.getUuid().toString() : UuidUtil.getShortUuid(service.getUuid());
  h.uuid.setText(uuid);
  final String type=service.getType() == BluetoothGattService.SERVICE_TYPE_PRIMARY ? getContext().getString(R.string.primary_service) : getContext().getString(R.string.secondary_service);
  h.type.setText(type);
  return convertView;
}

Fixed version (ground truth):
@NonNull @Override public View getView(int position,@Nullable View convertView,@NonNull ViewGroup parent){
  ViewHolder h;
  if (convertView == null) {
    convertView=View.inflate(getContext(),R.layout.service_layout,null);
    h=new ViewHolder();
    h.name=(TextView)convertView.findViewById(R.id.serviceName);
    h.uuid=(TextView)convertView.findViewById(R.id.uuid);
    h.type=(TextView)convertView.findViewById(R.id.serviceType);
    convertView.setTag(h);
  }
 else {
    h=(ViewHolder)convertView.getTag();
  }
  final BluetoothGattService service=m_serviceList.get(position);
  final String serviceName=UuidUtil.getServiceName(service);
  h.name.setText(serviceName);
  final String uuid=serviceName.equals(UuidUtil.CUSTOM_SERVICE) ? service.getUuid().toString() : UuidUtil.getShortUuid(service.getUuid());
  h.uuid.setText(uuid);
  ViewUtil.postFixRunnable(h.uuid);
  final String type=service.getType() == BluetoothGattService.SERVICE_TYPE_PRIMARY ? getContext().getString(R.string.primary_service) : getContext().getString(R.string.secondary_service);
  h.type.setText(type);
  return convertView;
}
Program: 93897
Project: 93897
Buggy source:
@Override public void onClick(View v){
  Intent intent=new Intent(context,WriteValueActivity.class);
  intent.putExtra("String_Node_Str",m_device.getMacAddress());
  intent.putExtra("String_Node_Str",m_service.getUuid().toString());
  intent.putExtra("String_Node_Str",characteristic.getUuid().toString());
  context.startActivity(intent);
}

Fixed version (ground truth):
@Override public void onClick(View v){
  Intent intent=new Intent(context,WriteValueActivity.class);
  intent.putExtra("String_Node_Str",m_device.getMacAddress());
  intent.putExtra("String_Node_Str",m_service.getUuid().toString());
  intent.putExtra("String_Node_Str",bgc.getUuid().toString());
  context.startActivity(intent);
}
Program: 93899
Project: 93899
Buggy source:
@Override public View getChildView(int groupPosition,int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  final DescViewHolder h;
  if (convertView == null) {
    convertView=View.inflate(parent.getContext(),R.layout.descriptor_layout,null);
    h=new DescViewHolder();
    h.name=(TextView)convertView.findViewById(R.id.descriptorName);
    h.uuid=(TextView)convertView.findViewById(R.id.uuid);
    h.value=(TextView)convertView.findViewById(R.id.value);
    convertView.setTag(h);
  }
 else {
    h=(DescViewHolder)convertView.getTag();
  }
  final BluetoothGattCharacteristic characteristic=m_characteristicList.get(groupPosition);
  final List<BluetoothGattDescriptor> descList=m_charDescMap.get(characteristic);
  final BluetoothGattDescriptor descriptor=descList.get(childPosition);
  final String name=UuidUtil.getDescriptorName(descriptor);
  h.name.setText(name);
  final String uuid;
  if (name.equals(UuidUtil.CUSTOM_DESCRIPTOR)) {
    uuid=descriptor.getUuid().toString();
  }
 else {
    uuid=UuidUtil.getShortUuid(descriptor.getUuid());
  }
  h.uuid.setText(uuid);
  return convertView;
}

Fixed version (ground truth):
@Override public View getChildView(int groupPosition,int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  final DescViewHolder h;
  if (convertView == null) {
    convertView=View.inflate(parent.getContext(),R.layout.descriptor_layout,null);
    h=new DescViewHolder();
    h.name=(TextView)convertView.findViewById(R.id.descriptorName);
    h.uuid=(TextView)convertView.findViewById(R.id.uuid);
    h.value=(TextView)convertView.findViewById(R.id.value);
    convertView.setTag(h);
  }
 else {
    h=(DescViewHolder)convertView.getTag();
  }
  final BluetoothGattCharacteristic characteristic=m_characteristicList.get(groupPosition);
  final List<BluetoothGattDescriptor> descList=m_charDescMap.get(characteristic);
  final BluetoothGattDescriptor descriptor=descList.get(childPosition);
  final String name=UuidUtil.getDescriptorName(descriptor);
  h.name.setText(name);
  final String uuid;
  if (name.equals(UuidUtil.CUSTOM_DESCRIPTOR)) {
    uuid=descriptor.getUuid().toString();
  }
 else {
    uuid=UuidUtil.getShortUuid(descriptor.getUuid());
  }
  h.uuid.setText(uuid);
  String hexString=(descriptor != null && descriptor.getValue() != null ? Utils_Byte.bytesToHexString(descriptor.getValue()) : "String_Node_Str");
  h.value.setText(hexString);
  ViewUtil.postFixRunnable(h.uuid);
  return convertView;
}
Program: 93900
Project: 93900
Buggy source:
public CharacteristicAdapter(Context context,@NonNull BleDevice device,@NonNull BluetoothGattService service,@NonNull List<BluetoothGattCharacteristic> charList){
  READ=context.getString(R.string.read);
  WRITE=context.getString(R.string.write);
  NOTIFY=context.getString(R.string.notify);
  INDICATE=context.getString(R.string.indicate);
  BROADCAST=context.getString(R.string.broadcast);
  SIGNED_WRITE=context.getString(R.string.signed_write);
  EXTENDED_PROPS=context.getString(R.string.extended_properties);
  WRITE_NO_RESPONSE=context.getString(R.string.write_no_response);
  m_device=device;
  m_service=service;
  m_charDescMap=new HashMap<>(charList.size());
  m_characteristicList=charList;
  Collections.sort(m_characteristicList,new CharacteristicComparator());
  for (  BluetoothGattCharacteristic ch : charList) {
    m_charDescMap.put(ch,ch.getDescriptors());
    m_device.read(ch.getUuid(),new BleDevice.ReadWriteListener(){
      @Override public void onEvent(      ReadWriteEvent e){
        notifyDataSetChanged();
      }
    }
);
  }
}

Fixed version (ground truth):
public CharacteristicAdapter(Context context,@NonNull BleDevice device,@NonNull BluetoothGattService service,@NonNull List<BluetoothGattCharacteristic> charList){
  READ=context.getString(R.string.read);
  WRITE=context.getString(R.string.write);
  NOTIFY=context.getString(R.string.notify);
  INDICATE=context.getString(R.string.indicate);
  BROADCAST=context.getString(R.string.broadcast);
  SIGNED_WRITE=context.getString(R.string.signed_write);
  EXTENDED_PROPS=context.getString(R.string.extended_properties);
  WRITE_NO_RESPONSE=context.getString(R.string.write_no_response);
  m_device=device;
  m_service=service;
  m_charDescMap=new HashMap<>(charList.size());
  m_characteristicList=charList;
  Collections.sort(m_characteristicList,new CharacteristicComparator());
  for (  BluetoothGattCharacteristic ch : charList) {
    m_charDescMap.put(ch,ch.getDescriptors());
    m_device.read(ch.getUuid(),new BleDevice.ReadWriteListener(){
      @Override public void onEvent(      ReadWriteEvent e){
        notifyDataSetChanged();
      }
    }
);
    List<BluetoothGattDescriptor> descriptorList=ch.getDescriptors();
    for (    BluetoothGattDescriptor bgd : descriptorList) {
      m_device.readDescriptor(ch.getUuid(),bgd.getUuid());
    }
  }
}
Program: 93902
Project: 93902
Buggy source:
@Override public void run(){
  long currentTime=System.currentTimeMillis();
  double timeStep=((double)currentTime - m_lastAutoUpdateTime) / 1000.0;
  timeStep=timeStep <= 0.0 ? .00001 : timeStep;
  update(timeStep,currentTime);
  m_lastAutoUpdateTime=currentTime;
  if (!m_shutdown) {
    m_postManager.postToUpdateThreadDelayed(this,m_autoUpdateRate);
  }
}

Fixed version (ground truth):
@Override public void run(){
  long currentTime=System.currentTimeMillis();
  if (m_lastAutoUpdateTime == null) {
    m_lastAutoUpdateTime=currentTime;
  }
  double timeStep=((double)currentTime - m_lastAutoUpdateTime) / 1000.0;
  timeStep=timeStep <= 0.0 ? .00001 : timeStep;
  update(timeStep,currentTime);
  m_lastAutoUpdateTime=currentTime;
  if (!m_shutdown) {
    m_postManager.postToUpdateThreadDelayed(this,m_autoUpdateRate);
  }
}
Program: 93903
Project: 93903
Buggy source:
/** 
 * Disconnects all devices, shuts down the BleManager, and it's backing thread, and unregisters any receivers that may be in use. This also clears out it's static instance. This is meant to be called upon application exit. However, to use it again, just call   {@link BleManager#get(Context)}, or   {@link BleManager#get(Context,BleManagerConfig)} again.
 */
public final void shutdown(){
  disconnectAll();
  m_updateRunnable.m_shutdown=true;
  m_postManager.removeUpdateCallbacks(m_updateRunnable);
  m_postManager.quit();
  m_wakeLockMngr.clear();
  m_listeners.onDestroy();
  s_instance=null;
}

Fixed version (ground truth):
/** 
 * Disconnects all devices, shuts down the BleManager, and it's backing thread, and unregisters any receivers that may be in use. This also clears out it's static instance. This is meant to be called upon application exit. However, to use it again, just call   {@link BleManager#get(Context)}, or   {@link BleManager#get(Context,BleManagerConfig)} again.
 */
public final void shutdown(){
  disconnectAll();
  m_uhOhThrottler.shutdown();
  m_updateRunnable.m_shutdown=true;
  m_postManager.removeUpdateCallbacks(m_updateRunnable);
  m_postManager.quit();
  m_wakeLockMngr.clear();
  m_listeners.onDestroy();
  s_instance=null;
}
Program: 93904
Project: 93904
Buggy source:
public P_UhOhThrottler(BleManager mngr,double throttle){
  m_mngr=mngr;
  m_throttle=throttle;
}

Fixed version (ground truth):
public P_UhOhThrottler(BleManager mngr,double throttle){
  m_mngr=mngr;
  m_throttle=throttle;
  if (mngr.m_config.manageLastUhOhOnDisk) {
    loadLastUhOhs();
  }
}
Program: 93905
Project: 93905
Buggy source:
public synchronized void setListener(UhOhListener listener){
  m_uhOhListener=listener;
}

Fixed version (ground truth):
public final synchronized void setListener(UhOhListener listener){
  m_uhOhListener=listener;
}
Program: 93906
Project: 93906
Buggy source:
void update(double timeStep){
  m_timeTracker+=timeStep;
}

Fixed version (ground truth):
final void update(double timeStep){
  m_timeTracker+=timeStep;
}
Program: 93907
Project: 93907
Buggy source:
synchronized void uhOh(UhOh reason,double throttle){
  m_mngr.getLogger().w(reason + "String_Node_Str");
  if (throttle > 0.0) {
    Double lastTimeCalled=m_lastTimesCalled.get(reason);
    if (lastTimeCalled != null) {
      if (m_timeTracker - lastTimeCalled < throttle) {
        return;
      }
    }
  }
  if (m_uhOhListener != null) {
    m_lastTimesCalled.put(reason,m_timeTracker);
    UhOhEvent event=new UhOhEvent(m_mngr,reason);
    m_mngr.postEvent(m_uhOhListener,event);
  }
}

Fixed version (ground truth):
final synchronized void uhOh(UhOh reason,double throttle){
  m_mngr.getLogger().w(reason + "String_Node_Str");
  if (throttle > 0.0) {
    Double lastTimeCalled=m_lastTimesCalled.get(reason);
    if (lastTimeCalled != null) {
      if (m_timeTracker - lastTimeCalled < throttle) {
        return;
      }
    }
  }
  if (m_mngr.m_config.manageLastUhOhOnDisk) {
    prefs().edit().putString(reason.toString(),String.valueOf(m_timeTracker)).putString(TIME_TRACKER_KEY,String.valueOf(m_timeTracker)).putString(LAST_TIME,String.valueOf(System.currentTimeMillis())).commit();
  }
  if (m_uhOhListener != null) {
    m_lastTimesCalled.put(reason,m_timeTracker);
    UhOhEvent event=new UhOhEvent(m_mngr,reason);
    m_mngr.postEvent(m_uhOhListener,event);
  }
}
Program: 93908
Project: 93908
Buggy source:
final boolean startScan_private(ScanOptions options){
  m_scanManager.resetTimeNotScanning();
  options.m_scanTime=options.m_scanTime.secs() < 0.0 ? Interval.INFINITE : options.m_scanTime;
  if (false == isBluetoothEnabled()) {
    m_logger.e(BleManager.class.getSimpleName() + "String_Node_Str" + ON+ "String_Node_Str");
    return false;
  }
  m_scanManager.setInfiniteScan(options.m_scanTime.equals(Interval.INFINITE));
  if (options.m_discoveryListener != null) {
    setListener_Discovery(options.m_discoveryListener);
  }
  if (options.m_scanFilter != null) {
    m_filterMngr.add(options.m_scanFilter);
  }
  if (options.m_isPeriodic) {
    m_config.autoScanActiveTime=options.m_scanTime;
    m_config.autoScanPauseInterval=options.m_pauseTime;
  }
  final P_Task_Scan scanTask=m_taskQueue.get(P_Task_Scan.class,this);
  if (scanTask != null) {
    scanTask.resetTimeout(options.m_scanTime.secs());
  }
 else {
    ASSERT(!m_taskQueue.isCurrentOrInQueue(P_Task_Scan.class,this));
    m_stateTracker.append(BleManagerState.STARTING_SCAN,E_Intent.INTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE);
    PE_TaskPriority pri=options.m_isPriorityScan ? PE_TaskPriority.CRITICAL : null;
    boolean startScan=true;
    if (options.m_isPeriodic) {
      if (!doAutoScan()) {
        startScan=false;
      }
    }
    if (startScan) {
      m_taskQueue.add(new P_Task_Scan(this,m_listeners.getScanTaskListener(),options.m_scanTime.secs(),pri));
    }
  }
  return true;
}

Fixed version (ground truth):
final boolean startScan_private(ScanOptions options){
  if (m_taskQueue.isInQueue(P_Task_Scan.class,this)) {
    getLogger().w("String_Node_Str");
    return false;
  }
  if (false == isBluetoothEnabled()) {
    m_logger.e(BleManager.class.getSimpleName() + "String_Node_Str" + ON+ "String_Node_Str");
    return false;
  }
  final P_Task_Scan scanTask=m_taskQueue.get(P_Task_Scan.class,this);
  if (scanTask != null) {
    scanTask.resetTimeout(options.m_scanTime.secs());
  }
 else {
    ASSERT(!m_taskQueue.isCurrentOrInQueue(P_Task_Scan.class,this));
    m_stateTracker.append(BleManagerState.STARTING_SCAN,E_Intent.INTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE);
    m_scanManager.resetTimeNotScanning();
    options.m_scanTime=options.m_scanTime.secs() < 0.0 ? Interval.INFINITE : options.m_scanTime;
    m_scanManager.setInfiniteScan(options.m_scanTime.equals(Interval.INFINITE));
    if (options.m_discoveryListener != null) {
      setListener_Discovery(options.m_discoveryListener);
    }
    if (options.m_scanFilter != null) {
      m_filterMngr.add(options.m_scanFilter);
    }
    if (options.m_isPeriodic) {
      m_config.autoScanActiveTime=options.m_scanTime;
      m_config.autoScanPauseInterval=options.m_pauseTime;
    }
    PE_TaskPriority pri=options.m_isPriorityScan ? PE_TaskPriority.CRITICAL : null;
    boolean startScan=true;
    if (options.m_isPeriodic) {
      if (!doAutoScan()) {
        startScan=false;
      }
    }
    if (startScan) {
      m_taskQueue.add(new P_Task_Scan(this,m_listeners.getScanTaskListener(),options.m_scanTime.secs(),pri));
    }
  }
  return true;
}
Program: 93910
Project: 93910
Buggy source:
@Override public String toString(){
  final String current=m_current.get() != null ? m_current.toString() : "String_Node_Str";
  final String queue=m_queue.size() > 0 ? m_queue.toString() : "String_Node_Str";
  final String toReturn=current + "String_Node_Str" + queue;
  return toReturn;
}

Fixed version (ground truth):
@Override public String toString(){
  final String current=m_current.get() != null ? m_current.get().toString() : "String_Node_Str";
  final String queue=m_queue.size() > 0 ? m_queue.toString() : "String_Node_Str";
  final String toReturn=current + "String_Node_Str" + queue;
  return toReturn;
}
Program: 93911
Project: 93911
Buggy source:
public P_Task_Scan(BleManager manager,I_StateListener listener,double scanTime,PE_TaskPriority priority){
  super(manager,listener);
  m_priority=priority == null ? PE_TaskPriority.TRIVIAL : priority;
  m_scanTime=scanTime;
}

Fixed version (ground truth):
public P_Task_Scan(BleManager manager,I_StateListener listener,double scanTime,PE_TaskPriority priority){
  super(manager,listener);
  m_priority=priority == null ? PE_TaskPriority.TRIVIAL : priority;
  m_scanTime=scanTime;
  Log.e("String_Node_Str","String_Node_Str");
  new Exception().printStackTrace();
}
Program: 93913
Project: 93913
Buggy source:
final void postScanResult(final BluetoothDevice device,final int rssi,final byte[] scanRecord){
  final Pointer<String> name=new Pointer<>(device.getName());
  m_manager.getPostManager().runOrPostToUpdateThread(new Runnable(){
    @Override public void run(){
      final P_NativeDeviceLayer layer=m_manager.m_config.newDeviceLayer(BleDevice.NULL);
      layer.setNativeDevice(device);
      final String name2=device.getName();
      if (name.value != null && name2 != null && !name.value.equals(name2)) {
        return;
      }
      m_manager.getCrashResolver().notifyScannedDevice(layer,m_preLollipopScanCallback);
      m_manager.onDiscoveredFromNativeStack(layer,rssi,scanRecord);
    }
  }
);
}

Fixed version (ground truth):
final void postScanResult(final BluetoothDevice device,final int rssi,final byte[] scanRecord){
  final Pointer<String> name=new Pointer<>(device != null ? device.getName() : null);
  m_manager.getPostManager().runOrPostToUpdateThread(new Runnable(){
    @Override public void run(){
      final P_NativeDeviceLayer layer=m_manager.m_config.newDeviceLayer(BleDevice.NULL);
      layer.setNativeDevice(device);
      final String name2=device != null ? device.getName() : null;
      if (name.value != null && name2 != null && !name.value.equals(name2)) {
        return;
      }
      m_manager.getCrashResolver().notifyScannedDevice(layer,m_preLollipopScanCallback);
      m_manager.onDiscoveredFromNativeStack(layer,rssi,scanRecord);
    }
  }
);
}
Program: 93914
Project: 93914
Buggy source:
@Test public void defaultInitTransactionTest() throws Exception {
  m_config.runOnMainThread=false;
  m_config.defaultScanFilter=new BleManagerConfig.ScanFilter(){
    @Override public Please onEvent(    ScanEvent e){
      return Please.acknowledgeIf(e.name_native().contains("String_Node_Str"));
    }
  }
;
  m_config.defaultInitFactory=new BleDeviceConfig.InitTransactionFactory(){
    @Override public BleTransaction.Init newInitTxn(){
      return new BleTransaction.Init(){
        @Override protected void start(        BleDevice device){
          device.read(mInitServiceUuid,mInitCharUuid,new BleDevice.ReadWriteListener(){
            @Override public void onEvent(            ReadWriteEvent e){
              succeed();
            }
          }
);
        }
      }
;
    }
  }
;
  m_config.loggingEnabled=true;
  connectToMultipleDevices(m_config);
  m_mgr.stopScan();
  m_mgr.disconnectAll();
  m_config.runOnMainThread=true;
  connectToMultipleDevices(m_config);
}

Fixed version (ground truth):
@Test(timeout=10000) public void defaultInitTransactionTest() throws Exception {
  m_config.runOnMainThread=false;
  m_config.defaultScanFilter=new BleManagerConfig.ScanFilter(){
    @Override public Please onEvent(    ScanEvent e){
      return Please.acknowledgeIf(e.name_native().contains("String_Node_Str"));
    }
  }
;
  m_config.defaultInitFactory=new BleDeviceConfig.InitTransactionFactory(){
    @Override public BleTransaction.Init newInitTxn(){
      return new BleTransaction.Init(){
        @Override protected void start(        BleDevice device){
          device.read(mInitServiceUuid,mInitCharUuid,new BleDevice.ReadWriteListener(){
            @Override public void onEvent(            ReadWriteEvent e){
              succeed();
            }
          }
);
        }
      }
;
    }
  }
;
  m_config.loggingEnabled=true;
  connectToMultipleDevices(m_config);
  m_mgr.stopScan();
  m_mgr.disconnectAll();
  m_config.runOnMainThread=true;
  connectToMultipleDevices(m_config);
}
Program: 93915
Project: 93915
Buggy source:
@Test public void defaultAuthTransactionTest() throws Exception {
  m_config.runOnMainThread=false;
  m_config.defaultScanFilter=new BleManagerConfig.ScanFilter(){
    @Override public Please onEvent(    ScanEvent e){
      return Please.acknowledgeIf(e.name_native().contains("String_Node_Str"));
    }
  }
;
  m_config.defaultAuthFactory=new BleDeviceConfig.AuthTransactionFactory(){
    @Override public BleTransaction.Auth newAuthTxn(){
      return new BleTransaction.Auth(){
        @Override protected void start(        BleDevice device){
          device.read(mAuthServiceUuid,mAuthCharUuid,new BleDevice.ReadWriteListener(){
            @Override public void onEvent(            ReadWriteEvent e){
              succeed();
            }
          }
);
        }
      }
;
    }
  }
;
  m_config.loggingEnabled=true;
  connectToMultipleDevices(m_config);
  m_mgr.stopScan();
  m_mgr.disconnectAll();
  m_config.runOnMainThread=true;
  connectToMultipleDevices(m_config);
}

Fixed version (ground truth):
@Test(timeout=10000) public void defaultAuthTransactionTest() throws Exception {
  m_config.runOnMainThread=false;
  m_config.defaultScanFilter=new BleManagerConfig.ScanFilter(){
    @Override public Please onEvent(    ScanEvent e){
      return Please.acknowledgeIf(e.name_native().contains("String_Node_Str"));
    }
  }
;
  m_config.defaultAuthFactory=new BleDeviceConfig.AuthTransactionFactory(){
    @Override public BleTransaction.Auth newAuthTxn(){
      return new BleTransaction.Auth(){
        @Override protected void start(        BleDevice device){
          device.read(mAuthServiceUuid,mAuthCharUuid,new BleDevice.ReadWriteListener(){
            @Override public void onEvent(            ReadWriteEvent e){
              succeed();
            }
          }
);
        }
      }
;
    }
  }
;
  m_config.loggingEnabled=true;
  connectToMultipleDevices(m_config);
  m_mgr.stopScan();
  m_mgr.disconnectAll();
  m_config.runOnMainThread=true;
  connectToMultipleDevices(m_config);
}
Program: 93916
Project: 93916
Buggy source:
@Test public void defaultAuthAndInitTransactionTest() throws Exception {
  m_config.runOnMainThread=false;
  m_config.defaultScanFilter=new BleManagerConfig.ScanFilter(){
    @Override public Please onEvent(    ScanEvent e){
      return Please.acknowledgeIf(e.name_native().contains("String_Node_Str"));
    }
  }
;
  m_config.defaultInitFactory=new BleDeviceConfig.InitTransactionFactory(){
    @Override public BleTransaction.Init newInitTxn(){
      return new BleTransaction.Init(){
        @Override protected void start(        BleDevice device){
          device.read(mInitServiceUuid,mInitCharUuid,new BleDevice.ReadWriteListener(){
            @Override public void onEvent(            ReadWriteEvent e){
              succeed();
            }
          }
);
        }
      }
;
    }
  }
;
  m_config.defaultAuthFactory=new BleDeviceConfig.AuthTransactionFactory(){
    @Override public BleTransaction.Auth newAuthTxn(){
      return new BleTransaction.Auth(){
        @Override protected void start(        BleDevice device){
          device.read(mAuthServiceUuid,mAuthCharUuid,new BleDevice.ReadWriteListener(){
            @Override public void onEvent(            ReadWriteEvent e){
              succeed();
            }
          }
);
        }
      }
;
    }
  }
;
  m_config.loggingEnabled=true;
  connectToMultipleDevices(m_config);
  m_mgr.stopScan();
  m_mgr.disconnectAll();
  m_config.runOnMainThread=true;
  connectToMultipleDevices(m_config);
}

Fixed version (ground truth):
@Test(timeout=10000) public void defaultAuthAndInitTransactionTest() throws Exception {
  m_config.runOnMainThread=false;
  m_config.defaultScanFilter=new BleManagerConfig.ScanFilter(){
    @Override public Please onEvent(    ScanEvent e){
      return Please.acknowledgeIf(e.name_native().contains("String_Node_Str"));
    }
  }
;
  m_config.defaultInitFactory=new BleDeviceConfig.InitTransactionFactory(){
    @Override public BleTransaction.Init newInitTxn(){
      return new BleTransaction.Init(){
        @Override protected void start(        BleDevice device){
          device.read(mInitServiceUuid,mInitCharUuid,new BleDevice.ReadWriteListener(){
            @Override public void onEvent(            ReadWriteEvent e){
              succeed();
            }
          }
);
        }
      }
;
    }
  }
;
  m_config.defaultAuthFactory=new BleDeviceConfig.AuthTransactionFactory(){
    @Override public BleTransaction.Auth newAuthTxn(){
      return new BleTransaction.Auth(){
        @Override protected void start(        BleDevice device){
          device.read(mAuthServiceUuid,mAuthCharUuid,new BleDevice.ReadWriteListener(){
            @Override public void onEvent(            ReadWriteEvent e){
              succeed();
            }
          }
);
        }
      }
;
    }
  }
;
  m_config.loggingEnabled=true;
  connectToMultipleDevices(m_config);
  m_mgr.stopScan();
  m_mgr.disconnectAll();
  m_config.runOnMainThread=true;
  connectToMultipleDevices(m_config);
}
Program: 93917
Project: 93917
Buggy source:
private void BleManager(Context context,BleManagerConfig config){
  m_context=context.getApplicationContext();
  m_currentTick=System.currentTimeMillis();
  addLifecycleCallbacks();
  m_config=config.clone();
  m_scanManager=new P_ScanManager(this);
  initLogger(null);
  m_historicalDatabase=PU_HistoricalData.newDatabase(context,this);
  m_diskOptionsMngr=new P_DiskOptionsManager(m_context);
  m_filterMngr=new P_ScanFilterManager(this,m_config.defaultScanFilter);
  if (m_config.nativeManagerLayer.isManagerNull()) {
    m_config.nativeManagerLayer.resetManager(m_context);
  }
  BleManagerState nativeState=BleManagerState.get(m_config.nativeManagerLayer.getState());
  if (m_timeTurnedOn == 0 && nativeState.overlaps(BluetoothAdapter.STATE_ON)) {
    m_timeTurnedOn=System.currentTimeMillis();
  }
  m_stateTracker=new P_BleStateTracker(this);
  m_stateTracker.append(nativeState,E_Intent.UNINTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE);
  m_nativeStateTracker=new P_NativeBleStateTracker(this);
  m_nativeStateTracker.append(nativeState,E_Intent.UNINTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE);
  m_taskQueue=new P_TaskQueue(this);
  m_crashResolver=new P_BluetoothCrashResolver(m_context);
  m_deviceMngr=new P_DeviceManager(this);
  m_deviceMngr_cache=new P_DeviceManager(this);
  m_listeners=new P_BleManager_Listeners(this);
  initConfigDependentMembers();
  m_logger.printBuildInfo();
}

Fixed version (ground truth):
private void BleManager(Context context,BleManagerConfig config){
  m_context=context.getApplicationContext();
  m_currentTick=System.currentTimeMillis();
  addLifecycleCallbacks();
  m_config=config.clone();
  m_scanManager=new P_ScanManager(this);
  initLogger(null);
  m_historicalDatabase=PU_HistoricalData.newDatabase(context,this);
  m_diskOptionsMngr=new P_DiskOptionsManager(m_context);
  m_filterMngr=new P_ScanFilterManager(this,m_config.defaultScanFilter);
  if (m_config.nativeManagerLayer.isManagerNull()) {
    m_config.nativeManagerLayer.resetManager(m_context);
  }
  BleManagerState nativeState=BleManagerState.get(m_config.nativeManagerLayer.getState());
  if (m_timeTurnedOn == 0 && nativeState.overlaps(BluetoothAdapter.STATE_ON)) {
    m_timeTurnedOn=System.currentTimeMillis();
  }
  m_stateTracker=new P_BleStateTracker(this);
  m_stateTracker.append(nativeState,E_Intent.UNINTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE);
  m_nativeStateTracker=new P_NativeBleStateTracker(this);
  m_nativeStateTracker.append(nativeState,E_Intent.UNINTENTIONAL,BleStatuses.GATT_STATUS_NOT_APPLICABLE);
  m_taskQueue=new P_TaskQueue(this);
  m_crashResolver=new P_BluetoothCrashResolver(m_context);
  m_deviceMngr=new P_DeviceManager(this);
  m_deviceMngr_cache=new P_DeviceManager(this);
  m_listeners=new P_BleManager_Listeners(this);
  m_lastTaskExecution=System.currentTimeMillis();
  initConfigDependentMembers();
  m_logger.printBuildInfo();
}
Program: 93918
Project: 93918
Buggy source:
@Override public void run(){
  long currentTime=System.currentTimeMillis();
  double timeStep=((double)currentTime - m_lastAutoUpdateTime) / 1000.0;
  timeStep=timeStep <= 0.0 ? .00001 : timeStep;
  timeStep=timeStep > 1.0 ? 1.0 : timeStep;
  update(timeStep,currentTime);
  m_lastAutoUpdateTime=currentTime;
  m_postManager.postToUpdateThreadDelayed(this,m_autoUpdateRate);
}

Fixed version (ground truth):
@Override public void run(){
  long currentTime=System.currentTimeMillis();
  double timeStep=((double)currentTime - m_lastAutoUpdateTime) / 1000.0;
  timeStep=timeStep <= 0.0 ? .00001 : timeStep;
  timeStep=timeStep > 1.0 ? 1.0 : timeStep;
  update(timeStep,currentTime);
  m_lastAutoUpdateTime=currentTime;
  if (!m_shutdown) {
    m_postManager.postToUpdateThreadDelayed(this,m_autoUpdateRate);
  }
}
Program: 93919
Project: 93919
Buggy source:
/** 
 * Shuts down the BleManager, and it's backing thread, and unregisters any receivers that may be in use. This also clears out it's static instance. This is meant to be called upon application exit. However, to use it again, just call   {@link BleManager#get(Context)}, or   {@link BleManager#get(Context,BleManagerConfig)} again.
 */
public final void shutdown(){
  m_postManager.removeUpdateCallbacks(m_updateRunnable);
  m_postManager.quit();
  m_wakeLockMngr.clear();
  m_listeners.onDestroy();
  s_instance=null;
}

Fixed version (ground truth):
/** 
 * Shuts down the BleManager, and it's backing thread, and unregisters any receivers that may be in use. This also clears out it's static instance. This is meant to be called upon application exit. However, to use it again, just call   {@link BleManager#get(Context)}, or   {@link BleManager#get(Context,BleManagerConfig)} again.
 */
public final void shutdown(){
  m_updateRunnable.m_shutdown=true;
  m_postManager.removeUpdateCallbacks(m_updateRunnable);
  m_postManager.quit();
  m_wakeLockMngr.clear();
  m_listeners.onDestroy();
  s_instance=null;
}