Program: 105309
Project: 105309
Buggy source:
@Override public Map<? extends ServerResource,Map<String,String>> find(long dcId,Long podId,Long clusterId,URI url,String username,String password,List<String> hostTags) throws DiscoveryException {
  if (s_logger.isInfoEnabled())   s_logger.info("String_Node_Str" + dcId + "String_Node_Str"+ podId+ "String_Node_Str"+ clusterId+ "String_Node_Str"+ url.getHost());
  if (podId == null) {
    if (s_logger.isInfoEnabled())     s_logger.info("String_Node_Str");
    return null;
  }
  boolean failureInClusterDiscovery=true;
  String vsmIp="String_Node_Str";
  ClusterVO cluster=_clusterDao.findById(clusterId);
  if (cluster == null || cluster.getHypervisorType() != HypervisorType.VMware) {
    if (s_logger.isInfoEnabled())     s_logger.info("String_Node_Str");
    return null;
  }
  Map<String,String> clusterDetails=_clusterDetailsDao.findDetails(clusterId);
  boolean legacyZone=_vmwareMgr.isLegacyZone(dcId);
  boolean usernameNotProvided=(username == null || username.isEmpty());
  boolean passwordNotProvided=(password == null || password.isEmpty());
  if (!legacyZone) {
    VmwareDatacenterVO vmwareDc=fetchVmwareDatacenterByZone(dcId);
    if (usernameNotProvided || passwordNotProvided) {
      s_logger.info("String_Node_Str" + "String_Node_Str");
      username=vmwareDc.getUser();
      password=vmwareDc.getPassword();
      clusterDetails.put("String_Node_Str",username);
      clusterDetails.put("String_Node_Str",password);
      _clusterDetailsDao.persist(clusterId,clusterDetails);
    }
    String updatedInventoryPath=validateCluster(url,vmwareDc);
    try {
      if (!URLDecoder.decode(url.getPath(),"String_Node_Str").equals(updatedInventoryPath)) {
        clusterDetails.put("String_Node_Str",url.getScheme() + "String_Node_Str" + url.getHost()+ updatedInventoryPath);
        _clusterDetailsDao.persist(clusterId,clusterDetails);
      }
    }
 catch (    UnsupportedEncodingException e) {
      throw new DiscoveredWithErrorException("String_Node_Str" + url.getPath(),e);
    }
  }
 else {
    if (usernameNotProvided) {
      if (passwordNotProvided) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
 else {
        throw new InvalidParameterValueException("String_Node_Str");
      }
    }
 else     if (passwordNotProvided) {
      throw new InvalidParameterValueException("String_Node_Str");
    }
  }
  List<HostVO> hosts=_resourceMgr.listAllHostsInCluster(clusterId);
  if (hosts != null && hosts.size() > 0) {
    int maxHostsPerCluster=_hvCapabilitiesDao.getMaxHostsPerCluster(hosts.get(0).getHypervisorType(),hosts.get(0).getHypervisorVersion());
    if (hosts.size() >= maxHostsPerCluster) {
      String msg="String_Node_Str" + cluster.getName() + "String_Node_Str"+ hosts.size()+ "String_Node_Str"+ maxHostsPerCluster;
      s_logger.error(msg);
      throw new DiscoveredWithErrorException(msg);
    }
  }
  String privateTrafficLabel=null;
  String publicTrafficLabel=null;
  String guestTrafficLabel=null;
  Map<String,String> vsmCredentials=null;
  VirtualSwitchType defaultVirtualSwitchType=VirtualSwitchType.StandardVirtualSwitch;
  String paramGuestVswitchType=null;
  String paramGuestVswitchName=null;
  String paramPublicVswitchType=null;
  String paramPublicVswitchName=null;
  VmwareTrafficLabel guestTrafficLabelObj=new VmwareTrafficLabel(TrafficType.Guest);
  VmwareTrafficLabel publicTrafficLabelObj=new VmwareTrafficLabel(TrafficType.Public);
  DataCenterVO zone=_dcDao.findById(dcId);
  NetworkType zoneType=zone.getNetworkType();
  _readGlobalConfigParameters();
  if (useDVS) {
    paramGuestVswitchType=_urlParams.get(ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC);
    paramGuestVswitchName=_urlParams.get(ApiConstants.VSWITCH_NAME_GUEST_TRAFFIC);
    paramPublicVswitchType=_urlParams.get(ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC);
    paramPublicVswitchName=_urlParams.get(ApiConstants.VSWITCH_NAME_PUBLIC_TRAFFIC);
    defaultVirtualSwitchType=getDefaultVirtualSwitchType();
  }
  guestTrafficLabel=_netmgr.getDefaultGuestTrafficLabel(dcId,HypervisorType.VMware);
  guestTrafficLabelObj=getTrafficInfo(TrafficType.Guest,guestTrafficLabel,defaultVirtualSwitchType,paramGuestVswitchType,paramGuestVswitchName,clusterId);
  if (zoneType == NetworkType.Advanced) {
    publicTrafficLabel=_netmgr.getDefaultPublicTrafficLabel(dcId,HypervisorType.VMware);
    publicTrafficLabelObj=getTrafficInfo(TrafficType.Public,publicTrafficLabel,defaultVirtualSwitchType,paramPublicVswitchType,paramPublicVswitchName,clusterId);
    List<? extends PhysicalNetwork> pNetworkListGuestTraffic=_netmgr.getPhysicalNtwksSupportingTrafficType(dcId,TrafficType.Guest);
    List<? extends PhysicalNetwork> pNetworkListPublicTraffic=_netmgr.getPhysicalNtwksSupportingTrafficType(dcId,TrafficType.Public);
    PhysicalNetwork pNetworkPublic=pNetworkListPublicTraffic.get(0);
    if (pNetworkListGuestTraffic.contains(pNetworkPublic)) {
      if (publicTrafficLabelObj.getVirtualSwitchType() != guestTrafficLabelObj.getVirtualSwitchType()) {
        String msg="String_Node_Str" + pNetworkPublic + "String_Node_Str"+ "String_Node_Str";
        s_logger.error(msg);
        throw new InvalidParameterValueException(msg);
      }
    }
  }
  privateTrafficLabel=_netmgr.getDefaultManagementTrafficLabel(dcId,HypervisorType.VMware);
  if (privateTrafficLabel != null) {
    s_logger.info("String_Node_Str" + privateTrafficLabel);
  }
  Pair<Boolean,Long> vsmInfo=new Pair<Boolean,Long>(false,0L);
  if (nexusDVS && (guestTrafficLabelObj.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch) || ((zoneType == NetworkType.Advanced) && (publicTrafficLabelObj.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch))) {
    if (zoneType != NetworkType.Basic) {
      publicTrafficLabel=_netmgr.getDefaultPublicTrafficLabel(dcId,HypervisorType.VMware);
      if (publicTrafficLabel != null) {
        s_logger.info("String_Node_Str" + publicTrafficLabel);
      }
    }
    guestTrafficLabel=_netmgr.getDefaultGuestTrafficLabel(dcId,HypervisorType.VMware);
    if (guestTrafficLabel != null) {
      s_logger.info("String_Node_Str" + guestTrafficLabel);
    }
    boolean clusterHasVsm=_vmwareMgr.hasNexusVSM(clusterId);
    if (!clusterHasVsm) {
      vsmIp=_urlParams.get("String_Node_Str");
      String vsmUser=_urlParams.get("String_Node_Str");
      String vsmPassword=_urlParams.get("String_Node_Str");
      String clusterName=cluster.getName();
      try {
        vsmInfo=_nexusElement.validateAndAddVsm(vsmIp,vsmUser,vsmPassword,clusterId,clusterName);
      }
 catch (      ResourceInUseException ex) {
        DiscoveryException discEx=new DiscoveryException(ex.getLocalizedMessage() + "String_Node_Str" + ex.getResourceName());
        throw discEx;
      }
    }
    vsmCredentials=_vmwareMgr.getNexusVSMCredentialsByClusterId(clusterId);
  }
  VmwareContext context=null;
  try {
    context=VmwareContextFactory.create(url.getHost(),username,password);
    if (privateTrafficLabel != null)     context.registerStockObject("String_Node_Str",privateTrafficLabel);
    if (nexusDVS) {
      if (vsmCredentials != null) {
        s_logger.info("String_Node_Str");
        context.registerStockObject("String_Node_Str",vsmCredentials);
      }
    }
    List<ManagedObjectReference> morHosts=_vmwareMgr.addHostToPodCluster(context,dcId,podId,clusterId,URLDecoder.decode(url.getPath(),"String_Node_Str"));
    if (morHosts == null)     s_logger.info("String_Node_Str");
    if (privateTrafficLabel != null)     context.uregisterStockObject("String_Node_Str");
    if (morHosts == null) {
      s_logger.error("String_Node_Str" + URLDecoder.decode(url.getPath(),"String_Node_Str"));
      return null;
    }
    ManagedObjectReference morCluster=null;
    clusterDetails=_clusterDetailsDao.findDetails(clusterId);
    if (clusterDetails.get("String_Node_Str") != null) {
      URI uriFromCluster=new URI(UriUtils.encodeURIComponent(clusterDetails.get("String_Node_Str")));
      morCluster=context.getHostMorByPath(URLDecoder.decode(uriFromCluster.getPath(),"String_Node_Str"));
      if (morCluster == null || !morCluster.getType().equalsIgnoreCase("String_Node_Str")) {
        s_logger.warn("String_Node_Str" + clusterDetails.get("String_Node_Str"));
        return null;
      }
 else {
        ClusterMO clusterMo=new ClusterMO(context,morCluster);
        ClusterDasConfigInfo dasConfig=clusterMo.getDasConfig();
        if (dasConfig != null && dasConfig.isEnabled() != null && dasConfig.isEnabled().booleanValue()) {
          clusterDetails.put("String_Node_Str","String_Node_Str");
          _clusterDetailsDao.persist(clusterId,clusterDetails);
        }
      }
    }
    if (!validateDiscoveredHosts(context,morCluster,morHosts)) {
      if (morCluster == null)       s_logger.warn("String_Node_Str");
 else       s_logger.warn("String_Node_Str");
      return null;
    }
    Map<VmwareResource,Map<String,String>> resources=new HashMap<VmwareResource,Map<String,String>>();
    for (    ManagedObjectReference morHost : morHosts) {
      Map<String,String> details=new HashMap<String,String>();
      Map<String,Object> params=new HashMap<String,Object>();
      HostMO hostMo=new HostMO(context,morHost);
      details.put("String_Node_Str",hostMo.getHostName());
      details.put("String_Node_Str",username);
      details.put("String_Node_Str",password);
      String guid=morHost.getType() + "String_Node_Str" + morHost.getValue()+ "String_Node_Str"+ url.getHost();
      details.put("String_Node_Str",guid);
      params.put("String_Node_Str",hostMo.getHostName());
      params.put("String_Node_Str",username);
      params.put("String_Node_Str",password);
      params.put("String_Node_Str",Long.toString(dcId));
      params.put("String_Node_Str",Long.toString(podId));
      params.put("String_Node_Str",Long.toString(clusterId));
      params.put("String_Node_Str",guid);
      if (privateTrafficLabel != null) {
        params.put("String_Node_Str",privateTrafficLabel);
      }
      params.put("String_Node_Str",guestTrafficLabelObj);
      params.put("String_Node_Str",publicTrafficLabelObj);
      params.put("String_Node_Str",_configDao.getValue(Config.RouterAggregationCommandEachTimeout.toString()));
      VmwareResource resource=new VmwareResource();
      try {
        resource.configure("String_Node_Str",params);
      }
 catch (      ConfigurationException e) {
        _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST,dcId,podId,"String_Node_Str" + url.getHost(),"String_Node_Str" + e.getMessage());
        s_logger.warn("String_Node_Str" + url.getHost(),e);
      }
      resource.start();
      resources.put(resource,details);
    }
    cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes()).toString());
    _clusterDao.update(clusterId,cluster);
    failureInClusterDiscovery=false;
    return resources;
  }
 catch (  DiscoveredWithErrorException e) {
    throw e;
  }
