Program: 94689
Project: 94689
Buggy source:
public WifiConnectionHandler(Context context){
  this.context=context;
  this.wifiMgr=(WifiManager)this.context.getSystemService(Context.WIFI_SERVICE);
  this.connMgr=(ConnectivityManager)this.context.getSystemService(Context.CONNECTIVITY_SERVICE);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    netReq=new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_TRUSTED).addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED).addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN).addTransportType(NetworkCapabilities.TRANSPORT_WIFI).build();
    netReqCb=new ConnectivityManager.NetworkCallback(){
      @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void getNetworkInfo(      Network network){
        if (network == null) {
          Timber.i("String_Node_Str");
        }
 else {
          Timber.i("String_Node_Str",network,connMgr.isDefaultNetworkActive());
          LinkProperties linkProps=connMgr.getLinkProperties(network);
          Timber.i("String_Node_Str",linkProps.toString());
          Timber.i("String_Node_Str",connMgr.getNetworkCapabilities(network));
        }
      }
      @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onAvailable(      Network network){
        final String currentWifi=getCurrentWifiLink();
        if (!isSoloWifi(currentWifi)) {
          Timber.i("String_Node_Str");
          connMgr.unregisterNetworkCallback(this);
          connectedSoloWifi.set("String_Node_Str");
          return;
        }
        Timber.i("String_Node_Str",network);
        getNetworkInfo(network);
        final boolean wasBound;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
          wasBound=connMgr.bindProcessToNetwork(network);
        }
 else {
          wasBound=ConnectivityManager.setProcessDefaultNetwork(network);
        }
        if (wasBound) {
          Timber.i("String_Node_Str",network);
          notifyWifiConnected(currentWifi);
        }
 else {
          Timber.w("String_Node_Str",network);
        }
      }
      @Override public void onLosing(      Network network,      int maxMsToLive){
        Timber.w("String_Node_Str",network);
      }
      @Override public void onLost(      Network network){
        Timber.w("String_Node_Str",network);
      }
    }
;
  }
 else {
    netReq=null;
    netReqCb=null;
  }
}

Fixed version (ground truth):
public WifiConnectionHandler(Context context){
  this.context=context;
  this.wifiMgr=(WifiManager)this.context.getSystemService(Context.WIFI_SERVICE);
  this.connMgr=(ConnectivityManager)this.context.getSystemService(Context.CONNECTIVITY_SERVICE);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    netReq=new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_TRUSTED).addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED).addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN).addTransportType(NetworkCapabilities.TRANSPORT_WIFI).build();
    netReqCb=new ConnectivityManager.NetworkCallback(){
      @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void getNetworkInfo(      Network network){
        if (network == null) {
          Timber.i("String_Node_Str");
        }
 else {
          Timber.i("String_Node_Str",network,connMgr.isDefaultNetworkActive());
          LinkProperties linkProps=connMgr.getLinkProperties(network);
          Timber.i("String_Node_Str",linkProps.toString());
          Timber.i("String_Node_Str",connMgr.getNetworkCapabilities(network));
        }
      }
      @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onAvailable(      Network network){
        final String currentWifi=getCurrentWifiLink();
        if (!isSoloWifi(currentWifi)) {
          resetNetworkBindings(this);
          return;
        }
        Timber.i("String_Node_Str",network);
        getNetworkInfo(network);
        final boolean wasBound;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
          wasBound=connMgr.bindProcessToNetwork(network);
        }
 else {
          wasBound=ConnectivityManager.setProcessDefaultNetwork(network);
        }
        if (wasBound) {
          Timber.i("String_Node_Str",network);
          notifyWifiConnected(currentWifi);
        }
 else {
          Timber.w("String_Node_Str",network);
        }
      }
      @Override public void onLosing(      Network network,      int maxMsToLive){
        Timber.w("String_Node_Str",network);
      }
      @Override public void onLost(      Network network){
        Timber.w("String_Node_Str",network);
      }
    }
;
  }
 else {
    netReq=null;
    netReqCb=null;
  }
}