auphong2707/dl4se-code-review-dataset huggingface dataset:
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:
seems like the address assertion isn't related, we are testing here the scsi reservation property.
Source:
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + (Boolean.TRUE.equals(usingScsiReservation) ? 1231 : 1237); result = prime * result + ((lun == null) ? 0 : lun.hashCode()); return result; }

Target:
I'd prefer an implementation similar to line 55 here.
Source:
public ParametersParser(InputStream resource, String prefix) { this.properties = loadProperties(resource); this.prefix = prefix; parseProperties(); }

Target:
please call the other constructor.
Source:
public static Properties loadProperties(Class<?> clazz, String resource) throws IOException{ try(Reader is = new InputStreamReader(clazz.getResourceAsStream(resource), "UTF-8")) { Properties prop = new Properties(); prop.load(is); return prop; } catch (IOException e) { throw new IOException( String.format("An error occurred while reading properties file: '%1$s'", resource) ); } }

Target:
the io exception you get should be good enough, no? anyway, please always include the cause exception when rethrowing
Source:
public boolean parseArguments(List<String> argsList) throws Exception { ParametersParser parser = new ParametersParser( CoreUtil.loadProperties(getClass(), "arguments.properties"), CoreUtil.loadProperties(getClass(), "defaults.properties") ); args = parser.parse(argsList); return args.containsKey("help"); }

Target:
Done
Source:
public void testEvalPositive() { Mockito.when(mockNetwork.isExternal()).thenReturn(true); Assert.assertTrue(underTest.eval(mockNetwork)); }

Target:
Please add static import
Source:
@Override protected void prepareConnectionForEditing(StorageServerConnections connection)

Target:
just convention - move the annotation to a separate line
Source:
public void prepareForEdit(StorageDomain storage) { getOverride().setIsChangable(isEditable(storage)); super.prepareForEdit(storage); }

Target:
can super be called first?
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:
vdsList cannot be null by the contract of the dao for fetching collections. Please replace with if (!vdsList.isEmpty())
Source:
public static void updateVmLock(final VM vm) { vm.setLockInfo(getLockManager().getLockInfo(String.format("%s%s", vm.getId(), LockingGroup.VM))); }

Target:
you can use here LockingGroup.VM.name() and not worry of some unexpected LockingGroup.toString() future implementation
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:
I feel this might look something like an alias name so why not pass both cluster and volume names to messages and then get a string like " Volume data from {0} of cluster {1} is replicated to this volume " Just a thought
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:
the editor is bounded to diskErrorPolicy entity, so it's visibility should be altered through the model. See 'AbstractDiskModel -> diskStorageType_EntityChanged()'.
Source:
public ArrayList<DiskErrorPolicy> getDiskErrorPolicyList() { ArrayList<DiskErrorPolicy> diskErrorPolicy = new ArrayList<>( Arrays.asList(new DiskErrorPolicy[] { DiskErrorPolicy.REPORT, DiskErrorPolicy.ENOSPC, DiskErrorPolicy.STOP, DiskErrorPolicy.IGNORE })); return diskErrorPolicy; }

Target:
I think: return Arrays.asList({DiskErrorPolicy.REPORT, DiskErrorPolicy.ENOSPC, DiskErrorPolicy.STOP, DiskErrorPolicy.IGNORE}); Is more concise and doesn't create as many array lists.
Source:
public DropdownActionButton(List<ActionButtonDefinition<T>> actions, List selectedItems) { super(); initDropdownButton(); initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); initMenuPopup(actions, selectedItems); addMouseHandlers(); }

Target:
implicit
Source:
public MainTabBasicListItemActionButton(String tooltipText, ImageResource enabledImage, ImageResource disabledImage, String additionalStyle) { super(); initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); setTooltipText(tooltipText); setEnabledHtml(SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(enabledImage).getHTML())); setDisabledHtml(SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(disabledImage).getHTML())); stylableButtonHolder.addStyleName(additionalStyle); }

Target:
implicit
Source:
public Host getActiveHostByName(String serverName) { final Host host = VdsmManager.getInstance().getHostByName(serverName); return host; }

Target:
What about return VdsmManager.getInstance().getHostByName(serverName); host is not needed.
Source:
public synchronized static Map<String, String> getTasksMap() { return tasksmap; }

Target:
why synchronized?
Source:
public synchronized static void setTasksMap(String hostName, String taskId) { tasksmap.put(hostName, taskId); }

Target:
can't you use concurrent hash map instead of the synchronized?
Source:
public static <E extends VmDevice> Map<String, E> vmDevicesByDevice(Collection<E> deviceList) { if (deviceList != null) { Map<String, E> map = new HashMap<String, E>(); for (E device : deviceList) { if (device.getDevice() != null) { map.put(device.getDevice(), device); } } return map; } else { return Collections.emptyMap(); } }

