Program: 89310
Project: 89310
Buggy source:
@Override public void processConnect(HostVO agent,StartupCommand cmd,boolean forRebalance) throws ConnectionException {
  if (!(cmd instanceof StartupRoutingCommand)) {
    return;
  }
  long agentId=agent.getId();
  StartupRoutingCommand startup=(StartupRoutingCommand)cmd;
  if (startup.getHypervisorType() != HypervisorType.XenServer) {
    s_logger.debug("String_Node_Str");
    return;
  }
  HostVO host=_hostDao.findById(agentId);
  ClusterVO cluster=_clusterDao.findById(host.getClusterId());
  if (cluster.getGuid() == null) {
    cluster.setGuid(startup.getPool());
    _clusterDao.update(cluster.getId(),cluster);
  }
 else   if (!cluster.getGuid().equals(startup.getPool())) {
    String msg="String_Node_Str" + cluster.getId() + "String_Node_Str"+ cluster.getGuid()+ "String_Node_Str"+ cmd.getPod();
    s_logger.warn(msg);
    throw new CloudRuntimeException(msg);
  }
  String resource=null;
  Map<String,String> details=startup.getHostDetails();
  String prodBrand=details.get("String_Node_Str").trim();
  String prodVersion=details.get("String_Node_Str").trim();
  if (prodBrand.equals("String_Node_Str") && prodVersion.equals("String_Node_Str")) {
    resource=XcpServerResource.class.getName();
  }
 else   if (prodBrand.equals("String_Node_Str") && prodVersion.equals("String_Node_Str")) {
    resource=XenServer56Resource.class.getName();
  }
 else   if (prodBrand.equals("String_Node_Str") && prodVersion.equals("String_Node_Str")) {
    resource=XenServer60Resource.class.getName();
  }
 else   if (prodBrand.equals("String_Node_Str") && prodVersion.equals("String_Node_Str")) {
    String prodVersionTextShort=details.get("String_Node_Str").trim();
    if ("String_Node_Str".equals(prodVersionTextShort)) {
      resource=XenServer56SP2Resource.class.getName();
    }
 else     if ("String_Node_Str".equals(prodVersionTextShort)) {
      resource=XenServer56FP1Resource.class.getName();
    }
  }
  if (resource == null) {
    String msg="String_Node_Str" + prodBrand + "String_Node_Str"+ prodVersion;
    s_logger.debug(msg);
    throw new RuntimeException(msg);
  }
  if (!resource.equals(host.getResource())) {
    host.setResource(resource);
    host.setSetup(false);
    _hostDao.update(agentId,host);
    String msg="String_Node_Str" + host.getPrivateIpAddress() + "String_Node_Str"+ host.getResource()+ "String_Node_Str"+ resource;
    s_logger.debug(msg);
    throw new HypervisorVersionChangedException(msg);
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + agentId);
  }
  HostEnvironment env=new HostEnvironment();
  SetupCommand setup=new SetupCommand(env);
  if (_setupMultipath) {
    setup.setMultipathOn();
  }
  if (!host.isSetup()) {
    setup.setNeedSetup(true);
  }
  try {
    SetupAnswer answer=(SetupAnswer)_agentMgr.send(agentId,setup);
    if (answer != null && answer.getResult()) {
      host.setSetup(true);
      host.setLastPinged((System.currentTimeMillis() >> 10) - 5 * 60);
      _hostDao.update(host.getId(),host);
      if (answer.needReconnect()) {
        throw new ConnectionException(false,"String_Node_Str");
      }
      return;
    }
 else {
      s_logger.warn("String_Node_Str" + agentId + "String_Node_Str"+ ((answer != null) ? answer.getDetails() : "String_Node_Str"));
    }
  }
 catch (  AgentUnavailableException e) {
    s_logger.warn("String_Node_Str" + agentId + "String_Node_Str",e);
  }
