Program: 20975
Project: 20975
Buggy source:
/** 
 * Create a new instance of DiscoveryManager. Direct use of this constructor is not recommended. In most cases, you should use DiscoveryManager.getInstance() instead.
 */
public DiscoveryManager(Context context,ConnectableDeviceStore connectableDeviceStore){
  this.context=context;
  this.connectableDeviceStore=connectableDeviceStore;
  allDevices=new ConcurrentHashMap<String,ConnectableDevice>(8,0.75f,2);
  compatibleDevices=new ConcurrentHashMap<String,ConnectableDevice>(8,0.75f,2);
  deviceClasses=new ConcurrentHashMap<String,Class<? extends DeviceService>>(4,0.75f,2);
  discoveryProviders=new CopyOnWriteArrayList<DiscoveryProvider>();
  discoveryListeners=new CopyOnWriteArrayList<DiscoveryManagerListener>();
  WifiManager wifiMgr=(WifiManager)context.getSystemService(Context.WIFI_SERVICE);
  multicastLock=wifiMgr.createMulticastLock("String_Node_Str");
  capabilityFilters=new ArrayList<CapabilityFilter>();
  pairingLevel=PairingLevel.OFF;
  receiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      String action=intent.getAction();
      if (action.equals(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION)) {
        SupplicantState state=intent.getParcelableExtra(WifiManager.EXTRA_NEW_STATE);
        if (SupplicantState.isValidState(state)) {
          if (state == SupplicantState.DISCONNECTED) {
            Log.w("String_Node_Str","String_Node_Str");
            for (            DiscoveryProvider provider : discoveryProviders) {
              provider.reset();
            }
            allDevices.clear();
            for (            ConnectableDevice device : compatibleDevices.values()) {
              handleDeviceLoss(device);
            }
            compatibleDevices.clear();
          }
        }
      }
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Create a new instance of DiscoveryManager. Direct use of this constructor is not recommended. In most cases, you should use DiscoveryManager.getInstance() instead.
 */
public DiscoveryManager(Context context,ConnectableDeviceStore connectableDeviceStore){
  this.context=context;
  this.connectableDeviceStore=connectableDeviceStore;
  allDevices=new ConcurrentHashMap<String,ConnectableDevice>(8,0.75f,2);
  compatibleDevices=new ConcurrentHashMap<String,ConnectableDevice>(8,0.75f,2);
  deviceClasses=new ConcurrentHashMap<String,Class<? extends DeviceService>>(4,0.75f,2);
  discoveryProviders=new CopyOnWriteArrayList<DiscoveryProvider>();
  discoveryListeners=new CopyOnWriteArrayList<DiscoveryManagerListener>();
  WifiManager wifiMgr=(WifiManager)context.getSystemService(Context.WIFI_SERVICE);
  multicastLock=wifiMgr.createMulticastLock("String_Node_Str");
  capabilityFilters=new ArrayList<CapabilityFilter>();
  pairingLevel=PairingLevel.OFF;
  receiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      String action=intent.getAction();
      if (action.equals(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION)) {
        if (intent.getBooleanExtra(WifiManager.EXTRA_SUPPLICANT_CONNECTED,false)) {
          if (mShouldResume) {
            for (            DiscoveryProvider provider : discoveryProviders) {
              provider.start();
            }
          }
        }
 else {
          Log.w("String_Node_Str","String_Node_Str");
          for (          DiscoveryProvider provider : discoveryProviders) {
            provider.reset();
          }
          allDevices.clear();
          for (          ConnectableDevice device : compatibleDevices.values()) {
            handleDeviceLoss(device);
          }
          compatibleDevices.clear();
          mShouldResume=true;
          stop();
        }
      }
    }
  }
;
}