Program: 106118
Project: 106118
Buggy source:
private void finalizeMonitorServiceOnStrat(Commands cmds,DomainRouterVO router,Provider provider,long networkId){
  NetworkVO network=_networkDao.findById(networkId);
  s_logger.debug("String_Node_Str" + router + "String_Node_Str");
  List<MonitoringServiceVO> services=new ArrayList<MonitoringServiceVO>();
  if (_networkModel.isProviderSupportServiceInNetwork(network.getId(),Service.Dhcp,Provider.VirtualRouter) || _networkModel.isProviderSupportServiceInNetwork(network.getId(),Service.Dns,Provider.VirtualRouter)) {
    MonitoringServiceVO dhcpService=_monitorServiceDao.getServiceByName(MonitoringService.Service.Dhcp.toString());
    if (dhcpService != null) {
      services.add(dhcpService);
    }
  }
  if (_networkModel.isProviderSupportServiceInNetwork(network.getId(),Service.Lb,Provider.VirtualRouter)) {
    MonitoringServiceVO lbService=_monitorServiceDao.getServiceByName(MonitoringService.Service.LoadBalancing.toString());
    if (lbService != null) {
      services.add(lbService);
    }
  }
  List<MonitoringServiceVO> defaultServices=_monitorServiceDao.listDefaultServices(true);
  services.addAll(defaultServices);
  List<MonitorServiceTO> servicesTO=new ArrayList<MonitorServiceTO>();
  for (  MonitoringServiceVO service : services) {
    MonitorServiceTO serviceTO=new MonitorServiceTO(service.getService(),service.getProcessname(),service.getServiceName(),service.getServicePath(),service.getPidFile(),service.getDefault());
    servicesTO.add(serviceTO);
  }
  SetMonitorServiceCommand command=new SetMonitorServiceCommand(servicesTO);
  command.setAccessDetail(NetworkElementCommand.ROUTER_IP,getRouterControlIp(router.getId()));
  command.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP,getRouterIpInNetwork(networkId,router.getId()));
  command.setAccessDetail(NetworkElementCommand.ROUTER_NAME,router.getInstanceName());
  cmds.addCommand("String_Node_Str",command);
}

Fixed version (ground truth):
private void finalizeMonitorServiceOnStrat(Commands cmds,DomainRouterVO router,Provider provider,long networkId){
  NetworkVO network=_networkDao.findById(networkId);
  s_logger.debug("String_Node_Str" + router + "String_Node_Str");
  List<MonitoringServiceVO> services=new ArrayList<MonitoringServiceVO>();
  if (_networkModel.isProviderSupportServiceInNetwork(network.getId(),Service.Dhcp,Provider.VirtualRouter) || _networkModel.isProviderSupportServiceInNetwork(network.getId(),Service.Dns,Provider.VirtualRouter)) {
    MonitoringServiceVO dhcpService=_monitorServiceDao.getServiceByName(MonitoringService.Service.Dhcp.toString());
    if (dhcpService != null) {
      services.add(dhcpService);
    }
  }
  if (_networkModel.isProviderSupportServiceInNetwork(network.getId(),Service.Lb,Provider.VirtualRouter)) {
    MonitoringServiceVO lbService=_monitorServiceDao.getServiceByName(MonitoringService.Service.LoadBalancing.toString());
    if (lbService != null) {
      services.add(lbService);
    }
  }
  List<MonitoringServiceVO> defaultServices=_monitorServiceDao.listDefaultServices(true);
  services.addAll(defaultServices);
  List<MonitorServiceTO> servicesTO=new ArrayList<MonitorServiceTO>();
  for (  MonitoringServiceVO service : services) {
    MonitorServiceTO serviceTO=new MonitorServiceTO(service.getService(),service.getProcessname(),service.getServiceName(),service.getServicePath(),service.getPidFile(),service.isDefaultService());
    servicesTO.add(serviceTO);
  }
  SetMonitorServiceCommand command=new SetMonitorServiceCommand(servicesTO);
  command.setAccessDetail(NetworkElementCommand.ROUTER_IP,getRouterControlIp(router.getId()));
  command.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP,getRouterIpInNetwork(networkId,router.getId()));
  command.setAccessDetail(NetworkElementCommand.ROUTER_NAME,router.getInstanceName());
  cmds.addCommand("String_Node_Str",command);
}