Program: 106471
Project: 106471
Buggy source:
/** 
 * @param cmd
 * @return
 */
private SetupGuestNetworkAnswer execute(SetupGuestNetworkCommand cmd){
  Connection conn=getConnection();
  NicTO nic=cmd.getNic();
  String domrIP=cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
  String domrGIP=cmd.getAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP);
  String domrName=cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
  String gw=cmd.getAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY);
  String cidr=Long.toString(NetUtils.getCidrSize(nic.getNetmask()));
  ;
  String domainName=cmd.getNetworkDomain();
  String dns=nic.getDns1();
  try {
    Set<VM> vms=VM.getByNameLabel(conn,domrName);
    if (vms == null || vms.isEmpty()) {
      return new SetupGuestNetworkAnswer(cmd,false,"String_Node_Str" + domrName);
    }
    VM vm=vms.iterator().next();
    String mac=nic.getMac();
    VIF domrVif=null;
    for (    VIF vif : vm.getVIFs(conn)) {
      String lmac=vif.getMAC(conn);
      if (lmac.equals(mac)) {
        domrVif=vif;
        break;
      }
    }
    if (domrVif == null) {
      return new SetupGuestNetworkAnswer(cmd,false,"String_Node_Str" + mac + "String_Node_Str"+ domrName);
    }
    String args="String_Node_Str" + domrIP + "String_Node_Str";
    String dev="String_Node_Str" + domrVif.getDevice(conn);
    args+="String_Node_Str" + dev;
    args+="String_Node_Str" + domrGIP;
    args+="String_Node_Str" + gw;
    args+="String_Node_Str" + cidr;
    if (dns != null && !dns.isEmpty()) {
      args+="String_Node_Str" + dns;
    }
    if (domainName != null && !domainName.isEmpty()) {
      args+="String_Node_Str" + domainName;
    }
    String result=callHostPlugin(conn,"String_Node_Str","String_Node_Str","String_Node_Str",args);
    if (result == null || result.isEmpty()) {
      return new SetupGuestNetworkAnswer(cmd,false,"String_Node_Str" + ((result == null) ? "String_Node_Str" : result));
    }
    return new SetupGuestNetworkAnswer(cmd,true,"String_Node_Str");
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + e.toString();
    s_logger.warn(msg,e);
    return new SetupGuestNetworkAnswer(cmd,false,msg);
  }
}

Fixed version (ground truth):
/** 
 * @param cmd
 * @return
 */
private SetupGuestNetworkAnswer execute(SetupGuestNetworkCommand cmd){
  Connection conn=getConnection();
  NicTO nic=cmd.getNic();
  String domrIP=cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
  String domrGIP=cmd.getAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP);
  String domrName=cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
  String gw=cmd.getAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY);
  String cidr=Long.toString(NetUtils.getCidrSize(nic.getNetmask()));
  ;
  String domainName=cmd.getNetworkDomain();
  String dns=cmd.getDefaultDns1();
  if (dns == null || dns.isEmpty()) {
    dns=cmd.getDefaultDns2();
  }
 else {
    String dns2=cmd.getDefaultDns2();
    if (dns2 != null && !dns2.isEmpty()) {
      dns+="String_Node_Str" + dns2;
    }
  }
  try {
    Set<VM> vms=VM.getByNameLabel(conn,domrName);
    if (vms == null || vms.isEmpty()) {
      return new SetupGuestNetworkAnswer(cmd,false,"String_Node_Str" + domrName);
    }
    VM vm=vms.iterator().next();
    String mac=nic.getMac();
    VIF domrVif=null;
    for (    VIF vif : vm.getVIFs(conn)) {
      String lmac=vif.getMAC(conn);
      if (lmac.equals(mac)) {
        domrVif=vif;
        break;
      }
    }
    if (domrVif == null) {
      return new SetupGuestNetworkAnswer(cmd,false,"String_Node_Str" + mac + "String_Node_Str"+ domrName);
    }
    String args="String_Node_Str" + domrIP + "String_Node_Str";
    String dev="String_Node_Str" + domrVif.getDevice(conn);
    args+="String_Node_Str" + dev;
    args+="String_Node_Str" + domrGIP;
    args+="String_Node_Str" + gw;
    args+="String_Node_Str" + cidr;
    if (dns != null && !dns.isEmpty()) {
      args+="String_Node_Str" + dns;
    }
    if (domainName != null && !domainName.isEmpty()) {
      args+="String_Node_Str" + domainName;
    }
    String result=callHostPlugin(conn,"String_Node_Str","String_Node_Str","String_Node_Str",args);
    if (result == null || result.isEmpty()) {
      return new SetupGuestNetworkAnswer(cmd,false,"String_Node_Str" + ((result == null) ? "String_Node_Str" : result));
    }
    return new SetupGuestNetworkAnswer(cmd,true,"String_Node_Str");
  }
 catch (  Exception e) {
    String msg="String_Node_Str" + e.toString();
    s_logger.warn(msg,e);
    return new SetupGuestNetworkAnswer(cmd,false,msg);
  }
}