Target:
Isn't it possible to use empty diamond? Map<String, E> map = new HashMap<>();
Source:
public static boolean isSessionValid(HttpServletRequest req) throws NamingException { String sessionId = (String) req.getSession(true).getAttribute(SessionConstants.SSO_TOKEN_KEY); boolean isValid = false; if (StringUtils.isNotEmpty(sessionId)) { try { SSOQueryServiceUtils.getFromSsoQueryService(req, String.format("command=sso-token-validate&sso_token=%s", sessionId)); isValid = true; } catch (Exception e) { log.error("Session not valid session id = " + sessionId, e.getMessage()); } } return isValid; }

Target:
won't it better to have it as args... ? SSOQueryServiceUtils.getFromSsoQueryService("command=sso-token-validate", String.format("sso_token=%s", sessionId); or even as: SSOQueryServiceUtils.getFromSsoQueryService(req, "command=sso-token-validate&sso_token=%s", sessionId);
Source:
private boolean requiresTagsForField(String obj, String fieldName, boolean useTagsInFrom) { if (!useTagsInFrom) { return false; } Boolean result = requiresFullTable.containsKey(obj + "-" + fieldName); if (result != null && result) { return true; } return false; }

Target:
IMO more readable as : private boolean requiresTagsForField(String obj, String fieldName, boolean useTagsInFrom) { if (useTagsInFrom) { return requiresFullTable.containsKey(obj + "-" + fieldName); } return false; }
Source:
public <T extends DAO> T getDao(Class<T> daoType) { for (DAO dao : daos) { if (daoType.isAssignableFrom(dao.getClass())) { initBaseDAO((BaseDAODbFacade) dao); return (T) dao; } } log.error("Can't find dao for " + daoType); return null; }

Target:
1. Why the method has to be public? It isn't being used out of the class. 2. Is that guaranteed that at time of this method called the context has all daos in it. If not we should find some CDI equivalent for Spring @DependsOn and use that in order to let CDI know that this bean is dependent on all DAOs.
Source:
private boolean isMasterDomain(StorageDomain domain) { return domain.getStorageDomainType() == StorageDomainType.Master && domain.getStatus() != null && domain.getStatus() == StorageDomainStatus.Active; }

Target:
if the status is Active, by definition it cannot be null - please remove this redundant check.
Source:
public CellWithElementId<C> getCell() { return (CellWithElementId<C>) getCell(); }

Target:
Shouldn't we return "super.getCell()" here?
Source:
public FenceOperationResult getFenceAgentStatus(FenceAgent fenceAgent) { if (fenceAgent == null) { return new FenceOperationResult( Status.ERROR, PowerStatus.UNKNOWN, "Invalid fence agent specified."); } List<FenceAgent> fenceAgents = new ArrayList<>(); fenceAgents.add(fenceAgent); return fence(FenceActionType.STATUS, fenceAgents); }

Target:
why not instead of 3 lines just one? return fence(FenceActionType.STATUS, Arrays.asList(fenceAgent) ) ?
Source:
public void onFailed(Guid cmdId, List<Guid> childCmdIds) { super.onFailed(cmdId, childCmdIds); getCommand().unlockImageInDb(); log.error("Failed extending disk. ID: {}", getDiskId()); updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getCommand().getNewDiskSizeInGB()); getCommand().endAction(); CommandCoordinatorUtil.removeAllCommandsInHierarchy(cmdId); }

Target:
Why calling this unlock, it should already been done in getCommand().endAction();
Source:
protected VDSReturnValue getStatsForDomain() { VDS spmVds = LinqUtils.first(getAllRunningVdssInPool()); return runVdsCommand(VDSCommandType.GetStorageDomainStats, new GetStorageDomainStatsVDSCommandParameters(spmVds.getId(), getParameters().getStorageDomainId())); }

Target:
please rename - this host isn't neccessarily the spm.
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:
You don't care about the order, and you're doing several remove operations - better use a HashSet
Source:
protected VDSReturnValue getStatsForDomain() { VDS spmVds = LinqUtils.first(LinqUtils.filter(getAllRunningVdssInPool(), new Predicate<VDS>() { @Override public boolean eval(VDS vds) { return vds.getSpmStatus() == VdsSpmStatus.SPM; } })); return runVdsCommand(VDSCommandType.GetStorageDomainStats, new GetStorageDomainStatsVDSCommandParameters(spmVds.getId(), getParameters().getStorageDomainId())); }

Target:
In 3.6.0 we will not have an SPM. In this case, just take the first host.
Source:
private Long resizePV(String lunId) { try { return (Long) runVdsCommand( VDSCommandType.ResizeStorageDomainPV, new ResizeStorageDomainPVVDSCommandParameters(getStoragePoolId(), getStorageDomainId(), lunId)).getReturnValue(); } catch (VdcBLLException e) { log.error("Failed to resize PV " + lunId, e); throw e; } }

Target:
the log doesn't add info to the log, that's unneeded, it's clear from the log that ResizeStorageDomainPV failed
Source:
protected void updateVmDeviceAddress(final String address, final VmDevice vmDevice) { vmDevice.setAddress(address); getCompensationContext().snapshotEntity(vmDevice); vmDeviceDao.update(vmDevice); getCompensationContext().stateChanged(); }

