Program: 1731
Project: 1731
Buggy source:
public void run(){
  for (; ; ) {
    String eventStr=mWifiNative.waitForEvent();
    if (DBG && eventStr.indexOf(SCAN_RESULTS_STR) == -1) {
      Log.d(TAG,"String_Node_Str" + eventStr + "String_Node_Str");
    }
    WifiMonitor m=null;
    mStateMachine=null;
    if (eventStr.startsWith("String_Node_Str")) {
      int space=eventStr.indexOf(' ');
      if (space != -1) {
        String iface=eventStr.substring(7,space);
        m=mWifiMonitorSingleton.getMonitor(iface);
        if (m != null) {
          if (m.mMonitoring) {
            mStateMachine=m.mWifiStateMachine;
            eventStr=eventStr.substring(space + 1);
          }
 else {
            if (DBG)             Log.d(TAG,"String_Node_Str" + iface + "String_Node_Str");
            continue;
          }
        }
 else {
          eventStr=eventStr.substring(space + 1);
        }
      }
    }
    if (mStateMachine != null) {
      if (dispatchEvent(eventStr)) {
        break;
      }
    }
 else {
      if (DBG)       Log.d(TAG,"String_Node_Str");
      boolean done=false;
      Iterator<Map.Entry<String,WifiMonitor>> it=mWifiMonitorSingleton.mIfaceMap.entrySet().iterator();
      while (it.hasNext()) {
        Map.Entry<String,WifiMonitor> e=it.next();
        m=e.getValue();
        mStateMachine=m.mWifiStateMachine;
        if (dispatchEvent(eventStr)) {
          done=true;
        }
      }
      if (done) {
        if (DBG)         Log.d(TAG,"String_Node_Str");
        mWifiMonitorSingleton.mConnected=false;
        break;
      }
    }
  }
}

Fixed version (ground truth):
public void run(){
  for (; ; ) {
    String eventStr=mWifiNative.waitForEvent();
    if (DBG && eventStr.indexOf(SCAN_RESULTS_STR) == -1) {
      Log.d(TAG,"String_Node_Str" + eventStr + "String_Node_Str");
    }
    WifiMonitor m=null;
    mStateMachine=null;
    if (eventStr.startsWith("String_Node_Str")) {
      int space=eventStr.indexOf(' ');
      if (space != -1) {
        String iface=eventStr.substring(7,space);
        m=mWifiMonitorSingleton.getMonitor(iface);
        if (m == null && iface.startsWith("String_Node_Str")) {
          m=mWifiMonitorSingleton.getMonitor("String_Node_Str");
        }
        if (m != null) {
          if (m.mMonitoring) {
            mStateMachine=m.mWifiStateMachine;
            eventStr=eventStr.substring(space + 1);
          }
 else {
            if (DBG)             Log.d(TAG,"String_Node_Str" + iface + "String_Node_Str");
            continue;
          }
        }
 else {
          eventStr=eventStr.substring(space + 1);
        }
      }
    }
    if (mStateMachine != null) {
      if (dispatchEvent(eventStr)) {
        break;
      }
    }
 else {
      if (DBG)       Log.d(TAG,"String_Node_Str");
      boolean done=false;
      Iterator<Map.Entry<String,WifiMonitor>> it=mWifiMonitorSingleton.mIfaceMap.entrySet().iterator();
      while (it.hasNext()) {
        Map.Entry<String,WifiMonitor> e=it.next();
        m=e.getValue();
        mStateMachine=m.mWifiStateMachine;
        if (dispatchEvent(eventStr)) {
          done=true;
        }
      }
      if (done) {
        if (DBG)         Log.d(TAG,"String_Node_Str");
        mWifiMonitorSingleton.mConnected=false;
        break;
      }
    }
  }
}