Program: 20952
Project: 20952
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_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();
        }
      }
    }
  }
;
}

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)) {
          TimerTask task=new TimerTask(){
            @Override public void run(){
              if (mShouldResume) {
                for (                DiscoveryProvider provider : discoveryProviders) {
                  provider.start();
                }
              }
            }
          }
;
          Timer t=new Timer();
          t.schedule(task,2000);
        }
 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();
        }
      }
    }
  }
;
}