Source:
<code>public boolean savePassword(final Network network, final NicProfile nic, final VirtualMachineProfile vm) throws ResourceUnavailableException { if (!canHandle(network, null)) { return false; } final List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER); if (routers == null || routers.isEmpty()) { s_logger.debug("Can't find virtual router element in network " + network.getId()); return true; } final VirtualMachineProfile uservm = vm; final DataCenterVO dcVO = _dcDao.findById(network.getDataCenterId()); final NetworkTopology networkTopology = networkTopologyContext.retrieveNetworkTopology(dcVO); boolean savePasswordResult = true; <START> boolean isVrRunning = false; <END> for (final VirtualRouter router : routers) { if (router.getState() == State.Running) { final boolean result = networkTopology.savePasswordToRouter(network, nic, uservm, router); isVrRunning = true; savePasswordResult = savePasswordResult & result; } } if (isVrRunning) { if (savePasswordResult) { final UserVmVO userVmVO = _userVmDao.findById(vm.getId()); userVmVO.setUpdateParameters(false); _userVmDao.update(userVmVO.getId(), userVmVO); } return savePasswordResult; } final String password = (String) uservm.getParameter(VirtualMachineProfile.Param.VmPassword); final String password_encrypted = DBEncryptionUtil.encrypt(password); final UserVmVO userVmVO = _userVmDao.findById(vm.getId()); _userVmDao.loadDetails(userVmVO); userVmVO.setDetail(VmDetailConstants.PASSWORD, password_encrypted); _userVmDao.saveDetails(userVmVO); userVmVO.setUpdateParameters(true); _userVmDao.update(userVmVO.getId(), userVmVO); return true; }</code><technical_language>@ravening please variables private</technical_language>

Target:
public boolean savePassword(final Network network, final NicProfile nic, final VirtualMachineProfile vm) throws ResourceUnavailableException { if (!canHandle(network, null)) { return false; } final List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER); if (routers == null || routers.isEmpty()) { s_logger.debug("Can't find virtual router element in network " + network.getId()); return true; } final VirtualMachineProfile uservm = vm; final DataCenterVO dcVO = _dcDao.findById(network.getDataCenterId()); final NetworkTopology networkTopology = networkTopologyContext.retrieveNetworkTopology(dcVO); boolean savePasswordResult = true; boolean isVrRunning = false; for (final VirtualRouter router : routers) { if (router.getState() == State.Running) { final boolean result = networkTopology.savePasswordToRouter(network, nic, uservm, router); if (!result) { s_logger.error("Unable to save password for VM " + vm.getInstanceName() + " on router " + router.getInstanceName()); return false; } isVrRunning = true; savePasswordResult = savePasswordResult && result; } } if (isVrRunning) { if (savePasswordResult) { final UserVmVO userVmVO = _userVmDao.findById(vm.getId()); userVmVO.setUpdateParameters(false); _userVmDao.update(userVmVO.getId(), userVmVO); } return savePasswordResult; } final String password = (String) uservm.getParameter(VirtualMachineProfile.Param.VmPassword); final String password_encrypted = DBEncryptionUtil.encrypt(password); final UserVmVO userVmVO = _userVmDao.findById(vm.getId()); _userVmDao.loadDetails(userVmVO); userVmVO.setDetail(VmDetailConstants.PASSWORD, password_encrypted); _userVmDao.saveDetails(userVmVO); userVmVO.setUpdateParameters(true); _userVmDao.update(userVmVO.getId(), userVmVO); return true; }