catch (  OperationTimedoutException e) {
    s_logger.warn("String_Node_Str" + agentId + "String_Node_Str",e);
  }
  throw new ConnectionException(true,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void processConnect(HostVO agent,StartupCommand cmd,boolean forRebalance) throws ConnectionException {
  if (!(cmd instanceof StartupRoutingCommand)) {
    return;
  }
  long agentId=agent.getId();
  StartupRoutingCommand startup=(StartupRoutingCommand)cmd;
  if (startup.getHypervisorType() != HypervisorType.XenServer) {
    s_logger.debug("String_Node_Str");
    return;
  }
  HostVO host=_hostDao.findById(agentId);
  ClusterVO cluster=_clusterDao.findById(host.getClusterId());
  if (cluster.getGuid() == null) {
    cluster.setGuid(startup.getPool());
    _clusterDao.update(cluster.getId(),cluster);
  }
 else   if (!cluster.getGuid().equals(startup.getPool())) {
    String msg="String_Node_Str" + cluster.getId() + "String_Node_Str"+ cluster.getGuid()+ "String_Node_Str"+ cmd.getPod();
    s_logger.warn(msg);
    throw new CloudRuntimeException(msg);
  }
  String resource=null;
  Map<String,String> details=startup.getHostDetails();
  String prodBrand=details.get("String_Node_Str").trim();
  String prodVersion=details.get("String_Node_Str").trim();
  if (prodBrand.equals("String_Node_Str") && (prodVersion.equals("String_Node_Str") || prodVersion.equals("String_Node_Str"))) {
    resource=XcpServerResource.class.getName();
  }
 else   if (prodBrand.equals("String_Node_Str") && prodVersion.equals("String_Node_Str")) {
    resource=XenServer56Resource.class.getName();
  }
 else   if (prodBrand.equals("String_Node_Str") && prodVersion.equals("String_Node_Str")) {
    resource=XenServer60Resource.class.getName();
  }
 else   if (prodBrand.equals("String_Node_Str") && prodVersion.equals("String_Node_Str")) {
    String prodVersionTextShort=details.get("String_Node_Str").trim();
    if ("String_Node_Str".equals(prodVersionTextShort)) {
      resource=XenServer56SP2Resource.class.getName();
    }
 else     if ("String_Node_Str".equals(prodVersionTextShort)) {
      resource=XenServer56FP1Resource.class.getName();
    }
  }
  if (resource == null) {
    String msg="String_Node_Str" + prodBrand + "String_Node_Str"+ prodVersion;
    s_logger.debug(msg);
    throw new RuntimeException(msg);
  }
  if (!resource.equals(host.getResource())) {
    host.setResource(resource);
    host.setSetup(false);
    _hostDao.update(agentId,host);
    String msg="String_Node_Str" + host.getPrivateIpAddress() + "String_Node_Str"+ host.getResource()+ "String_Node_Str"+ resource;
    s_logger.debug(msg);
    throw new HypervisorVersionChangedException(msg);
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + agentId);
  }
  HostEnvironment env=new HostEnvironment();
  SetupCommand setup=new SetupCommand(env);
  if (_setupMultipath) {
    setup.setMultipathOn();
  }
  if (!host.isSetup()) {
    setup.setNeedSetup(true);
  }
  try {
    SetupAnswer answer=(SetupAnswer)_agentMgr.send(agentId,setup);
    if (answer != null && answer.getResult()) {
      host.setSetup(true);
      host.setLastPinged((System.currentTimeMillis() >> 10) - 5 * 60);
      _hostDao.update(host.getId(),host);
      if (answer.needReconnect()) {
        throw new ConnectionException(false,"String_Node_Str");
      }
      return;
    }
 else {
      s_logger.warn("String_Node_Str" + agentId + "String_Node_Str"+ ((answer != null) ? answer.getDetails() : "String_Node_Str"));
    }
  }
 catch (  AgentUnavailableException e) {
    s_logger.warn("String_Node_Str" + agentId + "String_Node_Str",e);
  }
catch (  OperationTimedoutException e) {
    s_logger.warn("String_Node_Str" + agentId + "String_Node_Str",e);
  }
  throw new ConnectionException(true,"String_Node_Str");
}