Target:
thanks, please replace the order,- stateChanged() should be before the vmDevice update call. otherwise if there's a failure between the calls the changes won't be reverted.
Source:
protected ToStringBuilder appendAttributes(ToStringBuilder tsb) { return super.appendAttributes(tsb) .append("diskId", disk.getId()) .append("addressMap", addressMap.toString()); }

Target:
you should use TostringBuilder.append(final String name, final Map<K, V> value) please replace with .append("addressMap", addressMap);
Source:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__USER_PROFILE); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_PROFILE_ALREADY_EXISTS); }

Target:
this method should only contain the parameters for the generic messages, means var-action-x and var-type-y and it is called automatically inside commandBase, so no need to call it again the specific failure messages should be added inside the canDoAction so in the canDoAction you should only have: if (somethingIsWrong) { result = failCanDoAction(msg); } (just a note - usually we use 'quick-return' in canDoActions, means once you found an issue, return. so it makes the method more readable (no need ti check the value of 'result' or complicated if-else, but here its not a must since its a short one)
Source:
public void testDeleteBackupRelatedAlerts() { AuditLog entry = dao.getByOriginAndCustomEventId(ORIGIN, CUSTOM_BAKUP_EVENT_ID); assertFalse(entry.isDeleted()); dao.deleteBackupRelatedAlerts(); entry = dao.getByOriginAndCustomEventId(ORIGIN, CUSTOM_BAKUP_EVENT_ID); assertTrue(entry.isDeleted()); }

Target:
i'd add first assertNotNull(entry); which is a proper assumption prior to validating the entry data.
Source:
@Override public void clearAllEvents() { getCallsHandler().executeModification("ClearAllAuditLogs", getCustomMapSqlParameterSource()); }

Target:
I am pretty sure the convention is to have the @Override above the method declaration for all of these.
Source:
public ExceptionAwareTransactionMethod(InvocationContext context) { super(); this.context = context; }

Target:
not needed
Source:
protected BackendQuotaLimitsResource(Guid quotaId, Class<N> baseResourcesClass) { super(baseResourcesClass, Quota.class, SUB_COLLECTIONS); this.quotaId = quotaId; }

Target:
The constructor will work without SUB_COLLECTIONS
Source:
protected Response performRemove(String id) { QuotaCRUDParameters prms = new QuotaCRUDParameters(); prms.setQuotaId(GuidUtils.asGuid(id)); return performAction(VdcActionType.RemoveQuota, prms); }

Target:
No need for GuidUtils, there's a asGuid(String guid) method in ancestor class.
Source:
public void setDisableCliSchedule(EntityModel<Boolean> value) { this.disableCliSchedule = value; this.disableCliSchedule.setIsAvailable(value.getEntity()); }

Target:
when would this be of use except for in init which is always false. I mean in line 442 of GlusterVolumeSnapshotListModel you are doing snapshotModel#getDisableCliSchedule#setEntity but that doesn't come here right?
Source:
public Map<String, String> getCustomValues() { addCustomValue("ClusterName", getVdsGroupName()); return super.getCustomValues(); }

Target:
why not just use vdsGroupName in the message, then the custom value is not required
Source:
public void cancel()

Target:
This doesn't need to be public, it can be protected
Source:
@Override public EngineBackupLogId getId() { EngineBackupLogId key = new EngineBackupLogId(); key.setDbName(dbName); key.setDoneAt(doneAt); return key; }

Target:
Could please put @Override on a separate line?
Source:
@Override public void setId(EngineBackupLogId id) { dbName = id.getDbName(); doneAt = id.getDoneAt(); }

Target:
Could please put @Override on a separate line?
Source:
public EngineBackupLog getLastSuccessfulEngineBackup(String dbName) { List<EngineBackupLog> logs = multipleResults(entityManager.createNamedQuery("EngineBackupLog.getLatest", EngineBackupLog.class).setParameter("dbName", dbName)); if (logs != null && logs.size() > 0) { return logs.get(0); } else { return null; } }

Target:
there is an assumption that logs cannot be null, so you can replace the entire if with: if (logs.isEmpty()) { return null; } else { return logs.get(0); }
Source:
protected void getDowntime() { if (getVm() != null && getVm().getStatus() == VMStatus.Up) { try { VDSReturnValue retVal = runVdsCommand(VDSCommandType.MigrateStatus, new MigrateStatusVDSCommandParameters(getDestinationVdsId(), getVmId())); if (retVal != null) { actualDowntime = (Integer) retVal.getReturnValue(); } } catch (VdcBLLException e) { migrationErrorCode = e.getErrorCode(); } } }

Target:
1. I don't think it is needed to check the VM is not null - it is locked, no one can remove it 2. why is it important that the status is up? what if it is powering-up?
Source:
protected void executeImport(ImportVmFromExportDomainModel importVmModel) { importVmModel.importVms( new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { VmListModel.this.setWindow(null); } }, cloneObjectMap); }