catch (  Exception e) {
    s_logger.warn("String_Node_Str" + url.getHost() + "String_Node_Str"+ e);
    return null;
  }
 finally {
    if (context != null)     context.close();
    if (failureInClusterDiscovery && vsmInfo.first()) {
      try {
        s_logger.debug("String_Node_Str" + vsmIp + "String_Node_Str");
        _nexusElement.deleteCiscoNexusVSM(vsmInfo.second().longValue());
      }
 catch (      Exception e) {
      }
    }
  }
}

Fixed version (ground truth):
@Override public Map<? extends ServerResource,Map<String,String>> find(long dcId,Long podId,Long clusterId,URI url,String username,String password,List<String> hostTags) throws DiscoveryException {
  if (s_logger.isInfoEnabled())   s_logger.info("String_Node_Str" + dcId + "String_Node_Str"+ podId+ "String_Node_Str"+ clusterId+ "String_Node_Str"+ url.getHost());
  if (podId == null) {
    if (s_logger.isInfoEnabled())     s_logger.info("String_Node_Str");
    return null;
  }
  boolean failureInClusterDiscovery=true;
  String vsmIp="String_Node_Str";
  ClusterVO cluster=_clusterDao.findById(clusterId);
  if (cluster == null || cluster.getHypervisorType() != HypervisorType.VMware) {
    if (s_logger.isInfoEnabled())     s_logger.info("String_Node_Str");
    return null;
  }
  Map<String,String> clusterDetails=_clusterDetailsDao.findDetails(clusterId);
  boolean legacyZone=_vmwareMgr.isLegacyZone(dcId);
  boolean usernameNotProvided=(username == null || username.isEmpty());
  boolean passwordNotProvided=(password == null || password.isEmpty());
  if (!legacyZone) {
    VmwareDatacenterVO vmwareDc=fetchVmwareDatacenterByZone(dcId);
    if (usernameNotProvided || passwordNotProvided) {
      s_logger.info("String_Node_Str" + "String_Node_Str");
      username=vmwareDc.getUser();
      password=vmwareDc.getPassword();
      clusterDetails.put("String_Node_Str",username);
      clusterDetails.put("String_Node_Str",password);
      _clusterDetailsDao.persist(clusterId,clusterDetails);
    }
    String updatedInventoryPath=validateCluster(url,vmwareDc);
    try {
      if (!URLDecoder.decode(url.getPath(),"String_Node_Str").equals(updatedInventoryPath)) {
        clusterDetails.put("String_Node_Str",url.getScheme() + "String_Node_Str" + url.getHost()+ updatedInventoryPath);
        _clusterDetailsDao.persist(clusterId,clusterDetails);
      }
    }
 catch (    UnsupportedEncodingException e) {
      throw new DiscoveredWithErrorException("String_Node_Str" + url.getPath(),e);
    }
  }
 else {
    if (usernameNotProvided) {
      if (passwordNotProvided) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
 else {
        throw new InvalidParameterValueException("String_Node_Str");
      }
    }
 else     if (passwordNotProvided) {
      throw new InvalidParameterValueException("String_Node_Str");
    }
  }
  List<HostVO> hosts=_resourceMgr.listAllHostsInCluster(clusterId);
  if (hosts != null && hosts.size() > 0) {
    int maxHostsPerCluster=_hvCapabilitiesDao.getMaxHostsPerCluster(hosts.get(0).getHypervisorType(),hosts.get(0).getHypervisorVersion());
    if (hosts.size() >= maxHostsPerCluster) {
      String msg="String_Node_Str" + cluster.getName() + "String_Node_Str"+ hosts.size()+ "String_Node_Str"+ maxHostsPerCluster;
      s_logger.error(msg);
      throw new DiscoveredWithErrorException(msg);
    }
  }
  String privateTrafficLabel=null;
  String publicTrafficLabel=null;
  String guestTrafficLabel=null;
  Map<String,String> vsmCredentials=null;
  VirtualSwitchType defaultVirtualSwitchType=VirtualSwitchType.StandardVirtualSwitch;
  String paramGuestVswitchType=null;
  String paramGuestVswitchName=null;
  String paramPublicVswitchType=null;
  String paramPublicVswitchName=null;
  VmwareTrafficLabel guestTrafficLabelObj=new VmwareTrafficLabel(TrafficType.Guest);
  VmwareTrafficLabel publicTrafficLabelObj=new VmwareTrafficLabel(TrafficType.Public);
  DataCenterVO zone=_dcDao.findById(dcId);
  NetworkType zoneType=zone.getNetworkType();
  _readGlobalConfigParameters();
  if (useDVS) {
    paramGuestVswitchType=_urlParams.get(ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC);
    paramGuestVswitchName=_urlParams.get(ApiConstants.VSWITCH_NAME_GUEST_TRAFFIC);
    paramPublicVswitchType=_urlParams.get(ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC);
    paramPublicVswitchName=_urlParams.get(ApiConstants.VSWITCH_NAME_PUBLIC_TRAFFIC);
    defaultVirtualSwitchType=getDefaultVirtualSwitchType();
  }
  guestTrafficLabel=_netmgr.getDefaultGuestTrafficLabel(dcId,HypervisorType.VMware);
  guestTrafficLabelObj=getTrafficInfo(TrafficType.Guest,guestTrafficLabel,defaultVirtualSwitchType,paramGuestVswitchType,paramGuestVswitchName,clusterId);
  if (zoneType == NetworkType.Advanced) {
    publicTrafficLabel=_netmgr.getDefaultPublicTrafficLabel(dcId,HypervisorType.VMware);
    publicTrafficLabelObj=getTrafficInfo(TrafficType.Public,publicTrafficLabel,defaultVirtualSwitchType,paramPublicVswitchType,paramPublicVswitchName,clusterId);
    List<? extends PhysicalNetwork> pNetworkListGuestTraffic=_netmgr.getPhysicalNtwksSupportingTrafficType(dcId,TrafficType.Guest);
    List<? extends PhysicalNetwork> pNetworkListPublicTraffic=_netmgr.getPhysicalNtwksSupportingTrafficType(dcId,TrafficType.Public);
    PhysicalNetwork pNetworkPublic=pNetworkListPublicTraffic.get(0);
    if (pNetworkListGuestTraffic.contains(pNetworkPublic)) {
      if (publicTrafficLabelObj.getVirtualSwitchType() != guestTrafficLabelObj.getVirtualSwitchType()) {
        String msg="String_Node_Str" + pNetworkPublic + "String_Node_Str"+ "String_Node_Str";
        s_logger.error(msg);
        throw new InvalidParameterValueException(msg);
      }
    }
  }
  privateTrafficLabel=_netmgr.getDefaultManagementTrafficLabel(dcId,HypervisorType.VMware);
  if (privateTrafficLabel != null) {
    s_logger.info("String_Node_Str" + privateTrafficLabel);
  }
  Pair<Boolean,Long> vsmInfo=new Pair<Boolean,Long>(false,0L);
  if (nexusDVS && (guestTrafficLabelObj.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch) || ((zoneType == NetworkType.Advanced) && (publicTrafficLabelObj.getVirtualSwitchType() == VirtualSwitchType.NexusDistributedVirtualSwitch))) {
    if (zoneType != NetworkType.Basic) {
      publicTrafficLabel=_netmgr.getDefaultPublicTrafficLabel(dcId,HypervisorType.VMware);
      if (publicTrafficLabel != null) {
        s_logger.info("String_Node_Str" + publicTrafficLabel);
      }
    }
    guestTrafficLabel=_netmgr.getDefaultGuestTrafficLabel(dcId,HypervisorType.VMware);
    if (guestTrafficLabel != null) {
      s_logger.info("String_Node_Str" + guestTrafficLabel);
    }
    boolean clusterHasVsm=_vmwareMgr.hasNexusVSM(clusterId);
    if (!clusterHasVsm) {
      vsmIp=_urlParams.get("String_Node_Str");
      String vsmUser=_urlParams.get("String_Node_Str");
      String vsmPassword=_urlParams.get("String_Node_Str");
      String clusterName=cluster.getName();
      try {
        vsmInfo=_nexusElement.validateAndAddVsm(vsmIp,vsmUser,vsmPassword,clusterId,clusterName);
      }
 catch (      ResourceInUseException ex) {
        DiscoveryException discEx=new DiscoveryException(ex.getLocalizedMessage() + "String_Node_Str" + ex.getResourceName());
        throw discEx;
      }
    }
    vsmCredentials=_vmwareMgr.getNexusVSMCredentialsByClusterId(clusterId);
  }
  VmwareContext context=null;
  try {
    context=VmwareContextFactory.create(url.getHost(),username,password);
    if (privateTrafficLabel != null)     context.registerStockObject("String_Node_Str",privateTrafficLabel);
    if (nexusDVS) {
      if (vsmCredentials != null) {
        s_logger.info("String_Node_Str");
        context.registerStockObject("String_Node_Str",vsmCredentials);
      }
    }
    List<ManagedObjectReference> morHosts=_vmwareMgr.addHostToPodCluster(context,dcId,podId,clusterId,URLDecoder.decode(url.getPath(),"String_Node_Str"));
    if (morHosts == null)     s_logger.info("String_Node_Str");
    if (privateTrafficLabel != null)     context.uregisterStockObject("String_Node_Str");
    if (morHosts == null) {
      s_logger.error("String_Node_Str" + URLDecoder.decode(url.getPath(),"String_Node_Str"));
      return null;
    }
    ManagedObjectReference morCluster=null;
    clusterDetails=_clusterDetailsDao.findDetails(clusterId);
    if (clusterDetails.get("String_Node_Str") != null) {
      URI uriFromCluster=new URI(UriUtils.encodeURIComponent(clusterDetails.get("String_Node_Str")));
      morCluster=context.getHostMorByPath(URLDecoder.decode(uriFromCluster.getPath(),"String_Node_Str"));
      if (morCluster == null || !morCluster.getType().equalsIgnoreCase("String_Node_Str")) {
        s_logger.warn("String_Node_Str" + clusterDetails.get("String_Node_Str"));
        return null;
      }
 else {
        ClusterMO clusterMo=new ClusterMO(context,morCluster);
        ClusterDasConfigInfo dasConfig=clusterMo.getDasConfig();
        if (dasConfig != null && dasConfig.isEnabled() != null && dasConfig.isEnabled().booleanValue()) {
          clusterDetails.put("String_Node_Str","String_Node_Str");
          _clusterDetailsDao.persist(clusterId,clusterDetails);
        }
      }
    }
    if (!validateDiscoveredHosts(context,morCluster,morHosts)) {
      if (morCluster == null)       s_logger.warn("String_Node_Str");
 else       s_logger.warn("String_Node_Str");
      return null;
    }
    Map<VmwareResource,Map<String,String>> resources=new HashMap<VmwareResource,Map<String,String>>();
    for (    ManagedObjectReference morHost : morHosts) {
      Map<String,String> details=new HashMap<String,String>();
      Map<String,Object> params=new HashMap<String,Object>();
      HostMO hostMo=new HostMO(context,morHost);
      details.put("String_Node_Str",hostMo.getHostName());
      details.put("String_Node_Str",username);
      details.put("String_Node_Str",password);
      String guid=morHost.getType() + "String_Node_Str" + morHost.getValue()+ "String_Node_Str"+ url.getHost();
      details.put("String_Node_Str",guid);
      params.put("String_Node_Str",hostMo.getHostName());
      params.put("String_Node_Str",username);
      params.put("String_Node_Str",password);
      params.put("String_Node_Str",Long.toString(dcId));
      params.put("String_Node_Str",Long.toString(podId));
      params.put("String_Node_Str",Long.toString(clusterId));
      params.put("String_Node_Str",guid);
      if (privateTrafficLabel != null) {
        params.put("String_Node_Str",privateTrafficLabel);
      }
      params.put("String_Node_Str",guestTrafficLabelObj);
      params.put("String_Node_Str",publicTrafficLabelObj);
      params.put("String_Node_Str",_configDao.getValue(Config.RouterAggregationCommandEachTimeout.toString()));
      VmwareResource resource=new VmwareResource();
      try {
        resource.configure("String_Node_Str",params);
      }
 catch (      ConfigurationException e) {
        _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST,dcId,podId,"String_Node_Str" + url.getHost(),"String_Node_Str" + e.getMessage());
        s_logger.warn("String_Node_Str" + url.getHost(),e);
      }
      resource.start();
      resources.put(resource,details);
    }
    try {
      cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes("String_Node_Str")).toString());
    }
 catch (    UnsupportedEncodingException e) {
      throw new DiscoveredWithErrorException("String_Node_Str" + String.valueOf(clusterId) + "String_Node_Str");
    }
    _clusterDao.update(clusterId,cluster);
    failureInClusterDiscovery=false;
    return resources;
  }
 catch (  DiscoveredWithErrorException e) {
    throw e;
  }
catch (  Exception e) {
    s_logger.warn("String_Node_Str" + url.getHost() + "String_Node_Str"+ e);
    return null;
  }
 finally {
    if (context != null)     context.close();
    if (failureInClusterDiscovery && vsmInfo.first()) {
      try {
        s_logger.debug("String_Node_Str" + vsmIp + "String_Node_Str");
        _nexusElement.deleteCiscoNexusVSM(vsmInfo.second().longValue());
      }
 catch (      Exception e) {
      }
    }
  }
}