Program: 94687
Project: 94687
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  final String action=intent.getAction();
switch (action) {
case WifiManager.SCAN_RESULTS_AVAILABLE_ACTION:
    break;
case WifiManager.NETWORK_STATE_CHANGED_ACTION:
  NetworkInfo netInfo=intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
NetworkInfo.State networkState=netInfo == null ? NetworkInfo.State.DISCONNECTED : netInfo.getState();
switch (networkState) {
case CONNECTED:
final WifiInfo wifiInfo=intent.getParcelableExtra(WifiManager.EXTRA_WIFI_INFO);
final String wifiSSID=wifiInfo.getSSID();
Timber.i("String_Node_Str" + wifiSSID);
final DhcpInfo dhcpInfo=wifiMgr.getDhcpInfo();
if (dhcpInfo != null) {
Timber.i("String_Node_Str",dhcpInfo.toString());
}
 else {
Timber.w("String_Node_Str");
}
if (wifiSSID != null) {
final Runnable onConnection=onConnectionActions.get(wifiSSID);
if (wifiSSID.startsWith("String_Node_Str")) {
Timber.i("String_Node_Str");
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
NetworkRequest 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();
connMgr.requestNetwork(netReq,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){
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);
  if (onConnection != null) {
    onConnection.run();
  }
}
 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 {
if (onConnection != null) {
onConnection.run();
}
}
}
 else {
if (onConnection != null) {
onConnection.run();
}
}
}
break;
case DISCONNECTED:
Timber.i("String_Node_Str");
refreshWifiAPs();
break;
case CONNECTING:
Timber.d("String_Node_Str");
break;
}
break;
case WifiManager.WIFI_STATE_CHANGED_ACTION:
refreshWifiAPs();
break;
}
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  final String action=intent.getAction();
switch (action) {
case WifiManager.SCAN_RESULTS_AVAILABLE_ACTION:
    break;
case WifiManager.NETWORK_STATE_CHANGED_ACTION:
  NetworkInfo netInfo=intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
NetworkInfo.State networkState=netInfo == null ? NetworkInfo.State.DISCONNECTED : netInfo.getState();
switch (networkState) {
case CONNECTED:
final WifiInfo wifiInfo=intent.getParcelableExtra(WifiManager.EXTRA_WIFI_INFO);
final String wifiSSID=wifiInfo.getSSID();
Timber.i("String_Node_Str" + wifiSSID);
final DhcpInfo dhcpInfo=wifiMgr.getDhcpInfo();
if (dhcpInfo != null) {
Timber.i("String_Node_Str",dhcpInfo.toString());
}
 else {
Timber.w("String_Node_Str");
}
if (wifiSSID != null) {
final Runnable onConnection=onConnectionActions.remove(wifiSSID);
if (wifiSSID.startsWith("String_Node_Str")) {
Timber.i("String_Node_Str");
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
NetworkRequest 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();
connMgr.requestNetwork(netReq,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){
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);
  if (onConnection != null) {
    onConnection.run();
  }
}
 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 {
if (onConnection != null) {
onConnection.run();
}
}
}
 else {
if (onConnection != null) {
onConnection.run();
}
}
}
break;
case DISCONNECTED:
Timber.i("String_Node_Str");
refreshWifiAPs();
break;
case CONNECTING:
Timber.d("String_Node_Str");
break;
}
break;
case WifiManager.WIFI_STATE_CHANGED_ACTION:
refreshWifiAPs();
break;
}
}