Target:
you can probably just call `setWindow(null)` whithout the explicit reference to outer this.
Source:
VM createDbVm() { VM vm = new VM(); vm.setDynamicData(new VmDynamic()); vm.setId(id); vm.setName(name()); vm.setRunOnVds(SRC_HOST_ID); vm.setElapsedTime(-1.0d); return vm; }

Target:
I don't see any change that is related to elapsed-time, why is this change needed?
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:
not needed (the value is null and won't be used anyway)
Source:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CREATE); addCustomValue(GlusterConstants.VOLUME_SNAPSHOT_NAME, getParameters().getSnapshot().getSnapshotName()); addCustomValue("ClusterName", getVdsGroupName()); }

Target:
use vdsGroupName parameter, the custom variable not required
Source:
public void testThatFilterDoesntRemoveStorageDomainFromList() { List<StorageDomain> filteredDomains = filterStorageDomain(false); assertEquals(filteredDomains, Arrays.asList(storageDomain)); }

Target:
This assumes both collections are the same type. To be on the safe side, you should surround both with your own collection (e.g., new ArrayList<>)
Source:
private List<VmTemplate> filterOutBlank(List<VmTemplate> templates) { final ArrayList<VmTemplate> result = new ArrayList<>(); for (VmTemplate template : templates) { if (!template.isBlank()) { result.add(template); } } return result; }

Target:
List<VmTemplate>...
Source:
private SchedulingManager mockScheduler() { SchedulingManager mock = Mockito.mock(SchedulingManager.class); Mockito.when(mock.getClusterPolicies()).thenReturn(Collections.<ClusterPolicy>emptyList()); return mock; }

Target:
please use static import for Mockito
Source:
public VDS getValue(S object) { if (object instanceof VDS){ return (VDS) object; } if (object instanceof PairQueryable){ if (((PairQueryable<?, ?>) object).getSecond() instanceof VDS) { return (VDS) ((PairQueryable<?, ?>) object).getSecond(); } } return null; }

Target:
Why do you need this? Are you planning to add the column to SubTabNetworkHostView?
Source:
public EventQueue getEventQueue() { return eventQueue; }

Target:
you can change that to be protected
Source:
public static SubjectEntity[] getStorageEntities(List<CinderDisk> cinderDisks) { Set<SubjectEntity> storageSubjects = new HashSet<>(); for (final CinderDisk cinderDisk : cinderDisks) { SubjectEntity se = new SubjectEntity(VdcObjectType.Storage, cinderDisk.getStorageIds().get(0)); storageSubjects.add(se); } return storageSubjects.toArray(new SubjectEntity[storageSubjects.size()]); }

Target:
no need for final...
Source:
public Integer getWarningLowSpaceSize() { return getWarningLowSpaceIndicator() == null ? 0 : getTotalDiskSize() * getWarningLowSpaceIndicator() / 100; }

Target:
Given the problems we've had with other properties of StorageDomain with converstion of Integer to int and the NPEs resulting I think it's best that the return type will be int as we never return null either way, please fix and I'll merge
Source:
private void showCheckBoxes(List<T> seletedItems) { for (Entry<T, CheckBox> currentEntry : checkBoxes.entrySet()) { wrapperPanel.add(currentEntry.getValue()); if (seletedItems.contains(currentEntry.getKey())) { currentEntry.getValue().setValue(true, false); } } }

Target:
you could simply do currentEntry.getValue().setValue(true)
Source:
private ExternalStatus(int value) { intValue = value; }

Target:
s/value/id
Source:
public int getValue() { return intValue; }

Target:
s/getValue/getId
Source:
public void testUpdateExternalStatus() { VdsDynamic before = dao.get(existingVds.getId()); before.setExternalStatus(ExternalStatus.Error); dao.updateExternalStatus(before.getId(), before.getExternalStatus()); VdsDynamic after = dao.get(existingVds.getId()); assertEquals(before, after); }

Target:
please compare the externalStatus fields explicitly.
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:
this part: new Guid(getParameters().getEvent().getVdsId().toString()) should be replaced with: getParameters().getEvent().getVdsId()
Source:
protected Object getEntityObject(S object) { return null; }

Target:
the return type should be S, then you can avoid casting when this method is called.
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:
no need for this variable, we can just return the returned value from the call to getCachedIsoListByDomainId
Source:
protected void endWithFailure() { setSucceeded(true); }

Target:
* shuoldn't we call super? * worth adding some log..
Source:
public void updateVmDataChangedTime() { vmDataChangedTime = System.nanoTime(); }

