auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void checkImageTarget() { // TODO: // This is a workaround until bz 1332019 will be merged // since KVM is currently the only source for which we use Libvirt streaming API. // Libvirt currently reports the actual disk size and the virtual one, // when using preallocated qcow2 on block domain the size that the Libvirt stream emits // can be larger then the actual size. if (getVm().getOrigin() == OriginType.KVM && getActionState() == CommandActionState.EXECUTE) { StorageDomain domain = storageDomainDao.get(getStorageDomainId()); for (DiskImage image : getVm().getImages()) { if (domain.getStorageType().isBlockDomain()) { image.setActualSizeInBytes(image.getSize()); } } } }

Target:
private void checkImageTarget() { // TODO: // This is a workaround until bz 1332019 will be merged // since KVM is currently the only source for which we use Libvirt streaming API. // Libvirt currently reports the actual disk size and the virtual one, // when using preallocated qcow2 on block domain the size that the Libvirt stream emits // can be larger then the actual size. if (getVm().getOrigin() == OriginType.KVM && getActionState() == CommandActionState.EXECUTE) { StorageDomain domain = storageDomainDao.get(getStorageDomainId()); if (domain.getStorageType().isBlockDomain()) { getVm().getImages().forEach(image -> image.setActualSizeInBytes(image.getSize())); } } }
Source:
protected void setUpLogExpectations(boolean debug) throws Exception{ Field field = BaseBackendResource.class.getDeclaredField("log"); Logger logger = mock(Logger.class); when(logger.isDebugEnabled()).thenReturn(debug); setFinalStatic(field, logger); }

Target:
protected void setUpLogExpectations(boolean debug) throws Exception { Field field = BaseBackendResource.class.getDeclaredField("log"); Logger logger = mock(Logger.class); when(logger.isDebugEnabled()).thenReturn(debug); setFinalStatic(field, logger); }
Source:
public void cleanup() { driver.cleanup(); vmDiskPopupWidget.cleanup(); }

Target:
public void cleanup() { driver.cleanup(); }
Source:
public ValidationResult isOsSupportedForVirtIoScsi(VM vm) { if (!VmValidationUtils.isDiskInterfaceSupportedByOs( vm.getOs(), vm.getCompatibilityVersion(), DiskInterface.VirtIO_SCSI)) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } return ValidationResult.VALID; }

Target:
private ValidationResult isOsSupportedForVirtIoScsi(VM vm) { if (!VmValidationUtils.isDiskInterfaceSupportedByOs( vm.getOs(), vm.getCompatibilityVersion(), DiskInterface.VirtIO_SCSI)) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } return ValidationResult.VALID; }
Source:
public void updateVirtioScsiController(VmBase vm, Boolean isVirtioScsiEnabled) { if (isVirtioScsiEnabled == null) { return; //we don't want to update the device } if (isVirtioScsiEnabled) { if (!hasVirtioScsiController(vm.getId())) { addVirtioScsiController(vm); } } else { removeVirtioScsiControllers(vm.getId()); } }

Target:
public void updateVirtioScsiController(VmBase vm, Boolean isVirtioScsiEnabled) { if (isVirtioScsiEnabled == null) { return; //we don't want to update the device } removeVirtioScsiControllers(vm.getId()); if (isVirtioScsiEnabled) { addVirtioScsiController(vm); } }
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> listPermissionSubjects = new ArrayList<>(); if (!isImageProvided()) { listPermissionSubjects.add(new PermissionSubject(getParameters().getStorageDomainId(), VdcObjectType.Storage, ActionGroup.CREATE_DISK)); } else { // DISK_OPERATOR role is granted and persisted for the user who created the disk. // Therefor, returning a CREATE_DISK permission subject on the target disk will enforce that the only user // who can do I/O to this disk is its creator. listPermissionSubjects.add(new PermissionSubject(getParameters().getImageId(), VdcObjectType.Disk, ActionGroup.CREATE_DISK)); } return listPermissionSubjects; }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> listPermissionSubjects = new ArrayList<>(); if (isImageProvided()) { // DISK_OPERATOR role is granted and persisted for the user who created the disk. // Therefor, returning a CREATE_DISK permission subject on the target disk will enforce that the only user // who can do I/O to this disk is its creator. listPermissionSubjects.add(new PermissionSubject(getParameters().getImageId(), VdcObjectType.Disk, ActionGroup.CREATE_DISK)); } else { listPermissionSubjects.add(new PermissionSubject(getParameters().getStorageDomainId(), VdcObjectType.Storage, ActionGroup.CREATE_DISK)); } return listPermissionSubjects; }
Source:
public GlusterStorageDomainDRSyncJob() { super(); backend = Injector.get(BackendInternal.class); storageDomainDao = Injector.get(StorageDomainDao.class); geoRepDao = Injector.get(GlusterGeoRepDao.class); }

Target:
public GlusterStorageDomainDRSyncJob() { super(); // backend = Injector.get(BackendInternal.class); // storageDomainDao = Injector.get(StorageDomainDao.class); // geoRepDao = Injector.get(GlusterGeoRepDao.class); }
Source:
public static void setTooltipOnElement(String tooltip, Element element) { if (tooltip!= null) { element.setTitle(tooltip); } }

Target:
public static void setTooltipOnElement(String tooltip, Element element) { if (tooltip!= null) { element.setTitle(tooltip); } else { element.setTitle(""); //$NON-NLS-1$ } }
Source:
private void setAllListModelsUnavailable() { for (ListModel m : getItems()) { // Don't mark plugin models as unavailable, the plug-ins themselves will hide/show the tabs. if (!(m instanceof PluginModel)) { m.setIsAvailable(false); } } }

Target:
private void setAllListModelsUnavailable() { for (ListModel m : getItems()) { m.setIsAvailable(false); } }
Source:
protected void initEffectiveCompatibilityVersion() { Version effectiveCompatibilityVersion = VmPropertiesUtils.getInstance().getSupportedClusterLevels().contains(getParameters().getVmStaticData().getCustomCompatibilityVersion()) ? CompatibilityVersionUtils.getEffective(getParameters().getVmStaticData(), this::getCluster) : CompatibilityVersionUtils.getEffective(this::getCluster); // The effective Compatibility Version will be taken from Cluster setEffectiveCompatibilityVersion(effectiveCompatibilityVersion); }

Target:
protected void initEffectiveCompatibilityVersion() { setEffectiveCompatibilityVersion( CompatibilityVersionUtils.getEffective(getParameters().getVmStaticData(), this::getCluster)); }
Source:
public List<GraphicsDevice> getPrevDevices() { return prevDevices; }

Target:
protected List<GraphicsDevice> getPrevDevices() { return prevDevices; }
Source:
private String getNextRunMessage(String field) { if (field.equals("minAllocatedMem")) { //$NON-NLS-1$ String translated = nextRunMessages.minAllocatedMem(); try { translated = nextRunMessages.getString("minAllocatedMem"); //$NON-NLS-1$ } catch (MissingResourceException e) { // ignore } return translated; } return field; }

Target:
private String getNextRunMessage(String field) { try { return nextRunMessages.getString(field); } catch (MissingResourceException e) { // ignore } return field; }
Source:
boolean isMonitoringNeeded(VDSStatus status) { switch (status) { case Up: case NonResponsive: case Error: case NonOperational: case PreparingForMaintenance: case Initializing: case Connecting: return true; default: return false; } }

Target:
boolean isMonitoringNeeded(VDSStatus status) { switch (status) { default: return false; case Up: case Error: case NonOperational: case PreparingForMaintenance: // FIXME The below statuses are probably not relevant // for monitoring but it's currently not final. case NonResponsive: case Initializing: case Connecting: return true; } }
Source:
private boolean isUpdateRequired(VM.VMStatus status){ //TODO: fill this list on going. // list of statuses which required vdsm update {up, poweringdown, paused} if (status == VM.VMStatus.Up || status == VM.VMStatus.PoweringDown || status == VM.VMStatus.Paused) { return true; } return false; }

Target:
private boolean isUpdateRequired(VM.VMStatus status) { // TODO: fill this list on going. // list of statuses which required vdsm update {up, poweringdown, paused} switch (status) { case Up: case PoweringDown: case Paused: return true; default: return false; } }
Source:
protected boolean perform() { try { getParameters().setStartTime(new Date()); destinationHostLock = new EngineLock(hostLocking.getSetupNetworksLock(getDestinationVdsId())); lockManager.acquireLockWait(destinationHostLock); if (unplugPassthroughNics() && connectLunDisks(getDestinationVdsId()) && migrateVm()) { ExecutionHandler.setAsyncJob(getExecutionContext(), true); return true; } // otherwise runningFailed(); return false; } catch (Exception e) { runningFailed(); throw e; } }

Target:
protected boolean perform() { try { getParameters().setStartTime(new Date()); if (unplugPassthroughNics() && connectLunDisks(getDestinationVdsId()) && migrateVm()) { ExecutionHandler.setAsyncJob(getExecutionContext(), true); return true; } // otherwise runningFailed(); return false; } catch (Exception e) { runningFailed(); throw e; } }
Source:
protected boolean amendDiskRequested() { if (getOldDisk().getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage oldDisk = (DiskImage) getOldDisk(); return (oldDisk.getVolumeFormat() == VolumeFormat.COW) && !Objects.equals(oldDisk.getQcowCompat().getCompatValue(), ((DiskImage) getNewDisk()).getQcowCompat().getCompatValue()); } return false; }

Target:
protected boolean amendDiskRequested() { if (getOldDisk().getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage oldDisk = (DiskImage) getOldDisk(); return oldDisk.getVolumeFormat() == VolumeFormat.COW && !Objects.equals(oldDisk.getQcowCompat().getCompatValue(), ((DiskImage) getNewDisk()).getQcowCompat().getCompatValue()); } return false; }
Source:
public void removeLeftoverDevices(VmBase vmBase) { List<VmDevice> spiceChannels = vmDeviceDao.getVmDeviceByVmIdTypeAndDevice( vmBase.getId(), VmDeviceGeneralType.CHANNEL, VmDeviceType.SPICEVMC.getName()); // remove spice channel if we are no longer using spice if (!hasGraphicsDevice(vmBase.getId(), GraphicsType.SPICE)) { removeVmDevices(spiceChannels); } }

Target:
public void removeLeftoverDevices(VmBase vmBase) { if (!hasGraphicsDevice(vmBase.getId(), GraphicsType.SPICE)) { // remove spice channel if we are no longer using spice List<VmDevice> spiceChannels = vmDeviceDao.getVmDeviceByVmIdTypeAndDevice( vmBase.getId(), VmDeviceGeneralType.CHANNEL, VmDeviceType.SPICEVMC.getName()); removeVmDevices(spiceChannels); } }
Source:
public void backupCheck() { // skip backup check if previous operation is not completed yet if (lock.tryLock()) { try { log.info("Backup check started."); doBackupCheck(); log.info("Backup check completed."); } finally { lock.unlock(); } } }

Target:
private void backupCheck() { // skip backup check if previous operation is not completed yet if (lock.tryLock()) { try { log.info("Backup check started."); doBackupCheck(); log.info("Backup check completed."); } finally { lock.unlock(); } } }
Source:
public void availableUpdates() { hostDao.getAll() .stream() .filter(h -> h.getStatus().isEligibleForCheckUpdates()) .forEach(this::submitCheckUpdatesForHost); }

Target:
private void availableUpdates() { hostDao.getAll() .stream() .filter(h -> h.getStatus().isEligibleForCheckUpdates()) .forEach(this::submitCheckUpdatesForHost); }
Source:
public void cleanCompletedJob() { Date succeededJobsDeleteTime = new Date(System.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(succeededJobTime, TimeUnit.MINUTES)); Date failedJobsDeleteTime = new Date(System.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(failedJobTime, TimeUnit.MINUTES)); try { jobDao.deleteCompletedJobs(succeededJobsDeleteTime, failedJobsDeleteTime); } catch (RuntimeException e) { log.error("Failed to delete completed jobs: {}", e.getMessage()); log.debug("Exception", e); } }

Target:
private void cleanCompletedJob() { Date succeededJobsDeleteTime = new Date(System.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(succeededJobTime, TimeUnit.MINUTES)); Date failedJobsDeleteTime = new Date(System.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(failedJobTime, TimeUnit.MINUTES)); try { jobDao.deleteCompletedJobs(succeededJobsDeleteTime, failedJobsDeleteTime); } catch (RuntimeException e) { log.error("Failed to delete completed jobs: {}", e.getMessage()); log.debug("Exception", e); } }
Source:
protected void addLink(LinksTreeNode linksTree, String link) { //link segments are separated by '.' (e.g: (disk_attachements.template) String[] linkSegments = link.split("\\."); for (String segment : linkSegments) { linksTree = updateTree(linksTree, segment); } }

Target:
private void addLink(LinksTreeNode linksTree, String link) { //link segments are separated by '.' (e.g: (disk_attachements.template) String[] linkSegments = link.split("\\."); for (String segment : linkSegments) { linksTree = updateTree(linksTree, segment); } }
Source:
private void cancel() { setConfirmWindow(null); }

Target:
private void cancel() { // no implementation }
Source:
protected void addCommands() { UICommand command = UICommand.createDefaultOkUiCommand("OnSave", this); //$NON-NLS-1$ getCommands().add(command); getCommands().add(UICommand.createCancelUiCommand("Cancel", this)); //$NON-NLS-1$ }

Target:
protected void addCommands() { getCommands().add(UICommand.createDefaultOkUiCommand("OnSave", this)); //$NON-NLS-1$ getCommands().add(UICommand.createCancelUiCommand("Cancel", this)); //$NON-NLS-1$ }
Source:
public boolean isDiskExists(Guid id) { return baseDiskDao.exists(id); }

Target:
private boolean isDiskExists(Guid id) { return baseDiskDao.exists(id); }
Source:
public void logServerMessage(final VDS server, final AuditLogType logType) { logAuditMessage(server == null ? Guid.Empty : server.getClusterId(), server == null ? null : server.getClusterName(), null, server, logType, Collections.emptyMap()); }

Target:
public void logServerMessage(final VDS server, final AuditLogType logType) { logAuditMessage(server.getClusterId(), server.getClusterName(), null, server, logType, Collections.emptyMap()); }
Source:
public void endSuccessfully() { setQcowCompatForQcowImage(); if (getParameters().getImportAsTemplate()) { Guid newTemplateId = createTemplate(); // No reason for this to happen, but checking just to make sure if (newTemplateId != null) { attachDiskToTemplate(newTemplateId); } } updateDiskStatus(ImageStatus.OK); setSucceeded(true); }

Target:
public void endSuccessfully() { super.endSuccessfully(); setQcowCompatForQcowImage(); if (getParameters().getImportAsTemplate()) { Guid newTemplateId = createTemplate(); // No reason for this to happen, but checking just to make sure if (newTemplateId != null) { attachDiskToTemplate(newTemplateId); } } updateDiskStatus(ImageStatus.OK); setSucceeded(true); }
Source:
private void activeDetailModelChanging(HasEntity<D> newValue, boolean stopRefresh) { for (HasEntity<D> oldValue : activeDetailModels) { // Make sure we had set an entity property of details model. if (oldValue != null && stopRefresh) { oldValue.setEntity(null); if (oldValue instanceof SearchableListModel) { ((SearchableListModel) oldValue).stopRefresh(); } } } if (newValue != null) { newValue.setEntity(provideDetailModelEntity(getSelectedItem())); } }

Target:
private void activeDetailModelChanging(HasEntity<D> newValue, boolean stopRefresh) { if (stopRefresh) { for (HasEntity<D> oldValue : activeDetailModels) { // Make sure we had set an entity property of details model. if (oldValue != null) { oldValue.setEntity(null); if (oldValue instanceof SearchableListModel) { ((SearchableListModel) oldValue).stopRefresh(); } } } } if (newValue != null) { newValue.setEntity(provideDetailModelEntity(getSelectedItem())); } }
Source:
public void restoreStateFromViewItem(PatternflyListViewItem<HostInterfaceLineModel> originalViewItem) { super.restoreStateFromViewItem(originalViewItem); // Need to check because we could be coming from a non bond interface and restoring the state (expanded details) // from it into a bonded interface will not work. if (originalViewItem instanceof HostNetworkInterfaceBondedListViewItem) { HostNetworkInterfaceBondedListViewItem original = (HostNetworkInterfaceBondedListViewItem) originalViewItem; setSlavesExpanded(original.getSlavesState()); } }

Target:
public void restoreStateFromViewItem(PatternflyListViewItem<HostInterfaceLineModel> originalViewItem) { super.restoreStateFromViewItem(originalViewItem); // Need to check because we could be coming from a non bond interface and restoring the state (expanded details) // from it into a bonded interface will not work. if (originalViewItem instanceof HostNetworkInterfaceBondedListViewItem) { setSlavesExpanded(((HostNetworkInterfaceBondedListViewItem) originalViewItem).getSlavesState()); } }
Source:
private String calculateHref(Object tab) { String href = "#"; //$NON-NLS-1$ if (tab instanceof AbstractTab) { href = ((AbstractTab)tab).getTargetHistoryToken(); } else if (tab instanceof GroupedTabData) { href = ((GroupedTabData)tab).getHistoryToken(); } return href; }

Target:
private String calculateHref(Object tab) { String href = "#"; //$NON-NLS-1$ if (tab instanceof AbstractTab) { href = ((AbstractTab)tab).getTargetHistoryToken(); } return href; }
Source:
public DisksViewRadioGroup() { FlowPanel panel = new FlowPanel(); Label label = new Label(); label.setText(constants.diskType() + ":"); //$NON-NLS-1$ label.addStyleName("disk-storage-type-group-label"); //$NON-NLS-1$ panel.add(label); panel.add(getRadioGroupPanel()); initWidget(panel); }

Target:
public DisksViewRadioGroup() { Label label = new Label(); label.setText(constants.diskType() + ":"); //$NON-NLS-1$ label.addStyleName("disk-storage-type-group-label"); //$NON-NLS-1$ add(label); add(getRadioGroupPanel()); }
Source:
public ColumnResizeHandler(Element headerElement, Column<T, ?> column, HasResizableColumns<T> table) { this.headerElement = headerElement; this.column = column; this.table = table; this.eventHandler = Event.addNativePreviewHandler(this); columnAbsoluteLeft = headerElement.getAbsoluteLeft(); // Indicate resize start table.onResizeStart(column, headerElement); }

Target:
public ColumnResizeHandler(Element headerElement, Column<T, ?> column, HasResizableColumns<T> table) { this.headerElement = headerElement; this.column = column; this.table = table; this.eventHandler = Event.addNativePreviewHandler(this); this.columnAbsoluteLeft = headerElement.getAbsoluteLeft(); // Indicate resize start table.onResizeStart(column, headerElement); }
Source:
protected BackendSystemOptionResource(String id) { this.id = id; }

Target:
public BackendSystemOptionResource(String id) { this.id = id; }
Source:
public String render(Number number) { if (number != null) { NumberFormat format = NumberFormat.getDecimalFormat(); return format.format(number); } else { return null; } }

Target:
public String render(Number number) { if (number != null) { NumberFormat format = NumberFormat.getDecimalFormat(); return format.format(number); } else { return ""; //$NON-NLS-1$ } }
Source:
public void addMainContentView(String label, String historyToken, String contentUrl, int priority, boolean defaultPlace) { menuPresenterWidget.addMenuItem(priority, label, historyToken); // Not interested in the actual proxy, it will register itself. dynamicUrlContentProxyFactory.create(historyToken, contentUrl); if (defaultPlace && placeManager instanceof WebAdminPlaceManager) { ((WebAdminPlaceManager) placeManager).setDefaultPlace(historyToken); } }

Target:
public void addMainContentView(String label, String historyToken, String contentUrl, int priority, boolean defaultPlace) { menuPresenterWidget.addMenuItem(priority, label, historyToken); // Not interested in the actual proxy, it will register itself. dynamicUrlContentProxyFactory.create(historyToken, contentUrl); placeManager.setDefaultPlace(historyToken); }
Source:
protected void setQcowCompatByQemuImageInfo(Guid storagePoolId, Guid newImageGroupId, Guid newImageId, Guid newStorageDomainID, DiskImage diskImage) { // If the VM is running then the volume is already prepared in the guest's host so there // is no need for prepare and teardown. VM vm = vmDao.getVmsWithPlugInfo(diskImage.getId()).stream(). map(pair -> pair.getFirst()). findFirst().get(); setQcowCompat(diskImage.getImage(), storagePoolId, newImageGroupId, newImageId, newStorageDomainID, vm.getRunOnVds()); }

Target:
protected void setQcowCompatByQemuImageInfo(Guid storagePoolId, Guid newImageGroupId, Guid newImageId, Guid newStorageDomainID, DiskImage diskImage) { // If the VM is running then the volume is already prepared in the guest's host so there // is no need for prepare and teardown. VM vm = vmDao.getVmsWithPlugInfo(diskImage.getId()).stream(). map(Pair::getFirst). findFirst().get(); setQcowCompat(diskImage.getImage(), storagePoolId, newImageGroupId, newImageId, newStorageDomainID, vm.getRunOnVds()); }
Source:
public void setGuestCpuType(String value) { if (!Objects.equals(createdByUser, value)) { guestCpuType = value; onPropertyChanged(new PropertyChangedEventArgs("GuestCpuType")); //$NON-NLS-1$ } }

Target:
public void setGuestCpuType(String value) { if (!Objects.equals(guestCpuType, value)) { guestCpuType = value; onPropertyChanged(new PropertyChangedEventArgs("GuestCpuType")); //$NON-NLS-1$ } }
Source:
private List<NetworkCluster> createNetworkAttachments() { List<NetworkCluster> networkAttachments = new ArrayList<>(); getClustersToAttach().stream().forEach(networkClusterModel -> { NetworkCluster networkCluster = new NetworkCluster(); networkCluster.setClusterId(networkClusterModel.getEntity().getId()); networkCluster.setRequired(networkClusterModel.isRequired()); networkAttachments.add(networkCluster); }); return networkAttachments; }

Target:
private List<NetworkCluster> createNetworkAttachments() { List<NetworkCluster> networkAttachments = new ArrayList<>(); getClustersToAttach().forEach(networkClusterModel -> { NetworkCluster networkCluster = new NetworkCluster(); // Network id is added in the backend networkCluster.setClusterId(networkClusterModel.getEntity().getId()); networkCluster.setRequired(networkClusterModel.isRequired()); networkAttachments.add(networkCluster); }); return networkAttachments; }
Source:
public MenuPresenterWidget(EventBus eventBus, MenuPresenterWidget.ViewDef view, Provider<ConfigurePopupPresenterWidget> configurePopupProvider) { super(eventBus, view); this.configurePopupProvider = configurePopupProvider; for (int i = 0; i < PrimaryMenuContainerType.values().length; i++) { menuContainers.add(PrimaryMenuContainerType.values()[i].getId()); } // Add null for events which is not a container, but we need to keep the indexes in sync. menuContainers.add(null); }

Target:
public MenuPresenterWidget(EventBus eventBus, MenuPresenterWidget.ViewDef view, Provider<ConfigurePopupPresenterWidget> configurePopupProvider) { super(eventBus, view); this.configurePopupProvider = configurePopupProvider; for (PrimaryMenuContainerType type: PrimaryMenuContainerType.values()) { menuContainers.add(type.getId()); } // Add null for events which is not a container, but we need to keep the indexes in sync. menuContainers.add(null); }
Source:
private boolean shouldAbortOnClientInactivityTimeout(ImageTransfer entity, long ts, Integer idleTimeFromTicket) { int inactivityTimeout = entity.getClientInactivityTimeout() != null ? entity.getClientInactivityTimeout() : getTransferImageClientInactivityTimeoutInSeconds(); // For new daemon (1.3.0), we check timeout according to 'idle_time' in ticket; // otherwise, fallback to check according to entity's 'lastUpdated'. boolean timeoutExceeded = idleTimeFromTicket != null ? idleTimeFromTicket > inactivityTimeout : ts > (entity.getLastUpdated().getTime() / 1000) + inactivityTimeout; return inactivityTimeout > 0 && timeoutExceeded && !entity.getActive(); }

Target:
private boolean shouldAbortOnClientInactivityTimeout(ImageTransfer entity, long ts, Integer idleTimeFromTicket) { int inactivityTimeout = entity.getClientInactivityTimeout(); // For new daemon (1.3.0), we check timeout according to 'idle_time' in ticket; // otherwise, fallback to check according to entity's 'lastUpdated'. boolean timeoutExceeded = idleTimeFromTicket != null ? idleTimeFromTicket > inactivityTimeout : ts > (entity.getLastUpdated().getTime() / 1000) + inactivityTimeout; return inactivityTimeout > 0 && timeoutExceeded && !entity.getActive(); }
Source:
private boolean isConsoleCommandsExecutionAllowed() { if (getSelectedItem() == null) { return false; } // return true, if at least one console is available return getSelectedItems() .stream() .map(consolesFactory::getVmConsolesForVm) .anyMatch(VmConsoles::canConnectToConsole); }

Target:
private boolean isConsoleCommandsExecutionAllowed() { if (getSelectedItems() == null) { return false; } // return true, if at least one console is available return getSelectedItems() .stream() .map(consolesFactory::getVmConsolesForVm) .anyMatch(VmConsoles::canConnectToConsole); }
Source:
private boolean shouldAbortOnClientInactivityTimeout(ImageTransfer entity, long ts, Integer idleTimeFromTicket) { int inactivityTimeout = getTransferImageClientInactivityTimeoutInSeconds(); // For new daemon (1.3.0), we check timeout according to 'idle_time' in ticket; // otherwise, fallback to check according to entity's 'lastUpdated'. boolean timeoutExceeded = idleTimeFromTicket != null ? idleTimeFromTicket > inactivityTimeout : ts > (entity.getLastUpdated().getTime() / 1000) + inactivityTimeout; return inactivityTimeout > 0 && timeoutExceeded && entity.getPhase().canBePaused() && !entity.getActive(); }

Target:
private boolean shouldAbortOnClientInactivityTimeout(ImageTransfer entity, long ts, Integer idleTimeFromTicket) { int inactivityTimeout = getTransferImageClientInactivityTimeoutInSeconds(); // For new daemon (1.3.0), we check timeout according to 'idle_time' in ticket; // otherwise, fallback to check according to entity's 'lastUpdated'. boolean timeoutExceeded = idleTimeFromTicket != null ? idleTimeFromTicket > inactivityTimeout : ts > (entity.getLastUpdated().getTime() / 1000) + inactivityTimeout; return inactivityTimeout > 0 && timeoutExceeded && !entity.getActive(); }
Source:
private void mapPhysicalNetworkParameters(com.woorea.openstack.quantum.model.Network externalNetwork, Network network) { String providerNetworkType = externalNetwork.getProviderNetworkType(); network.getProvidedBy().setExternalVlanId(providerNetworkType != null && providerNetworkType.equals(VLAN_NETWORK) ? externalNetwork.getProviderSegmentationId() : null); network.getProvidedBy().setCustomPhysicalNetworkName(externalNetwork.getProviderPhysicalNetwork()); }

Target:
private void mapPhysicalNetworkParameters(com.woorea.openstack.quantum.model.Network externalNetwork, Network network) { String providerNetworkType = externalNetwork.getProviderNetworkType(); network.getProvidedBy().setExternalVlanId(VLAN_NETWORK.equals(providerNetworkType) ? externalNetwork.getProviderSegmentationId() : null); network.getProvidedBy().setCustomPhysicalNetworkName(externalNetwork.getProviderPhysicalNetwork()); }
Source:
public void vmTypeChanged(VmType vmType) { // provisioning thin -> false // provisioning clone -> true if (getModel().getProvisioning().getIsAvailable()) { getModel().getProvisioning().setEntity(vmType == VmType.Server || vmType == VmType.HighPerformance); } if (getModel().getIoThreadsEnabled().getIsAvailable()) { getModel().getIoThreadsEnabled().setEntity(vmType == VmType.Server || vmType == VmType.HighPerformance); } super.vmTypeChanged(vmType); }

Target:
public void vmTypeChanged(VmType vmType) { // provisioning thin -> false // provisioning clone -> true if (getModel().getProvisioning().getIsAvailable()) { getModel().getProvisioning().setEntity(vmType == VmType.Server || vmType == VmType.HighPerformance); } super.vmTypeChanged(vmType); }
Source:
protected boolean validate() { if (!super.validate() || !checkStorageDomain()) { return false; } // Only after validating the existence of the storage domain in DB, we set the field lastTimeUsedAsMaster in the // storage domain which is about to be updated. oldDomain = storageDomainStaticDao.get(getStorageDomain().getId()); getStorageDomain().setLastTimeUsedAsMaster(oldDomain.getLastTimeUsedAsMaster()); return validateMasterDomainCannotBeBackup() && validateStoragePropertiesUpdate(); }

Target:
protected boolean validate() { if (!super.validate() || !checkStorageDomain()) { return false; } // Only after validating the existence of the storage domain in DB, we set the field lastTimeUsedAsMaster in the // storage domain which is about to be updated. oldDomain = storageDomainStaticDao.get(getStorageDomain().getId()); getStorageDomain().setLastTimeUsedAsMaster(oldDomain.getLastTimeUsedAsMaster()); return validateStoragePropertiesUpdate(); }
Source:
public boolean shouldUseNativeIO(VM vm, DiskImage diskImage, VmDevice device) { StorageType storageType = diskImage.getStorageTypes().get(0); String diskType = getDiskType(vm, diskImage, device); boolean isNativeIO = !"file".equals(diskType) || (storageType == StorageType.GLUSTERFS && FeatureSupported.useNativeIOForGluster(vm.getCompatibilityVersion())); // marked as transient disk and uses cache when snapshotId is not null if ("file".equals(diskType) && device.getSnapshotId() != null) { isNativeIO = false; } return isNativeIO; }

Target:
public boolean shouldUseNativeIO(VM vm, DiskImage diskImage, VmDevice device) { StorageType storageType = diskImage.getStorageTypes().get(0); String diskType = getDiskType(vm, diskImage, device); boolean isNativeIO = !"file".equals(diskType) || (storageType == StorageType.GLUSTERFS && FeatureSupported.useNativeIOForGluster(vm.getCompatibilityVersion())); // marked as transient disk (file type) and uses cache when snapshotId is not null if (device.getSnapshotId() != null) { isNativeIO = false; } return isNativeIO; }
Source:
public static boolean areSameId(NetworkAttachment a, NetworkAttachment b) { return a != null && b != null && a.getId() != null && a.getId().equals(b.getId()); }

Target:
static boolean areSameId(NetworkAttachment a, NetworkAttachment b) { return a != null && b != null && a.getId() != null && a.getId().equals(b.getId()); }
Source:
static boolean areSameId(NetworkAttachment a, NetworkAttachment b) { return a != null && b != null && a.getId() != null && a.getId().equals(b.getId()); }

Target:
private static boolean areSameId(NetworkAttachment a, NetworkAttachment b) { return a != null && b != null && a.getId() != null && a.getId().equals(b.getId()); }
Source:
private void adjustKVMDataForBlockSD() { // This is a workaround until bz 1332019 will be merged // since KVM is currently the only source for which we use Libvirt streaming API. // Libvirt currently reports the actual disk size and the virtual one, // when using preallocated qcow2 on block domain the size that the Libvirt stream emits // can be larger then the actual size. // Separately, setting the Volume Type to Preallocated avoids Sparseness when the // Destination is a Block SD if (getVm().getOrigin() == OriginType.KVM && getActionState() == CommandActionState.EXECUTE && getStorageDomain() != null && getStorageDomain().getStorageType().isBlockDomain()) { getVm().getImages().forEach(image -> image.setActualSizeInBytes(image.getSize())); getVm().getImages().forEach(image -> image.setVolumeType(VolumeType.Preallocated)); } }

Target:
private void adjustKVMDataForBlockSD() { // This is a workaround until bz 1332019 will be merged // since KVM is currently the only source for which we use Libvirt streaming API. // Libvirt currently reports the actual disk size and the virtual one, // when using preallocated qcow2 on block domain the size that the Libvirt stream emits // can be larger then the actual size. // Separately, setting the Volume Type to Preallocated avoids Sparseness when the // Destination is a Block SD if (getVm().getOrigin() == OriginType.KVM && getActionState() == CommandActionState.EXECUTE && getStorageDomain() != null && getStorageDomain().getStorageType().isBlockDomain()) { getVm().getImages().forEach(image -> { image.setActualSizeInBytes(image.getSize()); image.setVolumeType(VolumeType.Preallocated); }); } }
Source:
private void addMaintenanceFailedReason(List<String> failedMessages) { Guid rootCommandGuid = commandsRepository.getCommandEntity(getCommandId()).getRootCommandId(); CommandBase<T> rootCommand = commandCoordinatorUtil.retrieveCommand(rootCommandGuid); String messageToDisplay = failedMessages.get(0); rootCommand.addCustomValue("Message", messageToDisplay); auditLogDirector.log(rootCommand, AuditLogType.VDS_MAINTENANCE_FAILED_REASON, messageToDisplay); }

Target:
private void addMaintenanceFailedReason(List<String> failedMessages) { Guid rootCommandGuid = commandsRepository.getCommandEntity(getCommandId()).getRootCommandId(); CommandBase<T> rootCommand = commandCoordinatorUtil.retrieveCommand(rootCommandGuid); String messageToDisplay = failedMessages.get(0); addCustomValue("Message", messageToDisplay); auditLogDirector.log(this, AuditLogType.VDS_MAINTENANCE_FAILED_REASON, messageToDisplay); // rootCommand.addCustomValue("Message", messageToDisplay); // auditLogDirector.log(rootCommand, AuditLogType.VDS_MAINTENANCE_FAILED_REASON, messageToDisplay); }
Source:
public boolean isUnregisteredTemplate() { Template unregisteredTemplate; try { unregisteredTemplate = performGet(QueryType.GetUnregisteredVmTemplate, new GetUnregisteredEntityQueryParameters(parent.storageDomainId, guid)); } catch (WebApplicationException e) { if (e.getResponse().getStatus() == Response.Status.NOT_FOUND.getStatusCode()) { return false; } throw e; } return unregisteredTemplate != null; }

Target:
private boolean isUnregisteredTemplate() { Template unregisteredTemplate; try { unregisteredTemplate = performGet(QueryType.GetUnregisteredVmTemplate, new GetUnregisteredEntityQueryParameters(parent.storageDomainId, guid)); } catch (WebApplicationException e) { if (e.getResponse().getStatus() == Response.Status.NOT_FOUND.getStatusCode()) { return false; } throw e; } return unregisteredTemplate != null; }
Source:
private void initUnregisteredEntity(Guid entityId, Guid storageDomainId) { if (!isUnregisteredEntityExists()) { List<OvfEntityData> ovfEntityList = unregisteredOVFDataDao.getByEntityIdAndStorageDomain(entityId, storageDomainId); if (!ovfEntityList.isEmpty()) { // We should get only one entity, since we fetched the entity with a specific Storage Domain ovfEntityData = ovfEntityList.get(0); try { setUnregisteredEntityAndImages(); } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration: {}:\n{}", e.getMessage(), ovfEntityData.getOvfData()); log.debug("Exception: ", e); } } } }

Target:
private void initUnregisteredEntity(Guid entityId, Guid storageDomainId) { List<OvfEntityData> ovfEntityList = unregisteredOVFDataDao.getByEntityIdAndStorageDomain(entityId, storageDomainId); if (!ovfEntityList.isEmpty()) { // We should get only one entity, since we fetched the entity with a specific Storage Domain ovfEntityData = ovfEntityList.get(0); try { setUnregisteredEntityAndImages(); } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration: {}:\n{}", e.getMessage(), ovfEntityData.getOvfData()); log.debug("Exception: ", e); } } }
Source:
protected void initUnregisteredEntity(Guid entityId, Guid storageDomainId) { if (!isUnregisteredEntityExists()) { List<OvfEntityData> ovfEntityList = unregisteredOVFDataDao.getByEntityIdAndStorageDomain(entityId, storageDomainId); if (!ovfEntityList.isEmpty()) { // We should get only one entity, since we fetched the entity with a specific Storage Domain ovfEntityData = ovfEntityList.get(0); try { setUnregisteredEntityAndImages(); } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration: {}:\n{}", e.getMessage(), ovfEntityData.getOvfData()); log.debug("Exception: ", e); } } } }

Target:
private void initUnregisteredEntity(Guid entityId, Guid storageDomainId) { if (!isUnregisteredEntityExists()) { List<OvfEntityData> ovfEntityList = unregisteredOVFDataDao.getByEntityIdAndStorageDomain(entityId, storageDomainId); if (!ovfEntityList.isEmpty()) { // We should get only one entity, since we fetched the entity with a specific Storage Domain ovfEntityData = ovfEntityList.get(0); try { setUnregisteredEntityAndImages(); } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration: {}:\n{}", e.getMessage(), ovfEntityData.getOvfData()); log.debug("Exception: ", e); } } } }
Source:
public void setUpQueryEntitiesNotFound() { // Mock the Daos when(unregisteredOVFDataDaoMock.getByEntityIdAndStorageDomain(entityId, storageDomainId)).thenReturn( new ArrayList<>()); }

Target:
private void setUpQueryEntitiesNotFound() { // Mock the Daos when(unregisteredOVFDataDaoMock.getByEntityIdAndStorageDomain(entityId, storageDomainId)).thenReturn( new ArrayList<>()); }
Source:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getImportCommand()) { restore(); } else if (command == getRemoveCommand()) { remove(); } else if ("OnRemove".equals(command.getName())) { //$NON-NLS-1$) onRemove(); } else if (command.getName().equals("Cancel")) { //$NON-NLS-1$ cancel(); } }

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getImportCommand()) { restore(); } else if (command == getRemoveCommand()) { remove(); } else if (command.getName().equals("OnRemove")) { //$NON-NLS-1$) onRemove(); } else if (command.getName().equals("Cancel")) { //$NON-NLS-1$ cancel(); } }
Source:
public static Stream<MockConfigDescriptor<?>> mockConfiguration() { return Stream.of( MockConfigDescriptor.of(ConfigValues.OrganizationName, "oVirt"), MockConfigDescriptor.of(ConfigValues.SetupNetworksWaitTimeoutSeconds, 5000) ); }

Target:
public static Stream<MockConfigDescriptor<?>> mockConfiguration() { return Stream.of(MockConfigDescriptor.of(ConfigValues.OrganizationName, "oVirt")); }
Source:
public Disk update(Disk incoming) { // If the QCOW version is specified, then perform the update: if (incoming.isSetQcowVersion()) { return performUpdate( incoming, new QueryIdResolver<>(QueryType.GetDiskByDiskId, IdQueryParameters.class), ActionType.AmendImageGroupVolumes, new UpdateParametersProvider()); } return performUpdate(incoming, new DiskResolver(), ActionType.UpdateVmDisk, new BackendDiskResource.UpdateParametersProvider()); }

Target:
public Disk update(Disk incoming) { // If the QCOW version is specified, then perform the update: if (incoming.isSetQcowVersion()) { return performUpdate( incoming, new QueryIdResolver<>(QueryType.GetDiskByDiskId, IdQueryParameters.class), ActionType.AmendImageGroupVolumes, new UpdateParametersProvider()); } return performUpdate(incoming, new QueryIdResolver<>(QueryType.GetDiskByDiskId, IdQueryParameters.class), ActionType.UpdateVmDisk, new BackendDiskResource.UpdateParametersProvider()); }
Source:
private void updateDiskSize(DiskImage diskImage) { try { long sizeToAddInGigabytes = Long.parseLong(getSizeExtend().getEntity()); if (sizeToAddInGigabytes > 0) { diskImage.setSizeInGigabytes(diskImage.getSizeInGigabytes() + sizeToAddInGigabytes); } } catch (NumberFormatException ignored) { } }

Target:
private void updateDiskSize(DiskImage diskImage) { long sizeToAddInGigabytes; try { sizeToAddInGigabytes = Long.parseLong(getSizeExtend().getEntity()); } catch (NumberFormatException ignored) { // the catch block is ignored because of the error will be caught in the validation stage // the engine log and the UI will show appropriate error and force valid input. return; } if (sizeToAddInGigabytes > 0) { diskImage.setSizeInGigabytes(diskImage.getSizeInGigabytes() + sizeToAddInGigabytes); } }
Source:
public void afterRefreshTreatment() { try { prometheusClient.close(); } catch (IOException e) { // ignore } }

Target:
public void afterRefreshTreatment() { try { if (prometheusClient != null) { prometheusClient.close(); } } catch (IOException e) { // ignore } }
Source:
public void stopMonitoring() { super.stopMonitoring(); try { prometheusClient.close(); } catch (IOException e) { // ignore } }

Target:
public void stopMonitoring() { super.stopMonitoring(); try { if (prometheusClient != null) { prometheusClient.close(); } } catch (IOException e) { // ignore } }
Source:
private boolean addImageTicketToProxy(Guid imagedTicketId, String hostUri) { // Create image ticket String imagePath = String.format( // ToDo: move formatting to an helper for reuse in ImageTransfer "%s%s/%s", hostUri, IMAGES_PATH, imagedTicketId); ImageTicket imageTicket = buildImageTicket(imagedTicketId, imagePath); log.info("Adding image ticket to ovirt-imageio-proxy, id {}", imagedTicketId); try { getProxyClient().putTicket(imageTicket); } catch (RuntimeException e) { log.error("Failed to add image ticket to ovirt-imageio-proxy: {}", e.getMessage(), e); return false; } return true; }

Target:
private boolean addImageTicketToProxy(Guid imagedTicketId, String hostUri) { // Create image ticket String url = String.format( // ToDo: move formatting to an helper for reuse in ImageTransfer "%s%s/%s", hostUri, IMAGES_PATH, imagedTicketId); ImageTicket imageTicket = buildImageTicket(imagedTicketId, url); log.info("Adding image ticket to ovirt-imageio-proxy, id {}", imagedTicketId); try { getProxyClient().putTicket(imageTicket); } catch (RuntimeException e) { log.error("Failed to add image ticket to ovirt-imageio-proxy: {}", e.getMessage(), e); return false; } return true; }
Source:
public static TransferDiskImageParameters createInitParams(DiskImage diskImage) { TransferDiskImageParameters parameters = new TransferDiskImageParameters(); parameters.setTransferType(TransferType.Download); parameters.setImageGroupID(diskImage.getId()); String fileExtension = diskImage.getVolumeFormat() == VolumeFormat.COW ? ".qcow2" : ".raw"; //$NON-NLS-1$ //$NON-NLS-2$ parameters.setDownloadFilename(diskImage.getDiskAlias() + fileExtension); //$NON-NLS-1$ parameters.setTransferSize(diskImage.getActualSizeInBytes()); parameters.setTransferringViaBrowser(true); return parameters; }

Target:
static TransferDiskImageParameters createInitParams(DiskImage diskImage) { TransferDiskImageParameters parameters = new TransferDiskImageParameters(); parameters.setTransferType(TransferType.Download); parameters.setImageGroupID(diskImage.getId()); String fileExtension = diskImage.getVolumeFormat() == VolumeFormat.COW ? ".qcow2" : ".raw"; //$NON-NLS-1$ //$NON-NLS-2$ parameters.setDownloadFilename(diskImage.getDiskAlias() + fileExtension); //$NON-NLS-1$ parameters.setTransferSize(diskImage.getActualSizeInBytes()); parameters.setTransferringViaBrowser(true); return parameters; }
Source:
public TransferDiskImageParameters createInitParams(DiskImage diskImage) { TransferDiskImageParameters parameters = new TransferDiskImageParameters(); parameters.setTransferType(TransferType.Download); parameters.setImageGroupID(diskImage.getId()); String fileExtension = diskImage.getVolumeFormat() == VolumeFormat.COW ? ".qcow2" : ".raw"; //$NON-NLS-1$ //$NON-NLS-2$ parameters.setDownloadFilename(diskImage.getDiskAlias() + fileExtension); //$NON-NLS-1$ parameters.setTransferSize(diskImage.getActualSizeInBytes()); parameters.setTransferringViaBrowser(true); return parameters; }

Target:
public static TransferDiskImageParameters createInitParams(DiskImage diskImage) { TransferDiskImageParameters parameters = new TransferDiskImageParameters(); parameters.setTransferType(TransferType.Download); parameters.setImageGroupID(diskImage.getId()); String fileExtension = diskImage.getVolumeFormat() == VolumeFormat.COW ? ".qcow2" : ".raw"; //$NON-NLS-1$ //$NON-NLS-2$ parameters.setDownloadFilename(diskImage.getDiskAlias() + fileExtension); //$NON-NLS-1$ parameters.setTransferSize(diskImage.getActualSizeInBytes()); parameters.setTransferringViaBrowser(true); return parameters; }
Source:
protected void createCommentEditor(final int suggestRow, final int column, final int line, final short file) { createCommentEditor(suggestRow, column, line, file, ""); }

Target:
protected void createCommentEditor(final int suggestRow, final int column, final int line, final short file) { createCommentEditor(suggestRow, column, line, file, null /* no parent */); }
Source:
public int allowedValueForRef(Set<AccountGroup.Id> groups) { int val = Integer.MIN_VALUE; for (RefRight right : rights) { if (groups.contains(right.getAccountGroupId())) { if ((val < 0 && right.getMaxValue() > 0)) { // If one of the user's groups had denied them access, but // this group grants them access, prefer the grant over // the denial. We have to break the tie somehow and we // prefer being "more open" to being "more closed". // val = Math.max(right.getMaxValue(), val); } } } return val; }

Target:
public int allowedValueForRef(Set<AccountGroup.Id> groups) { int val = Integer.MIN_VALUE; for (RefRight right : rights) { if (groups.contains(right.getAccountGroupId())) { val = Math.max(right.getMaxValue(), val); } } return val; }
Source:
ProjectQoSFilter(final Provider<CurrentUser> userProvider, QueueProvider queue, final ServletContext context, @GerritServerConfig final Config cfg) { this.userProvider = userProvider; this.executor = queue.getInteractiveQueue(); this.context = context; this.maxWait = getTimeUnit(cfg, "httpd", null, "maxwait", 5, MINUTES); }

Target:
ProjectQoSFilter(final Provider<CurrentUser> userProvider, QueueProvider queue, final ServletContext context, @GerritServerConfig final Config cfg) { this.userProvider = userProvider; this.queue = queue; this.context = context; this.maxWait = getTimeUnit(cfg, "httpd", null, "maxwait", 5, MINUTES); }
Source:
public static String invertSortKey(String sk) { if (sk.equalsIgnoreCase("z")) { return "/"; // The character before '0' } StringBuilder inv = new StringBuilder(16); inv.setLength(16); formatHexLong(inv, -1l - parseUnsignedHex(sk)); return inv.toString(); }

Target:
public static String invertSortKey(String sk) { if (sk.equalsIgnoreCase("z")) { return "/"; // The character before '0' } else if (sk.equalsIgnoreCase("/")) { return "z"; } StringBuilder inv = new StringBuilder(16); inv.setLength(16); formatHexLong(inv, -1l - parseUnsignedHex(sk)); return inv.toString(); }
Source:
public T toObject(ProtobufCodec<T> codec, Provider<T> provider) { if (object == null) { this.codec = codec; if (provider == null) { object = codec.decode(buf); } else { object = provider.get(); try { codec.mergeFrom(CodedInputStream.newInstance(buf), object); } catch (IOException e) { throw new RuntimeException("Cannot decode message", e); } } // Free the memory being taken up by the buffer. buf = null; } return object; }

Target:
T toObject(ProtobufCodec<T> codec, Provider<T> provider) { if (object == null) { this.codec = codec; if (provider == null) { object = codec.decode(buf); } else { object = provider.get(); codec.mergeFrom(buf, object); } // Free the memory being taken up by the buffer. buf = null; } return object; }
Source:
public void run() { try { final ReviewDb db = schema.open(); try { for (final Project project : db.projects().all()) { if (!project.getNameKey().equals(wildProject.getNameKey())) { replication.scheduleFullSync(project.getNameKey(), urlMatch); } } } finally { db.close(); } } catch (OrmException e) { log.error("Cannot enumerate known projects", e); } }

Target:
public void run() { try { final ReviewDb db = schema.open(); try { for (final Project project : db.projects().all()) { if (!project.getId().equals(wildProject.getId())) { replication.scheduleFullSync(project.getNameKey(), urlMatch); } } } finally { db.close(); } } catch (OrmException e) { log.error("Cannot enumerate known projects", e); } }
Source:
private void onTextBoxBase(final TextBoxBase tb) { // The text appears to not get updated until the handlers complete. DeferredCommand.add(new Command() { public void execute() { String orig = strings.get(tb); orig = orig == null ? "" : orig; if (! orig.equals(tb.getText())) { widget.setEnabled(true); } } }); }

Target:
private void onTextBoxBase(final TextBoxBase tb) { // The text appears to not get updated until the handlers complete. DeferredCommand.add(new Command() { @Override public void execute() { String orig = strings.get(tb); if (orig == null) { orig = ""; } if (! orig.equals(tb.getText())) { widget.setEnabled(true); } } }); }