Source:
<code>private boolean HandleOldVdssWithSameName(VDS hostToRegister) { log.debugFormat("Entering"); boolean returnValue = true; VdsDAO vdsDAO = DbFacade.getInstance().getVdsDao(); VDS host = vdsDAO.getByName(getParameters().getVdsName()); List<String> allHostNames = getAllHostNames(vdsDAO.getAll()); boolean hostExistInDB = hostToRegister != null; if (host != null) { <START> log.debugFormat( <END> "found a VDS with the same name {1}. Will try to register with a new name", getParameters().getVdsName()); String nameToRegister = getParameters().getVdsName(); String uniqueIdToRegister = getParameters().getVdsUniqueId(); String newName; if (!uniqueIdToRegister.equals(host.getUniqueId()) && nameToRegister.equals(host.getvds_name())) { if (hostExistInDB) { allHostNames.remove(hostToRegister.getvds_name()); newName = generateUniqueName(nameToRegister, allHostNames); hostToRegister.setvds_name(newName); UpdateVdsActionParameters parameters = new UpdateVdsActionParameters(hostToRegister.getStaticData(), "", false); VdcReturnValueBase ret = Backend.getInstance().runInternalAction(VdcActionType.UpdateVds, parameters); if (ret == null || !ret.getSucceeded()) { error = AuditLogType.VDS_REGISTER_ERROR_UPDATING_NAME; logable.AddCustomValue("VdsName2", newName); log.errorFormat("could not update VDS {0}", nameToRegister); CaptureCommandErrorsToLogger(ret, "RegisterVdsQuery::HandleOldVdssWithSameName"); return false; } else { log.infoFormat( "Another VDS was using this name with IP {0}. Changed to {1}", nameToRegister, newName); } } else { newName = generateUniqueName(nameToRegister, allHostNames); getParameters().setVdsName(newName); } } } log.debugFormat("Leaving with value {0}", returnValue); return returnValue; }</code><technical_language>able log here. This "found VDS name {0}</technical_language>

Target:
private boolean HandleOldVdssWithSameName(VDS hostToRegister) { log.debugFormat("Entering"); boolean returnValue = true; VdsDAO vdsDAO = DbFacade.getInstance().getVdsDao(); VDS host = vdsDAO.getByName(getParameters().getVdsName()); List<String> allHostNames = getAllHostNames(vdsDAO.getAll()); boolean hostExistInDB = hostToRegister != null; if (host != null) { log.debugFormat( "found a VDS with the same name {0}. Will try to register with a new name", getParameters().getVdsName()); String nameToRegister = getParameters().getVdsName(); String uniqueIdToRegister = getParameters().getVdsUniqueId(); String newName; if (!uniqueIdToRegister.equals(host.getUniqueId()) && nameToRegister.equals(host.getvds_name())) { if (hostExistInDB) { allHostNames.remove(hostToRegister.getvds_name()); newName = generateUniqueName(nameToRegister, allHostNames); hostToRegister.setvds_name(newName); UpdateVdsActionParameters parameters = new UpdateVdsActionParameters(hostToRegister.getStaticData(), "", false); VdcReturnValueBase ret = Backend.getInstance().runInternalAction(VdcActionType.UpdateVds, parameters); if (ret == null || !ret.getSucceeded()) { error = AuditLogType.VDS_REGISTER_ERROR_UPDATING_NAME; logable.AddCustomValue("VdsName2", newName); log.errorFormat("could not update VDS {0}", nameToRegister); CaptureCommandErrorsToLogger(ret, "RegisterVdsQuery::HandleOldVdssWithSameName"); return false; } else { log.infoFormat( "Another VDS was using this name with IP {0}. Changed to {1}", nameToRegister, newName); } } else { newName = generateUniqueName(nameToRegister, allHostNames); getParameters().setVdsName(newName); } } } log.debugFormat("Leaving with value {0}", returnValue); return returnValue; }