Target:
I would mark it as final. It is not safe to use non-final methods in ctor. Someone could override it and do something foolish.
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:
since we are going to compute this time-stamp a lot, perhaps we should use the more efficient way of System.currentTimeMillis(). See: http://stackoverflow.com/questions/368094/system-currenttimemillis-vs-new-date-vs-calendar-getinstance-gettime
Source:
protected void executeCommand() { Guid secretUuid = getParameters().getLibvirtSecret().getId(); addCustomValue("LibvirtSecretUUID", secretUuid.toString()); getReturnValue().setActionReturnValue(secretUuid); }

Target:
add method : public String getLibvirtSeverUUID() for audit log purposes
Source:
private void printGroupRecord(ExtMap extMap) { if (extMap != null) { do { logger.info( "GroupRecord: ID '{}', name: '{}', namespace: '{}', display name: '{}'", extMap.get(Authz.GroupRecord.ID, ""), extMap.get(Authz.GroupRecord.NAME, ""), extMap.get(Authz.GroupRecord.NAMESPACE, ""), extMap.get(Authz.GroupRecord.DISPLAY_NAME, "") ); } while((extMap = extMap.get(Authz.GroupRecord.GROUPS)) != null); } }

Target:
this should be recursive.
Source:
public VmReplicateDiskParameters(Guid vdsId, Guid vmId, Guid storagePoolId, Guid srcStorageDomainId, Guid targetStorageDomainId, Guid imageGroupId, Guid imageId, String diskType) { super(vdsId, vmId); this.storagePoolId = storagePoolId; this.srcStorageDomainId = srcStorageDomainId; this.targetStorageDomainId = targetStorageDomainId; this.imageGroupId = imageGroupId; this.imageId = imageId; this.diskType = Optional.ofNullable(diskType); }

Target:
It seems cleaner to me to just store the string here and keep this a simple-stupid POJO, and have the optional "logic" where it's used.
Source:
public Map<String, Object> prepareGlusterDisk(VM vm, DiskImage diskImage, Map<String, Object> struct) { this.getNetworkDiskType(vm, diskImage).ifPresent((diskType) -> struct.put(VdsProperties.DiskType, diskType)); return struct; }

Target:
As per the project's conventions, I'd drop the "this" here.
Source:
private void initVisibilities() { errorMsg.setVisible(false); actionConfirmationMessage.setVisible(false); geoRepForceHelpIcon.setVisible(false); }

Target:
Why this needs to be hidden?
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:
This null check should be done in line 274
Source:
protected BackendOpenStackVolumeAuthenticationKeyResource(String providerId, String id) { super(id, OpenstackVolumeAuthenticationKey.class, LibvirtSecret.class); this.providerId = providerId; this.guid = asGuidOr404(id); }

Target:
I think that this assignment to "guid" already happens in the base class? Doesn't it?
Source:
private void updateActionAvailability() { ArrayList<LibvirtSecretModel> secrets = getSelectedItems() != null ? Linq.<LibvirtSecretModel> cast(getSelectedItems()) : new ArrayList<LibvirtSecretModel>(); getEditCommand().setIsExecutionAllowed(secrets.size() > 0); getRemoveCommand().setIsExecutionAllowed(secrets.size() > 0); }

Target:
Should it be equals to 1? Or editing of multiple secrets is allowed?
Source:
public void testGetGlusterGeoRepSessionUnSetConfig() { GlusterGeoRepSessionConfiguration sessionConfig = getGlusterGeoRepSessionConfig(); dao.saveConfig(sessionConfig); List<GlusterGeoRepSessionConfiguration> unsetSessionConfig = dao.getGlusterGeoRepSessionUnSetConfig(FixturesTool.GLUSTER_GEOREP_SESSION_ID); assertEquals(1, unsetSessionConfig.size()); assertEquals("use_meta_volume", unsetSessionConfig.get(0).getKey()); }

Target:
would this be 1, or would need to be changed whenever a new master config is added?
Source:
protected StorageDomain getEntityObject(StorageDomain object) { if (object instanceof StorageDomain){ return object; } else { return null; } }

Target:
won't it always return true if not null? if so, why not just return "object"? See similar findbugs issue for the host patch.
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:
this is followup of above, it should not be required.
Source:
public ConnectHostToStoragePoolServerCommandBase() { super(); }

Target:
super() can be spared here.
Source:
public ValidationResult provisioningComputeResourceValid(boolean provisioned, ExternalComputeResource computeResource) { return ValidationResult.failWith(VdcBllMessages.VDS_PROVIDER_PROVISION_MISSING_COMPUTERESOURCE) .when(provisioned == true && computeResource == null); }

Target:
no need to compare against 'true'. just: .when(provisioned && computeResource == null);
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:
shouldnt this use the vmRefresher.timeToRefresh() ?
Source:
private boolean isLibrbdAvailable() { if (!CINDERStorageHelper.isLibrbdAvailable(getVds())) { log.error("Couldn't found librbd1 package on vds (needed for Cinder storage domains).", getVds().getName()); setNonOperational(NonOperationalReason.LIBRBD_PACKAGE_NOT_AVAILABLE, getVds()); return false; } return true; }

