auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Map getVmStats(String uuid) { final Host host = getActiveHost(); //about to add some changes Map resultMap = getDoneStatus(); List statusList = new ArrayList(); VM vm = host.getRunningVMs().get(uuid); statusList.add(fillVmStatsMap(vm)); resultMap.put("statsList", statusList); Utils.getLatency(); return resultMap; }

Target:
public Map getVmStats(String uuid) { final Host host = getActiveHost(); Map resultMap = getDoneStatus(); List statusList = new ArrayList(); VM vm = host.getRunningVMs().get(uuid); if (vm != null){ statusList.add(fillVmStatsMap(vm)); } resultMap.put("statsList", statusList); Utils.getLatency(); return resultMap; }
Source:
public SubTabVirtualMachineGeneralView(DetailModelProvider<VmListModel, VmGeneralModel> modelProvider, ApplicationConstants constants) { super(modelProvider); this.form = new VmGeneralModelForm(modelProvider, constants); // Inject a reference to the resources: resources = ClientGinjectorProvider.getApplicationResources(); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); clearAlerts(); generateIds(); this.form.setElementIdPrefixes(); }

Target:
public SubTabVirtualMachineGeneralView(DetailModelProvider<VmListModel, VmGeneralModel> modelProvider, ApplicationConstants constants) { super(modelProvider); this.form = new VmGeneralModelForm(modelProvider, constants); // Inject a reference to the resources: resources = ClientGinjectorProvider.getApplicationResources(); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); clearAlerts(); generateIds(); }
Source:
public void discoverGeoRepData() { // get all clusters List<VDSGroup> clusters = getClusterDao().getAll(); // for every cluster that supports geo-rep monitoring for (VDSGroup cluster : clusters) { discoverGeoRepDataInCluster(cluster, null); } }

Target:
public void discoverGeoRepData() { // get all clusters List<VDSGroup> clusters = getClusterDao().getAll(); // for every cluster that supports geo-rep monitoring for (VDSGroup cluster : clusters) { discoverGeoRepDataInCluster(cluster); } }
Source:
private void discoverHostName_SelectedItemChanged() { ExternalDiscoveredHost dhost = (ExternalDiscoveredHost) getExternalDiscoveredHosts().getSelectedItem(); ExternalHostGroup dhg = (ExternalHostGroup) getExternalHostGroups().getSelectedItem(); VDS vds = new VDS(); if (dhost != null && dhg != null) { vds.setVdsName(dhost.getName() + "." + dhg.getDomainName()); //$NON-NLS-1$ vds.setHostName(dhost.getIp()); } updateModelFromVds(vds, null, false, null); }

Target:
private void discoverHostName_SelectedItemChanged() { ExternalDiscoveredHost dhost = (ExternalDiscoveredHost) getExternalDiscoveredHosts().getSelectedItem(); ExternalHostGroup dhg = (ExternalHostGroup) getExternalHostGroups().getSelectedItem(); VDS vds = new VDS(); if (dhost != null && dhg != null) { vds.setVdsName(dhost.getName()); vds.setHostName(dhost.getName() + "." + dhg.getDomainName()); //$NON-NLS-1$ } updateModelFromVds(vds, null, false, null); }
Source:
private void init() { setMasterVolume(new EntityModel<String>()); setSlaveVolume(new EntityModel<String>()); setSlaveHost(new EntityModel<String>()); setForce(new EntityModel<Boolean>()); setMessage("");//$NON-NLS-1$ getForce().setEntity(false); }

Target:
private void init() { setMasterVolume(new EntityModel<String>()); setSlaveVolume(new EntityModel<String>()); setSlaveHost(new EntityModel<String>()); setForce(new EntityModel<Boolean>()); getForce().setEntity(false); }
Source:
public void canDoActionFailedUpdateReadOnly() { VmDevice device = createVmDevice(diskImageGuid, vmId); // make sure that device is plugged assertEquals(true, device.getIsPlugged()); when(diskDao.get(diskImageGuid)).thenReturn(createDiskImage()); UpdateVmDiskParameters parameters = createParameters(); parameters.getDiskInfo().setReadOnly(true); initializeCommand(parameters, Collections.singletonList(createVm(VMStatus.Up))); CanDoActionTestUtils.runAndAssertCanDoActionFailure(command, VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); }

Target:
public void canDoActionFailedUpdateReadOnly() { when(diskDao.get(diskImageGuid)).thenReturn(createDiskImage()); UpdateVmDiskParameters parameters = createParameters(); parameters.getDiskInfo().setReadOnly(true); initializeCommand(parameters, Collections.singletonList(createVm(VMStatus.Up))); CanDoActionTestUtils.runAndAssertCanDoActionFailure(command, VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); }
Source:
private static String findActiveNicName(VDS vds, Map<String, Map<String, Object>> bridges) { final String hostIp = NetworkUtils.getHostByIp(vds); // by now, if the host is communicating with engine over a valid interface, // the interface will have the host's engine IP final VdsNetworkInterface activeIface = resolveActiveNic(vds, hostIp); String hostActiveNic = (activeIface == null) ? null : activeIface.getName(); final String activeBridge = findActiveBridge(hostIp, bridges); if (activeBridge != null) { hostActiveNic = activeBridge; } return hostActiveNic; }

Target:
private static String findActiveNicName(VDS vds, Map<String, Map<String, Object>> bridges) { final String hostIp = NetworkUtils.getHostByIp(vds); final String activeBridge = findActiveBridge(hostIp, bridges); if (activeBridge != null) { return activeBridge; } // by now, if the host is communicating with engine over a valid interface, // the interface will have the host's engine IP final VdsNetworkInterface activeIface = resolveActiveNic(vds, hostIp); String hostActiveNic = (activeIface == null) ? null : activeIface.getName(); return hostActiveNic; }
Source:
RequestBuilder createKeepAliveRequest() { RequestBuilder builder = createRequest(); // This request shouldn't do anything other than refresh the REST API session builder.setHeader(ENGINE_REFRESH_HEADER, "refresh-only"); //$NON-NLS-1$ return builder; }

Target:
RequestBuilder createKeepAliveRequest() { return createRequest(); }
Source:
public void setVmNetwork(Boolean vmNetwork) { if (!ObjectUtils.objectsEqual(this.vmNetwork, vmNetwork)) { this.vmNetwork = vmNetwork; onPropertyChanged(new PropertyChangedEventArgs("Vm Network")); //$NON-NLS-1$ } }

Target:
public void setVmNetwork(Boolean vmNetwork) { this.vmNetwork = vmNetwork; }
Source:
private void addCheckBox(T checkBoxValue) { String checkBoxLabel = renderer.render(checkBoxValue); if (checkBoxLabel == null) { throw new IllegalArgumentException("null value is not permited"); //$NON-NLS-1$ } if (checkBoxes.containsKey(checkBoxValue)) { throw new IllegalArgumentException("Duplicate value: " + checkBoxLabel); //$NON-NLS-1$ } final CheckBox newCheckBox = buildCheckbox(checkBoxValue); checkBoxes.put(checkBoxValue, newCheckBox); }

Target:
private void addCheckBox(T checkBoxValue) { String checkBoxLabel = renderer.render(checkBoxValue); if (checkBoxLabel == null) { throw new IllegalArgumentException("null value is not permited"); //$NON-NLS-1$ } final CheckBox newCheckBox = buildCheckbox(checkBoxValue); checkBoxes.put(checkBoxValue, newCheckBox); }
Source:
private double getVdsMemLimit(VDS curVds) { // if single vm on host. Disregard memory over commitment int computedMemoryOverCommit = (curVds.getVmCount() == 0) ? 100 : curVds.getMaxVdsMemoryOverCommit(); double vdsMemLimit = computedMemoryOverCommit * curVds.getPhysicalMemMb() / 100.0; return vdsMemLimit; }

Target:
private double getVdsMemLimit(VDS curVds) { // if single vm on host. Disregard memory over commitment int computedMemoryOverCommit = (curVds.getVmCount() == 0) ? 100 : curVds.getMaxVdsMemoryOverCommit(); return (computedMemoryOverCommit * curVds.getPhysicalMemMb() / 100.0); }
Source:
public void setGlusterNetwork(ClusterNetworkModel model, boolean value) { if (!isMultiCluster()) { if (value) { // Reset the old gluster network if (getGlusterNetwork() != null) { getGlusterNetwork().setGlusterNetwork(false); } glusterNetwork = model; } else { // Set the management network as gluster getManagementNetwork().setGlusterNetwork(true); } } model.setGlusterNetwork(value); }

Target:
public void setGlusterNetwork(ClusterNetworkModel model, boolean value) { if (!isMultiCluster()) { if (value) { // Reset the old gluster network if (getGlusterNetwork() != null) { getGlusterNetwork().setGlusterNetwork(false); } glusterNetwork = model; } } model.setGlusterNetwork(value); }
Source:
public ValidationResult isUsingScsiReservationValid(VM vm, LunDisk lunDisk) { // this operation is valid only when attaching disk to VMs if (vm == null && Boolean.TRUE.equals(lunDisk.isUsingScsiReservation())) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_SCSI_RESERVATION_NOT_VALID_FOR_FLOATING_DISK); } // reservation is can be enabled only when sgio is unfiltered if (lunDisk.isUsingScsiReservation() != null && lunDisk.isUsingScsiReservation() && lunDisk.getSgio() == ScsiGenericIO.FILTERED) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_SGIO_IS_FILTERED); } return ValidationResult.VALID; }

Target:
public ValidationResult isUsingScsiReservationValid(VM vm, LunDisk lunDisk) { // this operation is valid only when attaching disk to VMs if (vm == null && Boolean.TRUE.equals(lunDisk.isUsingScsiReservation())) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_SCSI_RESERVATION_NOT_VALID_FOR_FLOATING_DISK); } // scsi reservation can be enabled only when sgio is unfiltered if (Boolean.TRUE.equals(lunDisk.isUsingScsiReservation()) && lunDisk.getSgio() == ScsiGenericIO.FILTERED) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_SGIO_IS_FILTERED); } return ValidationResult.VALID; }
Source:
public void testUpdateVmDeviceUsingScsiReservationProperty() { VmDevice vmDevice = dao.get(getExistingEntityId()); boolean usingScsiReservation = !vmDevice.isUsingScsiReservation(); Assert.assertTrue(StringUtils.isNotBlank(vmDevice.getAddress())); vmDevice.setUsingScsiReservation(usingScsiReservation); dao.update(vmDevice); dao.get(getExistingEntityId()); assertEquals(vmDevice.isUsingScsiReservation(), usingScsiReservation); }

Target:
public void testUpdateVmDeviceUsingScsiReservationProperty() { VmDevice vmDevice = dao.get(getExistingEntityId()); boolean usingScsiReservation = !vmDevice.isUsingScsiReservation(); vmDevice.setUsingScsiReservation(usingScsiReservation); dao.update(vmDevice); dao.get(getExistingEntityId()); assertEquals(vmDevice.isUsingScsiReservation(), usingScsiReservation); }
Source:
private VDS getAlternateUpServerInCluster(Guid clusterId, Guid vdsId) { List<VDS> vdsList = getVdsDao().getAllForVdsGroupWithStatus(clusterId, VDSStatus.Up); // If the cluster already having Gluster servers, get an up server if (vdsList != null && vdsList.size() > 0) { for (VDS vds : vdsList) { if (!vdsId.equals(vds.getId())) { return vds; } } } return null; }

Target:
private VDS getAlternateUpServerInCluster(Guid clusterId, Guid vdsId) { List<VDS> vdsList = getVdsDao().getAllForVdsGroupWithStatus(clusterId, VDSStatus.Up); // If the cluster already having Gluster servers, get an up server if (vdsList.isEmpty()) { return null; } for (VDS vds : vdsList) { if (!vdsId.equals(vds.getId())) { return vds; } } return null; }
Source:
private String formatVolClusterName(String volClusterName) { if (volClusterName == null) { return null; } String[] names = volClusterName.split("\\|"); //$NON-NLS-1$ return names.length == 2 ? names[0] + " (" + names[1] + ")" : names[0]; //$NON-NLS-1$ //$NON-NLS-2$ }

Target:
private String[] formatVolClusterName(String volClusterName) { if (volClusterName == null) { return null; } String[] names = volClusterName.split("\\|"); //$NON-NLS-1$ return names; }
Source:
private void revealDiskPanel(final AbstractDiskModel disk) { boolean isInVm = disk.getVm() != null; // Disk type (internal/external) selection panel is visible only when // 'Attach disk' mode is enabled or new LunDisk creation is enabled diskTypePanel.setVisible(isNewLunDiskEnabled); externalDiskPanel.setVisible(isNewLunDiskEnabled && disk.getDiskStorageType().getEntity() == DiskStorageType.LUN); diskErrorPolicyEditor.setVisible(disk.getDiskStorageType().getEntity() != DiskStorageType.LUN); aliasEditor.setFocus(!isInVm); }

Target:
private void revealDiskPanel(final AbstractDiskModel disk) { boolean isInVm = disk.getVm() != null; // Disk type (internal/external) selection panel is visible only when // 'Attach disk' mode is enabled or new LunDisk creation is enabled diskTypePanel.setVisible(isNewLunDiskEnabled); externalDiskPanel.setVisible(isNewLunDiskEnabled && disk.getDiskStorageType().getEntity() == DiskStorageType.LUN); aliasEditor.setFocus(!isInVm); }
Source:
private boolean checkLunsInStorageDomain(List<String> lunIds, StorageDomain storageDomain) { // Get LUNs from DB List<LUNs> lunsFromDb = getLunDao().getAllForVolumeGroup(getStorageDomain().getStorage()); List<String> lunsList = new ArrayList<>(lunIds); for (LUNs lun : lunsFromDb) { if (lunsList.contains(lun.getLUN_id())) { // LUN is part of the storage domain lunsList.remove(lun.getLUN_id()); } } return lunsList.isEmpty(); }

Target:
private boolean checkLunsInStorageDomain(List<String> lunIds, StorageDomain storageDomain) { // Get LUNs from DB List<LUNs> lunsFromDb = getLunDao().getAllForVolumeGroup(getStorageDomain().getStorage()); Set<String> lunsList = new HashSet<>(lunIds); for (LUNs lun : lunsFromDb) { if (lunsList.contains(lun.getLUN_id())) { // LUN is part of the storage domain lunsList.remove(lun.getLUN_id()); } } return lunsList.isEmpty(); }
Source:
public void SetVmUnknown(VM vm) { RemoveAsyncRunningVm(vm.getId()); InternalSetVmStatus(vm, VMStatus.Unknown, vm.getStatusUpdatedTime()); // log VM transition to unknown status AuditLogableBase logable = new AuditLogableBase(); logable.setVmId(vm.getId()); auditLogDirector.log(logable, AuditLogType.VM_SET_TO_UNKNOWN_STATUS); storeVm(vm); }

Target:
public void SetVmUnknown(VM vm) { RemoveAsyncRunningVm(vm.getId()); InternalSetVmStatus(vm, VMStatus.Unknown); // log VM transition to unknown status AuditLogableBase logable = new AuditLogableBase(); logable.setVmId(vm.getId()); auditLogDirector.log(logable, AuditLogType.VM_SET_TO_UNKNOWN_STATUS); storeVm(vm); }
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = getPermissionList(getParameters().getEvent()); // check for external host status modification if (hasHostExternalStatus()) { permissionList.add(new PermissionSubject(new Guid(getParameters().getEvent().getVdsId().toString()), VdcObjectType.VDS, ActionGroup.EDIT_HOST_CONFIGURATION)); } return permissionList; }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = getPermissionList(getParameters().getEvent()); // check for external host status modification if (hasHostExternalStatus()) { permissionList.add(new PermissionSubject(getParameters().getEvent().getVdsId(), VdcObjectType.VDS, ActionGroup.EDIT_HOST_CONFIGURATION)); } return permissionList; }
Source:
public List<RepoImage> getUserRequestForStorageDomainRepoFileList(Guid storageDomainId, ImageFileType imageType, boolean forceRefresh) { // The result list we send back. List<RepoImage> repoList; if (!isStorageDomainValid(storageDomainId, imageType, forceRefresh)) { throw new VdcBLLException(VdcBllErrors.GetIsoListError); } // At any case, if refreshed or not, get Iso list from the cache. repoList = getCachedIsoListByDomainId(storageDomainId, imageType); // Return list of repository files. return repoList; }

Target:
public List<RepoImage> getUserRequestForStorageDomainRepoFileList(Guid storageDomainId, ImageFileType imageType, boolean forceRefresh) { if (!isStorageDomainValid(storageDomainId, imageType, forceRefresh)) { throw new VdcBLLException(VdcBllErrors.GetIsoListError); } // At any case, if refreshed or not, get Iso list from the cache. return getCachedIsoListByDomainId(storageDomainId, imageType); }
Source:
public void fetch() { fetchTime = Calendar.getInstance().getTime(); VDSReturnValue getList = getResourceManager().runVdsCommand( VDSCommandType.List, new VdsIdAndVdsVDSCommandParametersBase(vdsManager.getCopyVds())); if (getList.getSucceeded()) { vdsmVms = (Map<Guid, VmInternalData>) getList.getReturnValue(); onFetchVms(); } else { onError(); } }

Target:
public void fetch() { VDSReturnValue getList = getResourceManager().runVdsCommand( VDSCommandType.List, new VdsIdAndVdsVDSCommandParametersBase(vdsManager.getCopyVds())); if (getList.getSucceeded()) { vdsmVms = (Map<Guid, VmInternalData>) getList.getReturnValue(); onFetchVms(); } else { onError(); } }
Source:
private Integer getWarningLowSpaceSize(StorageModel storageModel) { if (!storageModel.isNewStorage()) { Integer percentageValue = warningLowSpaceIndicatorEditor.asValueBox().getValue(); return percentageValue == null ? 0 : storageModel.getStorage().getTotalDiskSize() * percentageValue / 100; } return 0; // This is mot visible, hence meaningless. }

Target:
private Integer getWarningLowSpaceSize(StorageModel storageModel) { Integer percentageValue = warningLowSpaceIndicatorEditor.asValueBox().getValue(); return percentageValue == null ? 0 : storageModel.getStorage().getTotalDiskSize() * percentageValue / 100; }
Source:
void scheduleKeepAliveHeartbeat() { Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { @Override public boolean execute() { boolean sessionInUse = restApiSessionId != null; if (sessionInUse && refreshRestApiSession) { // The browser takes care of sending JSESSIONID cookie for this request automatically sendRequest(createRequest(engineAuthToken), new RestApiRequestCallback()); // Reset the refresh flag refreshRestApiSession = false; } // Proceed with the heartbeat only when the session is still in use return sessionInUse; } }, SESSION_HEARTBEAT_MS); }

Target:
void scheduleKeepAliveHeartbeat() { Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { @Override public boolean execute() { boolean sessionInUse = restApiSessionId != null; if (sessionInUse && refreshRestApiSession) { // The browser takes care of sending JSESSIONID cookie for this request automatically sendRequest(createRequest(), new RestApiRequestCallback()); // Reset the refresh flag refreshRestApiSession = false; } // Proceed with the heartbeat only when the session is still in use return sessionInUse; } }, SESSION_HEARTBEAT_MS); }
Source:
private void updateVmStatistics() { // check if time for vm statistics refresh - update cache and DB if (getVdsManager().isTimeToRefreshStatistics()) { dbVm.updateRunTimeStatisticsData(vdsmVm.getVmStatistics(), dbVm); saveStatistics(); saveVmInterfaces(); updateInterfaceStatistics(); updateVmNumaNodeRuntimeInfo(); for (DiskImageDynamic diskImageDynamic : vdsmVm.getVmDynamic().getDisks()) { vmsMonitoring.addDiskImageDynamicToSave(new Pair<>(dbVm.getId(), diskImageDynamic)); } } }

Target:
protected void updateVmStatistics() { // check if time for vm statistics refresh - update cache and DB if (vdsmVm.getVmStatistics() != null) { dbVm.updateRunTimeStatisticsData(vdsmVm.getVmStatistics(), dbVm); saveStatistics(); saveVmInterfaces(); updateInterfaceStatistics(); updateVmNumaNodeRuntimeInfo(); for (DiskImageDynamic diskImageDynamic : vdsmVm.getVmDynamic().getDisks()) { vmsMonitoring.addDiskImageDynamicToSave(new Pair<>(dbVm.getId(), diskImageDynamic)); } } }
Source:
private void send(String message){ //get client ReactorClient client = JsonRpcServer.getReactorClient(); //send message try { client.sendMessage(message.getBytes()); log.error("sending events message {}", message); }catch (ClientConnectionException e) { log.error("Failure in sending response", e); }finally { log.debug("send events"); } }

Target:
private void send(String message){ //get client ReactorClient client = JsonRpcServer.getReactorClient(); //send message try { client.sendMessage(message.getBytes()); log.debug("sending events message {}", message); }catch (ClientConnectionException e) { log.error("Failure in sending response", e); } }
Source:
public void addTask(TaskType t, long delay, Object o){ // support events, if enabled. try { //TODO: seems it better to use different thread. if (AppConfig.getInstance().isJsonEvents()){ JsonRpcNotification jsonRpcNotification = new JsonRpcNotification(); jsonRpcNotification.fireEvents(t, delay, o); }else{ //backward compatible. TaskProcessor.getInstance().addTask(new TaskRequest(t, delay, o)); } }catch (Exception e){ log.error("wrapping task error {}", e.toString()); } }

Target:
public static void addTask(TaskType t, long delay, Object o){ // support events, if enabled. try { //TODO: seems it better to use different thread. if (AppConfig.getInstance().isJsonEvents()){ JsonRpcNotification jsonRpcNotification = new JsonRpcNotification(); jsonRpcNotification.fireEvents(t, delay, o); }else{ //backward compatible. TaskProcessor.getInstance().addTask(new TaskRequest(t, delay, o)); } }catch (Exception e){ log.error("wrapping task error {}", e.toString()); } }
Source:
private void send(String message, String vmID, boolean removeClient) throws ClientConnectionException{ String hostName = null; try { //get client ReactorClient client = JsonRpcServer.getReactorsMap().get(vmID); hostName = client.getHostname(); //send message client.sendMessage(message.getBytes()); log.debug("sending events message {}", message); }catch (ClientConnectionException e) { log.error("Host {}, failed to send event message {}", hostName, e); } // remove client from the map in case the operation completed \ last event was sent. if (removeClient){ JsonRpcServer.removeReactorsMap(vmID); } }

Target:
private void send(String message, String vmID, boolean removeClient) throws ClientConnectionException{ ReactorClient client = null; try { //get client client = JsonRpcServer.getReactorsMap().get(vmID); //send message client.sendMessage(message.getBytes()); log.debug("sending events message {}", message); }catch (ClientConnectionException e) { log.error("Host {}, failed to send event message {}", client.getHostname(), e); } // remove client from the map in case the operation completed \ last event was sent. if (removeClient){ JsonRpcServer.removeReactorsMap(vmID); } }
Source:
public void sendNotification(String message, String id){ if (message == null){ log.warn("empty message has arrived, ignore empty messages"); return; } //generate message message = messageFormatter(message, id); //send send(message); }

Target:
public void sendNotification(String message, String id){ if (message == null){ log.warn("empty message has arrived, ignore empty messages"); return; } //send send(messageFormatter(message, id)); }
Source:
protected void onShowErrata() { logger.info(this.getClass().toString() + " onShowErrata"); //$NON-NLS-1$ if (getWindow() != null) { return; } HostErrataCountModel transferObj = new HostErrataCountModel(); transferObj.setTitle(messages.errataForHost(getName())); transferObj.setGuid(getGuid()); transferObj.setName(getName()); setWindow(transferObj); initCommands(transferObj); }

Target:
protected void onShowErrata() { if (getWindow() != null) { return; } HostErrataCountModel transferObj = new HostErrataCountModel(); transferObj.setTitle(messages.errataForHost(getName())); transferObj.setGuid(getGuid()); transferObj.setName(getName()); setWindow(transferObj); initCommands(transferObj); }
Source:
protected PlaceRequest getMainTabRequest() { logger.info(this.getClass().toString() + " getMainTabRequest"); //$NON-NLS-1$ return PlaceRequestFactory.get(WebAdminApplicationPlaces.errataMainTabPlace); }

Target:
protected PlaceRequest getMainTabRequest() { return PlaceRequestFactory.get(WebAdminApplicationPlaces.errataMainTabPlace); }
Source:
protected void fireTableSelectionChangeEvent() { logger.info(this.getClass().toString() + " fireTableSelectionChangeEvent"); //$NON-NLS-1$ ErrataSelectionChangeEvent.fire(this, getSelectedItems()); }

Target:
protected void fireTableSelectionChangeEvent() { ErrataSelectionChangeEvent.fire(this, getSelectedItems()); }
Source:
public void onErratumSelectionChange(ErrataSelectionChangeEvent event) { logger.info(this.getClass().toString() + " onErratumSelectionChange"); //$NON-NLS-1$ updateMainTabSelection(event.getSelectedItems()); }

Target:
public void onErratumSelectionChange(ErrataSelectionChangeEvent event) { updateMainTabSelection(event.getSelectedItems()); }
Source:
public SubTabHostGeneralHostErrataPresenter(EventBus eventBus, ViewDef view, ProxyDef proxy, PlaceManager placeManager, DetailTabModelProvider<HostListModel<Void>, HostErrataCountModel> errataCountModelProvider) { super(eventBus, view, proxy, placeManager, errataCountModelProvider, HostGeneralSubTabPanelPresenter.TYPE_SetTabContent); currentErrataModel = getModelProvider().getModel(); logger.info("SubTabHostGeneralHostErrataPresenter created: " + this.toString()); //$NON-NLS-1$ }

Target:
public SubTabHostGeneralHostErrataPresenter(EventBus eventBus, ViewDef view, ProxyDef proxy, PlaceManager placeManager, DetailTabModelProvider<HostListModel<Void>, HostErrataCountModel> errataCountModelProvider) { super(eventBus, view, proxy, placeManager, errataCountModelProvider, HostGeneralSubTabPanelPresenter.TYPE_SetTabContent); currentErrataModel = getModelProvider().getModel(); }
Source:
protected void onBind() { super.onBind(); logger.info(this.getClass().toString() + " onBind"); //$NON-NLS-1$ updateModel(currentErrataModel); getView().getTotalSecurity().setCommand(currentErrataModel.getShowSecurityCommand()); getView().getTotalBugFix().setCommand(currentErrataModel.getShowBugsCommand()); getView().getTotalEnhancement().setCommand(currentErrataModel.getShowEnhancementsCommand()); }

Target:
protected void onBind() { super.onBind(); updateModel(currentErrataModel); getView().getTotalSecurity().setCommand(currentErrataModel.getShowSecurityCommand()); getView().getTotalBugFix().setCommand(currentErrataModel.getShowBugsCommand()); getView().getTotalEnhancement().setCommand(currentErrataModel.getShowEnhancementsCommand()); }
Source:
private void buildErrataDetailPanel() { errataDetailPanel = new FlowPanel(); errataDetailFormPanel = new GeneralFormPanel(); errataTitle = new Span(); errataTitle.setStyleName(style.errataTitleLabel()); FlowPanel errataTitlePanel = new FlowPanel(); errataTitlePanel.setStyleName(style.errataTitlePanel()); errataTitlePanel.add(errataTitle); errataDetailPanel.add(errataTitlePanel); errataDetailPanel.setStyleName("testtest"); //$NON-NLS-1$ errataDetailPanel.add(errataDetailFormPanel); }

Target:
private void buildErrataDetailPanel() { errataDetailPanel = new FlowPanel(); errataDetailFormPanel = new GeneralFormPanel(); errataTitle = new Span(); errataTitle.setStyleName(style.errataTitleLabel()); FlowPanel errataTitlePanel = new FlowPanel(); errataTitlePanel.setStyleName(style.errataTitlePanel()); errataTitlePanel.add(errataTitle); errataDetailPanel.add(errataTitlePanel); errataDetailPanel.add(errataDetailFormPanel); }
Source:
public void setErrataDetailPanelVisibilty(boolean visible) { logger.info("updateErrataDetailPanelVisibilty"); //$NON-NLS-1$ splitLayoutPanel.clear(); if (visible) { splitLayoutPanel.addSouth(errataDetailPanel, SOUTH_SIZE); } splitLayoutPanel.add(errataTableView); }

Target:
public void setErrataDetailPanelVisibilty(boolean visible) { splitLayoutPanel.clear(); if (visible) { splitLayoutPanel.addSouth(errataDetailPanel, SOUTH_SIZE); } splitLayoutPanel.add(errataTableView); }
Source:
protected void initConnectionList(boolean includeInactiveDomains) { Set<StorageDomainStatus> statuses; statuses = includeInactiveDomains ? EnumSet.of(StorageDomainStatus.Active, StorageDomainStatus.Unknown, StorageDomainStatus.Inactive) : EnumSet.of(StorageDomainStatus.Active, StorageDomainStatus.Unknown); _connections = DbFacade.getInstance() .getStorageServerConnectionDao() .getStorageConnectionsByStorageTypeAndStatus(getStoragePool().getId(), null, statuses); updateConnectionsTypeMap(); updateConnectionMapForFiberChannel(); }

Target:
protected void initConnectionList(boolean includeInactiveDomains) { Set<StorageDomainStatus> statuses; statuses = includeInactiveDomains ? EnumSet.of(StorageDomainStatus.Active, StorageDomainStatus.Unknown, StorageDomainStatus.Inactive) : EnumSet.of(StorageDomainStatus.Active, StorageDomainStatus.Unknown); _connections = DbFacade.getInstance() .getStorageServerConnectionDao() .getStorageConnectionsByStorageTypeAndStatus(getStoragePool().getId(), null, statuses); updateConnectionsTypeMap(); updateConnectionMapForFiberChannel(statuses); }
Source:
private Map<String, Object> buildVmGraphicsSpecParamsFromVm(Map<GraphicsType, GraphicsInfo> infos) { Map<String, Object> specParamsFromVm = null; if (infos.containsKey(GraphicsType.SPICE)) { // harmless if added to VNC devices. Just noise. specParamsFromVm = new HashMap(); specParamsFromVm.put(VdsProperties.spiceFileTransferEnable, Boolean.toString(vm.isSpiceFileTransferEnabled())); specParamsFromVm.put(VdsProperties.spiceCopyPasteEnable, Boolean.toString(vm.isSpiceCopyPasteEnabled())); } return specParamsFromVm; }

Target:
private Map<String, Object> buildVmGraphicsSpecParamsFromVm(Map<GraphicsType, GraphicsInfo> infos) { Map<String, Object> specParamsFromVm = null; if (infos != null && infos.containsKey(GraphicsType.SPICE)) { // harmless if added to VNC devices. Just noise. specParamsFromVm = new HashMap(); specParamsFromVm.put(VdsProperties.spiceFileTransferEnable, Boolean.toString(vm.isSpiceFileTransferEnabled())); specParamsFromVm.put(VdsProperties.spiceCopyPasteEnable, Boolean.toString(vm.isSpiceCopyPasteEnabled())); } return specParamsFromVm; }
Source:
private String getPoolVmTooltip(VmType vmType) { switch (vmType) { case Server: return constants.pooledServer(); case Desktop: return constants.pooledDesktop(); default: return ""; //$NON-NLS-1$ } }

Target:
private String getPoolVmTooltip(VmType vmType) { switch (vmType) { case Server: return constants.pooledServer(); case Desktop: return constants.pooledDesktop(); default: return constants.pooledDesktop(); } }
Source:
private int getJsonFieldPotentialOverhead(String fieldName, Map<String, Object> descriptionMap) { return String.format("\"%s\":\"\"", fieldName).length() + (descriptionMap.size() >= 1 ? 1 : 0); // for the comma. }

Target:
private int getJsonFieldPotentialOverhead(String fieldName, Map<String, Object> descriptionMap) { return String.format("\"%s\":\"\"", fieldName).length() + (descriptionMap.isEmpty() ? 0 : 1); // for the comma. }
Source:
protected void executeCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntity(getVmPool()); setPoolBeingDestroyed(); setPrestartedToZero(); getCompensationContext().stateChanged(); return null; } }); setCommandShouldBeLogged(false); // disable logging at the end of command execution log(); // and log the message now stopVms(); if (allVmsDown) { getParameters().setTaskGroupSuccess(true); endSuccessfully(); } else { setSucceeded(true); } }

Target:
protected void executeCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntity(getVmPool()); setPoolBeingDestroyed(); setPrestartedToZero(); getCompensationContext().stateChanged(); return null; } }); setCommandShouldBeLogged(false); // disable logging at the end of command execution log(); // and log the message now stopVms(); if (allVmsDown) { endSuccessfully(); } else { setSucceeded(true); } }
Source:
protected void addStorageDomainStatusIllegalMessage() { addCanDoActionMessage(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2); StorageDomainStatus status = getStorageDomainStatus(); StorageDomainSharedStatus sharedStatus = getStorageDomainSharedStatus(); Object messageParameter; if (status == StorageDomainStatus.Unknown && sharedStatus != null) { // We got more informative information than "Unknown". messageParameter = sharedStatus; } else { messageParameter = status; } addCanDoActionMessageVariable("status", messageParameter); }

Target:
protected void addStorageDomainStatusIllegalMessage() { addCanDoActionMessage(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2); StorageDomainStatus status = getStorageDomainStatus(); StorageDomainSharedStatus sharedStatus = getStorageDomainSharedStatus(); Object messageParameter = status; if (status == StorageDomainStatus.Unknown && sharedStatus != null) { // We got more informative information than "Unknown". messageParameter = sharedStatus; } addCanDoActionMessageVariable("status", messageParameter); }
Source:
private void initAllModels(boolean fetchFromBackend) { if (fetchFromBackend) { // run query for networks, this chains the query for nics, and also stops progress when done startProgress(); queryLabels(); queryVfMap(); } else { initLabelModels(); initNetworkModels(); initNicModels(); } }

Target:
private void initAllModels(boolean fetchFromBackend) { if (fetchFromBackend) { // run query for networks, this chains the query for nics, and also stops progress when done startProgress(); queryLabels(); } else { initLabelModels(); initNetworkModels(); initNicModels(); } }
Source:
public CreateUserSessionParameters(String ssoToken, String profileName, String principalName, String principalId, String email, String sourceIp, List<Map> groupIds, boolean adminRequired) { setSsoToken(ssoToken); setProfileName(profileName); setPrincipalName(principalName); setPrincipalId(principalId); setEmail(email); // setSourceIp(sourceIp); setSourceIp("fe80::56ee:75ff:fe5c:6cc7"); setGroupIds(groupIds); setAdminRequired(adminRequired); }

Target:
public CreateUserSessionParameters(String ssoToken, String profileName, String principalName, String principalId, String email, String sourceIp, List<Map> groupIds, boolean adminRequired) { setSsoToken(ssoToken); setProfileName(profileName); setPrincipalName(principalName); setPrincipalId(principalId); setEmail(email); setSourceIp(sourceIp); setGroupIds(groupIds); setAdminRequired(adminRequired); }
Source:
public Response add(SchedulingPolicy schedulingPolicy) { // Allow the usage of "policy" for backward-compatibility if (!schedulingPolicy.isSetName()){ schedulingPolicy.setName(schedulingPolicy.getPolicy()); } validateParameters(schedulingPolicy, "name"); return performCreate(VdcActionType.AddClusterPolicy, new ClusterPolicyCRUDParameters(null, map(schedulingPolicy)), queryIdResolver); }

Target:
public Response add(SchedulingPolicy schedulingPolicy) { validateParameters(schedulingPolicy, "name"); return performCreate(VdcActionType.AddClusterPolicy, new ClusterPolicyCRUDParameters(null, map(schedulingPolicy)), queryIdResolver); }
Source:
private Guid getNewMacPoolId() { //TODO MM: this feels as duplicate to code in 'getPermissionCheckSubjects' but I'm not sure if // I can get null-valued storagePool elsewhere than in getPermissionSubjects. return getParameters().getStoragePool().getMacPoolId(); }

Target:
private Guid getNewMacPoolId() { return getParameters().getStoragePool() == null ? null : getParameters().getStoragePool().getMacPoolId(); }
Source:
protected void executeCommand() { // This will cache the snapshot names, avoiding '<UNKNOWN>' in the audit log upon command completion getSnapshotsNames(); if (isLiveMerge()) { getParameters().setLiveMerge(true); persistCommand(getParameters().getParentCommand(), true); } removeCinderSnapshotDisks(); setSucceeded(true); }

Target:
protected void executeCommand() { if (isLiveMerge()) { getParameters().setLiveMerge(true); persistCommand(getParameters().getParentCommand(), true); } removeCinderSnapshotDisks(); setSucceeded(true); }
Source:
private List<VM> getMigratableVmsRunningOnVds(final VmDao vmDao, final Guid hostId) { List<VM> vmsFromDB = vmDao.getAllRunningForVds(hostId); return vmsFromDB.stream() .filter( v -> v.getMigrationSupport() == MigrationSupport.MIGRATABLE // must not be pinned to the host && !v.getDedicatedVmForVdsList().contains(hostId) ).collect(Collectors.toList()); }

Target:
private List<VM> getMigratableVmsRunningOnVds(final VmDao vmDao, final Guid hostId) { List<VM> vmsFromDB = vmDao.getAllRunningForVds(hostId); return vmsFromDB.stream() .filter( vm -> vm.getMigrationSupport() == MigrationSupport.MIGRATABLE // must not be pinned to the host && !vm.getDedicatedVmForVdsList().contains(hostId) ).collect(Collectors.toList()); }
Source:
private void initialize() { log.info("Start initializing {}", getClass().getSimpleName()); Integer backupCheckPeriodInHours = Config.<Integer>getValue(ConfigValues.BackupCheckPeriodInHours); // disable feature if value is negative if (backupCheckPeriodInHours > 0) { schedulerUtil.scheduleAFixedDelayJob(this, "backupCheck", new Class[] {}, new Object[] {}, backupCheckPeriodInHours, backupCheckPeriodInHours, TimeUnit.HOURS); log.info("Finished initializing {}", getClass().getSimpleName()); } lock = new ReentrantLock(); }

Target:
private void initialize() { log.info("Start initializing {}", getClass().getSimpleName()); Integer backupCheckPeriodInHours = Config.<Integer>getValue(ConfigValues.BackupCheckPeriodInHours); // disable feature if value is negative if (backupCheckPeriodInHours > 0) { schedulerUtil.scheduleAFixedDelayJob(this, "backupCheck", new Class[] {}, new Object[] {}, backupCheckPeriodInHours, backupCheckPeriodInHours, TimeUnit.HOURS); log.info("Finished initializing {}", getClass().getSimpleName()); } }
Source:
public void setMessage(String message) { super.setMessage(message); // Hide table in case of message if (message != null && message.length() > 0) { table.setVisible(false); } if (message != null) { messageLabel.setText(message); } }

Target:
public void setMessage(String message) { super.setMessage(message); // Hide table in case of message if (message != null && message.length() > 0) { table.setVisible(false); messageLabel.setText(message); } }
Source:
boolean validate() { getTemplateName().validateEntity( new IValidation[] { new LengthValidation(BusinessEntitiesDefinitions.VM_TEMPLATE_NAME_SIZE), new I18NExtraNameOrNoneValidation() }); return getTemplateName().getIsValid(); }

Target:
public boolean validate() { getTemplateName().validateEntity( new IValidation[] { new LengthValidation(BusinessEntitiesDefinitions.VM_TEMPLATE_NAME_SIZE), new I18NExtraNameOrNoneValidation() }); return getTemplateName().getIsValid(); }
Source:
public void createMandatoryConstructorSignaturePredicate() { // Signature for a constructor that gets parameters and context objects. mandatoryConstructorSignature = createConstructorSignaturePredicate(VdcActionParametersBase.class, CommandContext.class); }

Target:
public static void createMandatoryConstructorSignaturePredicate() { // Signature for a constructor that gets parameters and context objects. mandatoryConstructorSignature = createConstructorSignaturePredicate(VdcActionParametersBase.class, CommandContext.class); }
Source:
public boolean check(VM vm) { if (vm.getStatus() == VMStatus.Suspended || vm.getStatus() == VMStatus.SavingState || vm.getStatus() == VMStatus.RestoringState) { Version vmCustomCompatibilityVersion = vm.getCustomCompatibilityVersion(); return vmCustomCompatibilityVersion == null ? false // checked by isApplicable() : vmCustomCompatibilityVersion.greaterOrEquals(newClusterVersion); } return true; }

Target:
public boolean check(VM vm) { if (vm.getStatus() == VMStatus.Suspended || vm.getStatus() == VMStatus.SavingState || vm.getStatus() == VMStatus.RestoringState) { return vm.getCustomCompatibilityVersion() == null; // checked by isApplicable() } return true; }
Source:
public boolean isVMWithMemoryCompatible(VM vm) { if (vm == null) { return true; } Version recentClusterVersion = vm.getClusterCompatibilityVersion(); // the cluster version in which the memory snapshot was taken Version originalClusterVersion = vm.getClusterCompatibilityVersionOrigin(); if (vm.getCustomCompatibilityVersion() != null) { return true; } return originalClusterVersion != null && recentClusterVersion.getMajor() == originalClusterVersion.getMajor() && recentClusterVersion.getMinor() == originalClusterVersion.getMinor(); }

Target:
public boolean isVMWithMemoryCompatible(VM vm) { if (vm == null || vm.getCustomCompatibilityVersion() != null) { return true; } Version recentClusterVersion = vm.getClusterCompatibilityVersion(); // the cluster version in which the memory snapshot was taken Version originalClusterVersion = vm.getClusterCompatibilityVersionOrigin(); return originalClusterVersion != null && recentClusterVersion.getMajor() == originalClusterVersion.getMajor() && recentClusterVersion.getMinor() == originalClusterVersion.getMinor(); }
Source:
private Network findCurrentNetwork(Map<Network, Set<Guid>> networks) { if (networks != null) { for (Map.Entry<Network, Set<Guid>> entry : networks.entrySet()) { Network current = entry.getKey(); ProviderNetwork providedBy = current.getProvidedBy(); if (Objects.equals(providedBy.getExternalId(), id)) { return current; } } } notFound(); // Will never be reached, as notFound throws a WebApplicationException return null; }

Target:
private Network findCurrentNetwork(Map<Network, Set<Guid>> networks) { if (networks != null) { for (Map.Entry<Network, Set<Guid>> entry : networks.entrySet()) { Network current = entry.getKey(); ProviderNetwork providedBy = current.getProvidedBy(); if (Objects.equals(providedBy.getExternalId(), id)) { return current; } } } // This will never return but always throw a WebApplicationException return notFound(); }
Source:
private void removeUserRemovedNetworkAttachments(List<NetworkAttachment> existingNetworkAttachments) { for (Guid attachmentId : userRemovedNetworkAttachments) { networkAttachmentDao.remove(attachmentId); } // Remove the attachment from the existing attachments list for (Iterator<NetworkAttachment> iterator = existingNetworkAttachments.iterator(); iterator.hasNext();) { Guid networkAttachmentId = iterator.next().getId(); if (networkAttachmentId != null && userRemovedNetworkAttachments.contains(networkAttachmentId)) { iterator.remove(); break; } } }

Target:
private void removeUserRemovedNetworkAttachments(List<NetworkAttachment> existingNetworkAttachments) { for (Guid attachmentId : userRemovedNetworkAttachments) { networkAttachmentDao.remove(attachmentId); } // Remove the attachment from the existing attachments list for (Iterator<NetworkAttachment> iterator = existingNetworkAttachments.iterator(); iterator.hasNext();) { Guid networkAttachmentId = iterator.next().getId(); if (userRemovedNetworkAttachments.contains(networkAttachmentId)) { iterator.remove(); } } }
Source:
public void testEnumReadMany() { V4Vm object = objectFromXml( "<vm>" + "<display_types>" + "<display_type>spice</display_type>" + "<display_type>VNC</display_type>" + "</display_types>" + "</vm>" ); List<V4VmDisplayType> expected = Arrays.asList(new V4VmDisplayType[]{V4VmDisplayType.SPICE, V4VmDisplayType.VNC}); assertThat(object.displayTypes(), is(expected)); }

Target:
public void testEnumReadMany() { V4Vm object = objectFromXml( "<vm>" + "<display_types>" + "<display_type>spice</display_type>" + "<display_type>VNC</display_type>" + "</display_types>" + "</vm>" ); List<V4VmDisplayType> expected = Arrays.asList(V4VmDisplayType.SPICE, V4VmDisplayType.VNC); assertEquals(object.displayTypes(), expected); }
Source:
public void setSpicePluginImplEnabled(boolean enabled, String reason) { spicePluginImplRadioButton.setVisible(enabled);// Unsupported since 4.0 spicePluginImplRadioButton.setEnabled(enabled); if (!enabled) { spicePluginImplRadioButtonTooltip.setText(reason); } }

Target:
public void setSpicePluginImplEnabled(boolean enabled, String reason) { spicePluginImplRadioButton.setEnabled(enabled); if (!enabled) { spicePluginImplRadioButtonTooltip.setText(reason); } }
Source:
protected Map<Guid, Integer> getGlusterVolumeHealInfo(VDS upServer, String volumeName) { VDSReturnValue result = runVdsCommand(VDSCommandType.GetGlusterVolumeHealInfo, new GlusterVolumeVDSParameters(upServer.getId(), volumeName)); if(result.getSucceeded()){ return (Map<Guid, Integer>) result.getReturnValue(); }else{ return Collections.emptyMap(); } }

Target:
private Map<Guid, Integer> getGlusterVolumeHealInfo(VDS upServer, String volumeName) { VDSReturnValue result = runVdsCommand(VDSCommandType.GetGlusterVolumeHealInfo, new GlusterVolumeVDSParameters(upServer.getId(), volumeName)); if(result.getSucceeded()){ return (Map<Guid, Integer>) result.getReturnValue(); }else{ return Collections.emptyMap(); } }
Source:
private Network findCurrentNetwork(Map<Network, Set<Guid>> networks) { Network result = networks == null ? null : networks.keySet() .stream() .filter(network -> Objects.equals(network.getProvidedBy().getExternalId(), id)) .findFirst() .orElse(null); if (result == null) { // This will never return but always throw a WebApplicationException notFound(); } return result; }

Target:
private Network findCurrentNetwork(Map<Network, Set<Guid>> networks) { final Network result; if (networks == null) { result = null; } else { result = networks.keySet() .stream() .filter(network -> Objects.equals(network.getProvidedBy().getExternalId(), id)) .findFirst() .orElse(null); } if (result == null) { // This will never return but always throw a WebApplicationException notFound(); } return result; }
Source:
public void refreshNetworks(ArrayList<VdcActionParametersBase> parameters) { if (!parameters.isEmpty()) { HostSetupNetworksParametersBuilder.updateParametersSequencing(parameters); runInternalMultipleActions(VdcActionType.PersistentHostSetupNetworks, parameters); } }

Target:
protected void refreshNetworks(ArrayList<VdcActionParametersBase> parameters) { if (!parameters.isEmpty()) { HostSetupNetworksParametersBuilder.updateParametersSequencing(parameters); runInternalMultipleActions(VdcActionType.PersistentHostSetupNetworks, parameters); } }
Source:
public NetworkAttachment createNetworkAttachment(Network network, HostNetworkQos hostNetworkQos) { NetworkAttachment networkAttachment = new NetworkAttachment(); networkAttachment.setId(Guid.newGuid()); networkAttachment.setHostNetworkQos(hostNetworkQos); networkAttachment.setNetworkId(network.getId()); return networkAttachment; }

Target:
private NetworkAttachment createNetworkAttachment(Network network, HostNetworkQos hostNetworkQos) { NetworkAttachment networkAttachment = new NetworkAttachment(); networkAttachment.setId(Guid.newGuid()); networkAttachment.setHostNetworkQos(hostNetworkQos); networkAttachment.setNetworkId(network.getId()); return networkAttachment; }
Source:
private boolean isClusterLevelChange() { Version newVersion = getParameters().getClusterLevelChangeToVersion(); return newVersion != null && getVm().isRunningOrPaused() && (getVm().getCustomCompatibilityVersion() == null || !newVersion.equals(getVm().getCompatibilityVersion())); }

Target:
private boolean isClusterLevelChange() { Version newVersion = getParameters().getClusterLevelChangeToVersion(); /* boolean isCustomCombatibilityNotUsed = getVm().getCustomCompatibilityVersion() == null; boolean areClusterAndVmVersionsDifferent*/ return newVersion != null && getVm().isRunningOrPaused() && (getVm().getCustomCompatibilityVersion() == null || !newVersion.equals(getVm().getCustomCompatibilityVersion())); }
Source:
private String getMethodName(String httpMethod) { if (httpMethod.equals("POST")) { return "add"; } if (httpMethod.equals("PUT")) { return "update"; } if (httpMethod.equals("GET")) { return "get"; } if (httpMethod.equals("DELETE")) { return "remove"; } return ""; //shouldn't reach here. }

Target:
private String getMethodName(String httpMethod) { switch (httpMethod) { case "POST": return "add"; case "PUT": return "update"; case "GET": return "get"; case "DELETE": return "remove"; default: return ""; //shouldn't reach here. } }