Target:
You need to migrate all the VMs when Host becomes non operational. What about Gluster? probably worth to call here: runInternalAction(VdcActionType.SetNonOperationalVds)
Source:
private void removeVmStatelessImages() { if (getSnapshotDao().exists(getVmId(), SnapshotType.STATELESS) && !VmPoolType.Manual.equals(getVmPoolType())) { log.info("Deleting snapshot for stateless vm '{}'", getVmId()); runInternalAction(VdcActionType.RestoreStatelessVm, new VmOperationParameterBase(getVmId()), ExecutionHandler.createDefaultContextForTasks(getContext(), getLock())); } }

Target:
same, it is more standard to compare enums using == or != than with 'equals' - although it behaves the same
Source:
int determineRealLabelWidth(FormItem item, Integer labelWidth) { List<Integer> sizesList = formSizeMap.get(item); int valueWidth; if (labelWidth != null) { sizesList.set(1, labelWidth); valueWidth = labelWidth; } else { valueWidth = sizesList.get(1); } return valueWidth; }

Target:
Alternatively, this could be a bit shorter: if (labelWidth != null) { sizesList.set(1, labelWidth); } valueWidth = sizesList.get(1);
Source:
private static ImageResource getPoolVmImageResource(VmType vmType, boolean nextRunConfigurationExists) { switch (vmType) { case Desktop: return nextRunConfigurationExists ? resources.manyDesktopsChangesImage() : resources.manyDesktopsImage(); case Server: return nextRunConfigurationExists ? resources.manyServersChangesImage() : resources.manyServersImage(); default: log.severe("Invalid VmType."); return null; } }

Target:
Please add NON-NLS :-)
Source:
private List<VdsNetworkInterface> applyUserConfiguredNics() { List<VdsNetworkInterface> nicsToConfigure = getNicsToConfigureWithoutLabelsUpdates(); updateLabelsOnNicsToConfigure(nicsToConfigure); return new ArrayList<>(nicsToConfigure); }

Target:
is this still needed?
Source:
private ValidationResult validateCoherentNetworkIdentification(NetworkAttachment attachment) { Guid networkId = attachment.getNetworkId(); String networkName = attachment.getNetworkName(); Guid violatingEntityId = attachment.getId(); return validateCoherentIdentification(violatingEntityId == null ? null : violatingEntityId.toString(), networkId, networkName, EngineMessage.NETWORK_ATTACHMENT_REFERENCES_NETWORK_INCOHERENTLY, networkBusinessEntityMap); }

Target:
String.valueOf(str) does the same
Source:
public static Boolean getBoolean(String val) { if (val == null || val.trim().length() == 0) { return false; } try { return Boolean.valueOf(val); } catch (Exception e) { return false; } }

Target:
What is the exception that you attempt to catch? Java doc says nothing about any exceptions from this method.
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:
ClientConnectionException mean that there are issues with network connection. Please consider reconnect logic here.
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:
Why to create JsonRpcNotification each time we want to fire an event? Please have it as instance variable for this class.
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:
we need hostName only to log error. Please call it there.
Source:
public static void setReactorsMap(String vmId, ReactorClient client){ reactorsMap.put(vmId, client); }

Target:
Map should not be static. There us only single instance of JsonRpcServer so we can pass it around and call instance methods.
Source:
public synchronized static void setReactorsMap(String vmId, ReactorClient client){ reactorsMap.put(vmId, client); }

Target:
Lack of consistency in naming. Please fix.
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:
What about: send(messageFormatter(message, id));
Source:
private ValidationResult validateStatus(VDSStatus hostStatus) { return ValidationResult.failWith(EngineMessage.ACTION_TYPE_FAILED_VDS_STATUS_ILLEGAL, ReplacementUtils.createSetVariableString("hostStatus", host.getStatus().name())) .unless(hostStatus == host.getStatus()); }

Target:
errata: I beg you pardon; by 'declarative programming' phrase I of course meant 'imperative programming'.
Source:
private void updateModifiedInterfaces() { List<VdsNetworkInterface> nicsForUpdate = prepareNicsForUpdate(); List<Guid> updateNicsIds = Entities.getIds(nicsForUpdate); if (!nicsForUpdate.isEmpty()) { interfaceDao.massClearNetworkFromNics(updateNicsIds); interfaceDao.massUpdateInterfacesForVds(getNicsForUpdate()); } }

Target:
albeit not related to this patch - shouldn't be called explicitly, but via its getter.
Source:
public Api getConnection() throws UnsecuredConnectionAttemptError, ServerException, IOException { if (api == null) { String url = String.format("%s://%s:%s/ovirt-engine/api", protocol, server, port); log.debug(String.format("Logging to %s as %s", url, username)); api = new Api(url, username, password, true); } return api; }

Target:
I guess we need thread safety here. wouldn't it be simpler to eagerly set the api? and OvirtClient should become a singleton. even a @Singleton
Source:
@Override public void setEnabled(boolean enabled) { label.setEnabled(enabled); if (contentWidget instanceof HasEnabled) { HasEnabled enableableWidget = (HasEnabled) this.contentWidget; enableableWidget.setEnabled(enabled); } }

Target:
we typically write the annotations on separate line
Source:
public void testEvalNegative() { Mockito.when(mockExternalNetworkPredicate.eval(mockNetwork)).thenReturn(true); assertFalse(underTest.eval(mockNetwork)); }

Target:
please use static import
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:
This should be logger.debug or trace
Source:
protected PlaceRequest getMainTabRequest() { logger.info(this.getClass().toString() + " getMainTabRequest"); //$NON-NLS-1$ return PlaceRequestFactory.get(WebAdminApplicationPlaces.errataMainTabPlace); }

Target:
this should be debug/trace, or better no be here at all.
Source:
protected void fireTableSelectionChangeEvent() { logger.info(this.getClass().toString() + " fireTableSelectionChangeEvent"); //$NON-NLS-1$ ErrataSelectionChangeEvent.fire(this, getSelectedItems()); }

Target:
debug/trace/remove?
Source:
public void onErratumSelectionChange(ErrataSelectionChangeEvent event) { logger.info(this.getClass().toString() + " onErratumSelectionChange"); //$NON-NLS-1$ updateMainTabSelection(event.getSelectedItems()); }

Target:
debug/trace/remove?
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:
debug/trace/remove?
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:
debug/trace/remove?
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:
I am guessing this style name should be something else? especially since you have style defined.
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:
debug/trace/remove?
Source:
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) { Guid poolId = Guid.Empty; if (storageDomain.getStoragePoolId() != null) { poolId = storageDomain.getStoragePoolId(); } return runConnectionStorageToDomain(storageDomain, vdsId, type, null, poolId); }

Target:
you can just pass storageDomain.getStoragePoolId(), the called method is handling null pool id, please change that and rebase the patch. other than that seems good to me.
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:
what about DisconnectHostFromStoragePoolServersCommand?
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:
can infos be null? (the check in line 112 above implies it might be)
Source:
public static boolean isGlusterfsCliInstalled(VDS vds) { if (FeatureSupported.glusterVolumeInfoSupported(getStoragePool(vds.getId()).getCompatibilityVersion())) { RpmVersion glusterfsCliVer = vds.getGlusterfsCliVersion(); if (glusterfsCliVer == null || glusterfsCliVer.getRpmRelease() == null || glusterfsCliVer.getRpmRelease().isEmpty()) { return false; } return true; } return true; }

Target:
consider rephrasing to 'return !(condition)' or 'return (cond1 && cond2 && ...).
Source:
private boolean registerLibvirtSecretsImpl(VDS vds, List<LibvirtSecret> libvirtSecrets, boolean clearUnusedSecrets) { VDSReturnValue returnValue = Backend.getInstance().getResourceManager().RunVdsCommand( VDSCommandType.RegisterLibvirtSecrets, new RegisterLibvirtSecretsVDSParameters(vds.getId(), libvirtSecrets, clearUnusedSecrets)); if (!returnValue.getSucceeded()) { log.error("Failed to register libvirt secret on vds {}.", vds.getName()); return false; } return true; }

Target:
You already use this error at line 179, it will be shown twice. You can simply replace line 221-226 with return returnValue.getSucceeded;
Source:
private String getPoolVmTooltip(VmType vmType) { switch (vmType) { case Server: return constants.pooledServer(); case Desktop: return constants.pooledDesktop(); default: return ""; //$NON-NLS-1$ } }

Target:
please make this consistent with getPoolVmImageResource where the default case is fallthrough of Desktop.
Source:
public Boolean getValue(ClusterNetworkModel clusterNetworkModel) { return clusterNetworkModel.isAttached() && clusterNetworkModel.isRequired(); }

Target:
The view should display the model data, it shouldn't have logic for showing data that doesn't represent the model values. The root cause of the problem resides in- ClusterNetworkModel. public ClusterNetworkModel(Network network)->if (network.getCluster() == null)-> getEntity().setCluster(new NetworkCluster(/*isRequired*/!network.isExternal())); It means that in case of detached network the required value is true by default (in case of internal network), it should be changed to be false (no matter if the network is internal or external).
Source:
public void execute(T t) { return; }

Target:
Empty return isn't needed
Source:
private void assertDiskDescriptionMap(String diskAlias, String diskDescription) throws IOException { assertEquals("Should be map of disk alias and disk description", String.format("{\"DiskAlias\":\"%s\"," + "\"DiskDescription\":\"%s\"}", diskAlias, StringUtils.defaultString(diskDescription)), ImagesHandler.getJsonDiskDescription(diskAlias, diskDescription)); }

Target:
should be static - please fix when you rebase
Source:
public static void enrichDiskByJsonDescription(String jsonDiskDescription, Disk disk) throws IOException { Map<String, Object> diskDescriptionMap = JsonHelper.jsonToMap(jsonDiskDescription); disk.setDiskAlias((String) diskDescriptionMap.get(DISK_ALIAS)); disk.setDiskDescription((String) diskDescriptionMap.get(DISK_DESCRIPTION)); }

Target:
This assumes that the json helper parses the values as strings. Let's play it safe and use toString() instead of a cast?
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:
try to use descriptionMap.isEmpty instead
Source:
protected boolean validate() { Guid nicId = getParameters().getNicId(); HostInterfaceValidator hostInterfaceValidator = new HostInterfaceValidator(getNic()); ValidationResult validationResult = hostInterfaceValidator.interfaceExists(nicId); if (!validationResult.isValid()) { return validate(validationResult); } return validate(hostInterfaceValidator.nicIsNotLabeledWithSpecifiedLabel(getLabel())); }

Target:
Maybe- return validate(hostInterfaceValidator.interfaceExists(nicId)) && validate(hostInterfaceValidator.nicIsNotLabeledWithSpecifiedLabel(getLabel()));
Source:
public GetDeviceListVDSCommandParameters(Guid vdsId, StorageType storageType) { super(vdsId); setStorageType(storageType); setCheckStatus(false); }

Target:
This is becoming a bit clunk - just call this(... )
Source:
private void assertDiskDescriptionMap(Disk disk) throws IOException { assertEquals("Should be map of disk alias and disk description", String.format("{\"DiskAlias\":\"%s\"," + "\"DiskDescription\":\"%s\"}", disk.getDiskAlias(), StringUtils.defaultString(disk.getDiskDescription())), MetadataDiskDescriptionHandler.getJsonDiskDescription(disk)); }

Target:
You can try to use the static fields at MetadataDiskDescriptionHandler, this way, it will be more related to the real scenario which we are testing.
Source:
private static Set<String> getHostEmulatedMachines(VDS vds) { return new HashSet<>(Arrays.asList(vds.getSupportedEmulatedMachines().split(","))); }

Target:
any chance same approach should be taken here ?
Source:
private boolean isNetmaskInSync() { return ObjectUtils.objectsEqual(iface.getSubnet(), isPrimaryAddressExist() ? networkDataCenterIpConfigurationDefinition.getPrimaryAddress().getNetmask() : null); }

Target:
extract method for getting primary address would make these lines shorter.
Source:
private void initGraphicsData() { ImportUtils.updateGraphicsDevices(getVm().getStaticData(), getVdsGroup() != null ? getVdsGroup().getCompatibilityVersion() : null); }

Target:
no need to check that getVdsGroup is not null - already done in ImportVmCommandBase#canDoAction
Source:
public void setUpSessionDataContainer() { MockitoAnnotations.initMocks(this); if (Config.getConfigUtils() == null) { Config.setConfigUtils(mock(IConfigUtilsInterface.class)); } when(Config.getConfigUtils().getValue(ConfigValues.CoCoCommandLifeInMinutes, ConfigCommon.defaultConfigurationVersion)).thenReturn(300); }

Target:
pls use formatter
Source:
public void setUp() { when(model.getProgress()).thenReturn(null, progressModel); Config.setConfigUtils(mock(IConfigUtilsInterface.class)); when(Config.getConfigUtils().getValue(ConfigValues.CoCoCommandLifeInMinutes, ConfigCommon.defaultConfigurationVersion)).thenReturn(300); }

Target:
formatter?
Source:
protected void setBondingOptions(ListModel<Map.Entry<String, EntityModel<String>>> value) { privateBondingOptions = value; }

Target:
Why did you change the modifier? If you want to change the list of bondingOptions, isn't is enough to do- 'getBondingOptions().setItems(newBondingOptions)'?
Source:
public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { super.eventRaised(ev, sender, args); if (ev.matchesDefinition(RegistrationResult.RetrievedEventDefinition)) { asyncResult_Retrieved(); } if (ev.matchesDefinition(ProvideTickEvent.definition)) { syncSearch(); } entityModel.eventRaised(ev, sender, args); }

Target:
probably just to be a little more defensive we could put this call just after 'super()' call since we want to treat EntityModel as our ancestor (as was before)
Source:
protected boolean shouldAddVlanToNic(VdsNetworkInterface vlan) { return true; }

Target:
The following code can be valid here as well- protected boolean shouldAddVlanToNic(VdsNetworkInterface vlan) { return vlan.getId()==null; }
Source:
protected boolean canDoAction() { StorageServerConnectionExtension newConnExt = getParameters().getStorageServerConnectionExtension(); return validate(getConnectionExtensionValidator().isConnectionDoesNotExistForHostAndTarget(newConnExt.getHostId(), newConnExt.getIqn())); }

Target:
I'd do this in the previous patch already
Source:
protected void updateWipeAfterDeleteChangeability() { if (isVmAttachedToPool()) { getIsWipeAfterDelete().setIsChangeable(false); } else { getIsWipeAfterDelete().setIsChangeable(true); } }

Target:
so just use getIsWipeAfterDelete().setIsChangeable(!isVmAttachedToPool());