auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int countDownBricks(GlusterVolumeEntity volume) { int downCount = 0; int upCount = 0; for (int i = 0 ; i < volume.getBricks().size(); i++) { GlusterBrickEntity brick = volume.getBricks().get(i); if(brick.getStatus() == GlusterStatus.UP) { upCount++; }else { downCount++; } START if(upCount > 1 && downCount > 1) { END return downCount; } } return downCount; } why not >0 ? let say a volume has 6 bricks and first 2 are down. In this scenario, the above loop will executed 4 times but 3 is enough to get the expected result

Target:
public int countDownBricks(GlusterVolumeEntity volume) { int downCount = 0; int upCount = 0; for (int i = 0 ; i < volume.getBricks().size(); i++) { GlusterBrickEntity brick = volume.getBricks().get(i); if(brick.getStatus() == GlusterStatus.UP) { upCount++; }else { downCount++; } if(upCount > 0 && downCount > 0) { return downCount; } } return downCount; }
Source:
public String getThemeStyleSheet(ApplicationType type) { if (type == null) { START type = DEFAULT_APPLICATION_TYPE; END } return brandingProperties.getProperty(type.getCssKey()); } I still think this should be context parameter.

Target:
public String getThemeStyleSheet(ApplicationType type) { return brandingProperties.getProperty(type.getCssKey()); }
Source:
private boolean shouldUpdateImageProperties() { START if (getOldDisk().getDiskStorageType() == DiskStorageType.IMAGE) { END return false; } Guid oldQuotaId = ((DiskImage) getOldDisk()).getQuotaId(); return !ObjectUtils.objectsEqual(oldQuotaId, getQuotaId()); } IIUC, this should be "!= DiskStorageType.IMAGE", no?

Target:
private boolean shouldUpdateImageProperties() { if (getOldDisk().getDiskStorageType() != DiskStorageType.IMAGE) { return false; } Guid oldQuotaId = ((DiskImage) getOldDisk()).getQuotaId(); return !ObjectUtils.objectsEqual(oldQuotaId, getQuotaId()); }
Source:
protected void postSaveAction(Guid networkGuid, boolean succeeded) { if (succeeded) { if ((Boolean) getIsVmNetwork().getEntity()) { performProfilesActions(networkGuid); } else { START stopProgress(); END cancel(); } } stopProgress(); } we might call stopProgress twice now...

Target:
protected void postSaveAction(Guid networkGuid, boolean succeeded) { if (succeeded) { if ((Boolean) getIsVmNetwork().getEntity()) { performProfilesActions(networkGuid); stopProgress(); } else { stopProgress(); cancel(); } } }
Source:
START private void closeConfirmationWindow() { END getConfirmWindow().stopProgress(); setConfirmWindow(null); } add a null check for getConfirmWindow()

Target:
private void closeConfirmationWindow() { if(getConfirmWindow() == null) { return; } getConfirmWindow().stopProgress(); setConfirmWindow(null); }
Source:
protected void executeCommand() { VDSReturnValue vdsReturnaValue = runVdsCommand(VDSCommandType.StopRebalanceGlusterVolume, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName())); if (!vdsReturnaValue.getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_REBALANCE_STOP_FAILED, vdsReturnaValue.getVdsError() .getMessage()); START return; END } endStepJob(); releaseVolumeLock(); setSucceeded(vdsReturnaValue.getSucceeded()); } should setSucceeded(false) before return

Target:
protected void executeCommand() { VDSReturnValue vdsReturnaValue = runVdsCommand(VDSCommandType.StopRebalanceGlusterVolume, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName())); if (!vdsReturnaValue.getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_REBALANCE_STOP_FAILED, vdsReturnaValue.getVdsError() .getMessage()); setSucceeded(false); return; } endStepJob(); releaseVolumeLock(); setSucceeded(vdsReturnaValue.getSucceeded()); }
Source:
protected void entityPropertyChanged(Object sender, PropertyChangedEventArgs e) { super.entityPropertyChanged(sender, e); if (e.PropertyName.equals("status")) //$NON-NLS-1$ START { END getSearchCommand().execute(); } } no need to worry about the status of the host here

Target:
protected void entityPropertyChanged(Object sender, PropertyChangedEventArgs e) { super.entityPropertyChanged(sender, e); getSearchCommand().execute(); }
Source:
public UnitVmModel flush() { START UnitVmModel model = driver.flush(); END model.getNicsWithLogicalNetworks().getItemsChangedEvent().removeListener(vnicsChangedListener); profilesInstanceTypeEditor.flush(); priorityEditor.flush(); return model; } can't it be resolved in the editor itself (to avoid similar issues on other widgets)? E.g. Since AddRemoveRowWidget -> flush() - 'model.setItems(values)' invokes the ItemsChangedEvent, try clearing the listeners directly beforehand.

Target:
public UnitVmModel flush() { priorityEditor.flush(); profilesInstanceTypeEditor.flush(); return driver.flush(); }
Source:
START protected static VdcParameter create(String name, Class javaType, String uuidStr) { END UUID uuid = UUID.fromString(uuidStr); synchronized (parametersMap) { VdcParameter param = parametersMap.get(uuid); if (param != null) { throw new InvalidParameterUuidException(name, param.getUuid(), param.getName()); } param = new VdcParameter(name, javaType.getName(), uuid); parametersMap.put(uuid, param); return param; } } I prefer to keep create in VdcParameter, and just delegate these method from here. The use of the VdcParametersMeta is optional, just for the developer who like easier integration with IDE, no?

Target:
protected static VdcParameter create(String name, Class javaType, String uuidStr) { return VdcParameter.create(name, javaType, uuidStr); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } VdcParametersMap otherParamsMap = (VdcParametersMap) obj; START return paramsMap.equals(otherParamsMap.paramsMap); END } I know I am out of this world... but do not like temp vars... :) Please ignore! return paramsMap.equals(((VdcParametersMap) obj).paramsMap)

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } return paramsMap.equals(((VdcParametersMap) obj).paramsMap); }
Source:
public boolean equals(Object other) { if (other == null || !(other instanceof VdcParameter)) { return false; } VdcParameter otherParam = (VdcParameter) other; return getName().equals(otherParam.getName()) && getJavaType().equals(otherParam.getJavaType()) START && getGuid().equals(otherParam.getGuid()); END } compare only guid, no?

Target:
public boolean equals(Object other) { if (other == null || !(other instanceof VdcParameter)) { return false; } return getGuid().equals(((VdcParameter) other).getGuid()); }
Source:
public int hashCode() { int hash = 7; hash = 31 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 31 * hash + (this.javaType != null ? this.javaType.hashCode() : 0); START hash = 31 * hash + (this.guid != null ? this.guid.hashCode() : 0); END return hash; } should be based on guid only

Target:
public int hashCode() { int hash = 7; hash = 31 * hash + (this.guid != null ? this.guid.hashCode() : 0); return hash; }
Source:
public int hashCode() { int hash = 7; final int prime = 31; START for (Entry<VdcParameter, Object> entry : paramsMap.entrySet()) { END hash = prime * hash + entry.getKey().hashCode(); hash = prime * hash + entry.getValue().hashCode(); } return hash; } why AbstractMap::hashCode is not enough?

Target:
public int hashCode() { return paramsMap.hashCode(); }
Source:
public int hashCode() { int hash = 7; hash = 31 * hash + (this.value != null ? this.value.hashCode() : 0); return hash; START } END why not just return Object? Why do we need this class?

Target:
public int hashCode() { int hash = 7; hash = 31 * hash + (this.value != null ? this.value.hashCode() : 0); hash = 31 * hash + (this.key != null ? this.key.hashCode() : 0); return hash; }
Source:
protected void executeQueryCommand() { getQueryReturnValue().setReturnValue(DbFacade.getInstance().getRoleDao().get( START getParameters().<Guid>getParameter(UserRolesVdcParameters.RoleId, Guid.class))); END } Can we have: getParameters().<Guid>getParameter(UserRolesVdsParameters.RoleId) or even: getParameters().getParameter(UserRolesVdsParameters.RoleId) if the function gets object?

Target:
protected void executeQueryCommand() { getQueryReturnValue().setReturnValue(DbFacade.getInstance().getRoleDao().get( getParameters().<Guid>getParameter(UserRolesVdcParameters.RoleId))); }
Source:
private void handleTitlePanel(String eventType, Element parent) { START if (title == "") { //$NON-NLS-1$ END // no need to show/hide title return; } titlePanel.setWidget(new Label(title)); if (BrowserEvents.MOUSEOVER.equals(eventType)) { titlePanel.showRelativeTo(parent); } else if (BrowserEvents.MOUSEOUT.equals(eventType)) { titlePanel.hide(); } } Just a small thing, I'd rather do if (title.isEmpty()) ... or alternatively if ("".equals(title)) ... but I guess it's the same thing in the end, from generated JavaScript perspective.

Target:
private void handleTitlePanel(String eventType, Element parent) { if (title.isEmpty()) { // no need to show/hide title return; } titlePanel.setWidget(new Label(title)); if (BrowserEvents.MOUSEOVER.equals(eventType)) { titlePanel.showRelativeTo(parent); } else if (BrowserEvents.MOUSEOUT.equals(eventType)) { titlePanel.hide(); } }
Source:
public GlusterVolumeTaskReturnForXmlRpc glusterVolumeRebalanceStop(String volumeName) { try { START Map<String, Object> xmlRpcReturnValue = vdsServer.glusterVolumeRebalanceStatus(volumeName); END GlusterVolumeTaskReturnForXmlRpc wrapper = new GlusterVolumeTaskReturnForXmlRpc(xmlRpcReturnValue); return wrapper; } catch (UndeclaredThrowableException ute) { throw new XmlRpcRunTimeException(ute); } } Would this method stop the rebalance as well? I can not see stop call here.

Target:
public GlusterVolumeTaskReturnForXmlRpc glusterVolumeRebalanceStop(String volumeName) { try { Map<String, Object> xmlRpcReturnValue = vdsServer.glusterVolumeRebalanceStop(volumeName); GlusterVolumeTaskReturnForXmlRpc wrapper = new GlusterVolumeTaskReturnForXmlRpc(xmlRpcReturnValue); return wrapper; } catch (UndeclaredThrowableException ute) { throw new XmlRpcRunTimeException(ute); } }
Source:
public void refreshDetails(GlusterVolumeEntity volumeEntity) { AsyncDataProvider.getGlusterRebalanceStatus(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; GlusterVolumeTaskStatusEntity rebalanceStatusEntity =vdcValue.getReturnValue(); START showStatus(rebalanceStatusEntity); END } }), volumeEntity.getClusterId(), volumeEntity.getId()); } its better to have a null check for rebalanceStatusEntity

Target:
public void refreshDetails(GlusterVolumeEntity volumeEntity) { AsyncDataProvider.getGlusterRebalanceStatus(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; GlusterVolumeTaskStatusEntity rebalanceStatusEntity =vdcValue.getReturnValue(); if (rebalanceStatusEntity != null) { showStatus(rebalanceStatusEntity); } } }), volumeEntity.getClusterId(), volumeEntity.getId()); }
Source:
private LiveMigrateDiskParameters createLiveMigrateDiskParameters(MoveDiskParameters moveDiskParameters, Guid vmId) { LiveMigrateDiskParameters toReturn = new LiveMigrateDiskParameters(moveDiskParameters.getImageId(), moveDiskParameters.getSourceDomainId(), moveDiskParameters.getStorageDomainId(), vmId, moveDiskParameters.getQuotaId()); START toReturn.setImageGroupID(diskMap.get(moveDiskParameters.getImageId()).getId()); END return toReturn; } why not to add it to the parameters of LiveMigrateDiskParameters's constructor to enforce that the parameters of the live migrate disk command will always have the image group id?

Target:
private LiveMigrateDiskParameters createLiveMigrateDiskParameters(MoveDiskParameters moveDiskParameters, Guid vmId) { return new LiveMigrateDiskParameters(moveDiskParameters.getImageId(), moveDiskParameters.getSourceDomainId(), moveDiskParameters.getStorageDomainId(), vmId, moveDiskParameters.getQuotaId(), diskMap.get(moveDiskParameters.getImageId()).getId()); }
Source:
private static String getQuotaRegexString(SearchObjectAutoCompleter search) { START String query = ".*" + search.getDefaultSort(SearchObjects.QUOTA_OBJ_NAME) + ".*" END + search.getRelatedTableNameWithOutTags(SearchObjects.QUOTA_OBJ_NAME) + ".* "; return query; } Why not using here StringBuilder as well ???

Target:
private static String getQuotaRegexString(SearchObjectAutoCompleter search) { StringBuilder query = new StringBuilder(); query.append(".*") .append(search.getDefaultSort(SearchObjects.QUOTA_OBJ_NAME)) .append(".*") .append(search.getRelatedTableNameWithOutTags(SearchObjects.QUOTA_OBJ_NAME)) .append(".* "); return query.toString(); }
Source:
private static String getQuotaRegexString(SearchObjectAutoCompleter search) { String query = ".*" + search.getDefaultSort(SearchObjects.QUOTA_OBJ_NAME) + ".*" + search.getRelatedTableNameWithOutTags(SearchObjects.QUOTA_OBJ_NAME) + ".* "; START System.out.println("VdsGroupRegExp: " + query); END return query; } Please remove printing to stdout

Target:
private static String getQuotaRegexString(SearchObjectAutoCompleter search) { String query = ".*" + search.getDefaultSort(SearchObjects.QUOTA_OBJ_NAME) + ".*" + search.getRelatedTableNameWithOutTags(SearchObjects.QUOTA_OBJ_NAME) + ".* "; return query; }
Source:
public String getRelativePath() { START String path = getPath(); END if (path.startsWith("/")) { //$NON-NLS-1$ path = path.substring(1); } return path; } Yes, this will work. If I understand correctly, this is run by gwt... right? Does it support File::getCanonicalPath()? if so let's use it... If not... I would have gone with something a little more generic... path.replace("//", "/") without conditional...

Target:
public String getRelativePath() { String path = getPath(); return path.startsWith("/") ? path.substring(1) : path; //$NON-NLS-1$ }
Source:
public GlusterBricks list() { START boolean flag = QueryHelper.hasMatrixParam(getUriInfo(), "force"); END List<GlusterBrickEntity> bricks = getBackendCollection(VdcQueryType.GetGlusterVolumeBricks, new IdQueryParameters(asGuid(getVolumeId()))); GlusterBricks bricksModel = mapCollection(bricks); return addActions(bricksModel); } remove above line

Target:
public GlusterBricks list() { List<GlusterBrickEntity> bricks = getBackendCollection(VdcQueryType.GetGlusterVolumeBricks, new IdQueryParameters(asGuid(getVolumeId()))); GlusterBricks bricksModel = mapCollection(bricks); return addActions(bricksModel); }
Source:
START public EventBus getEventBus() { END return eventBus; } Thinking about it, this method can be protected and final.

Target:
protected final EventBus getEventBus() { return eventBus; }
Source:
START public void registerHandler(HandlerRegistration reg) { END if (reg != null && !handlerRegistrations.contains(reg)) { handlerRegistrations.add(reg); } } I think this should be final.

Target:
public final void registerHandler(HandlerRegistration reg) { if (reg != null && !handlerRegistrations.contains(reg)) { handlerRegistrations.add(reg); } }
Source:
START public void unregisterHandlers() { END for (HandlerRegistration reg: handlerRegistrations) { reg.removeHandler(); // can't call unregisterHandler(reg) as that would modify the list during iteration } handlerRegistrations.clear(); } I think this should be final.

Target:
public final void unregisterHandlers() { for (HandlerRegistration reg: handlerRegistrations) { reg.removeHandler(); // can't call unregisterHandler(reg) as that would modify the list during iteration } handlerRegistrations.clear(); }
Source:
START public void unregisterHandler(HandlerRegistration reg) { END if (reg != null) { reg.removeHandler(); handlerRegistrations.remove(reg); } } I think this should be final.

Target:
public final void unregisterHandler(HandlerRegistration reg) { if (reg != null) { reg.removeHandler(); handlerRegistrations.remove(reg); } }
Source:
START public void logMessage(Guid clusterId, GlusterVolumeEntity volume, final String action, final String status, AuditLogType logType) { END logUtil.logAuditMessage(clusterId, volume, null, logType, new HashMap<String, String>(){ { put("action", action); put("status", status); }}); } Does this need to be public?

Target:
private void logMessage(Guid clusterId, GlusterVolumeEntity volume, final String action, final String status, AuditLogType logType) { logUtil.logAuditMessage(clusterId, volume, null, logType, new HashMap<String, String>(){ { put("action", action); put("status", status); }}); }
Source:
public void refreshDetails(GlusterVolumeEntity volumeEntity) { AsyncDataProvider.getGlusterRemoveBricksStatus(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; GlusterVolumeTaskStatusEntity statusEntity = vdcValue.getReturnValue(); if (statusEntity != null) { showStatus(statusEntity); } else { START cancelRefresh(); END } } }), volumeEntity.getClusterId(), volumeEntity.getId(), getBricks()); } you should not cancelRefresh if the query is failed

Target:
public void refreshDetails(GlusterVolumeEntity volumeEntity) { AsyncDataProvider.getGlusterRemoveBricksStatus(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; GlusterVolumeTaskStatusEntity statusEntity = vdcValue.getReturnValue(); if (statusEntity != null) { showStatus(statusEntity); } } }), volumeEntity.getClusterId(), volumeEntity.getId(), getBricks()); }
Source:
public void UpdateDynamicData(VdsDynamic dynamicData) { START log.debug("Updated VDS dynamic without checking if update is needed"); END DbFacade.getInstance().getVdsDynamicDao().update(dynamicData); } I don't see a cache update here. pls fix the java doc

Target:
public void UpdateDynamicData(VdsDynamic dynamicData) { DbFacade.getInstance().getVdsDynamicDao().update(dynamicData); }
Source:
protected void syncSearch() { START SearchParameters tempVar = new SearchParameters(getSearchString(), SearchType.VDS, isCaseSensitiveSearch()); END tempVar.setRefresh(getIsQueryFirstTime()); super.syncSearch(VdcQueryType.Search, tempVar); } this model is not influenced by the searchbar, you can remove it from patch.

Target:
protected void syncSearch() { SearchParameters tempVar = new SearchParameters(getSearchString(), SearchType.VDS); tempVar.setRefresh(getIsQueryFirstTime()); super.syncSearch(VdcQueryType.Search, tempVar); }
Source:
public VdcActionParametersBase(ParametersMap map) { for (Map.Entry<Parameter, Serializable> entry : map.entrySet()) { put(Parameter.getByUuid(entry.getKey().getUuid().toString()), entry.getValue()); } START } END this I need to understand... let's discuss this on the VdcParameter at infrastructure, as I think it should be done automatically while de-serialized.

Target:
public VdcActionParametersBase(ParametersMap map) { super(map); }
Source:
protected boolean checkStorageDomainStatusNotEqual(StorageDomainStatus status) { boolean returnValue = false; START if (getStorageDomainStatus() != null && getStorageDomainStatus() != null) { END returnValue = (getStorageDomainStatus() != status); if (!returnValue) { addStorageDomainStatusIllegalMessage(); } } return returnValue; } the same condition is checked twice

Target:
protected boolean checkStorageDomainStatusNotEqual(StorageDomainStatus status) { boolean returnValue = false; if (getStorageDomainStatus() != null) { returnValue = (getStorageDomainStatus() != status); if (!returnValue) { addStorageDomainStatusIllegalMessage(); } } return returnValue; }
Source:
private void applyModeCustomizations() { if (ApplicationModeHelper.getUiMode() == ApplicationMode.GlusterOnly) { optimizationTab.setVisible(false); resiliencePolicyTab.setVisible(false); clusterPolicyTab.setVisible(false); dataCenterPanel.addStyleName(style.generalTabTopDecoratorEmpty()); START cPUEditor.setVisible(false); END } } i think CPU is already not visible in the Cluster dialog

Target:
private void applyModeCustomizations() { if (ApplicationModeHelper.getUiMode() == ApplicationMode.GlusterOnly) { optimizationTab.setVisible(false); resiliencePolicyTab.setVisible(false); clusterPolicyTab.setVisible(false); dataCenterPanel.addStyleName(style.generalTabTopDecoratorEmpty()); } }
Source:
public void executeQueryCommand() { clusterId = getParameters().getClusterId(); Guid volumeId = getParameters().getVolumeId(); if (volumeId != null) { volume = getGlusterVolumeDao().getById(volumeId); if (volume == null) { throw new RuntimeException(VdcBllMessages.GLUSTER_VOLUME_ID_INVALID.toString()); } } if (clusterId == null) { START clusterId = volume.getClusterId(); END } getQueryReturnValue().setReturnValue(fetchTaskStatusDetails()); } if volumeId is null then we will have NPE here i think its safe to send null to getById method, no? if so then the null check on volumeId can be removed and this will prevent NPE

Target:
public void executeQueryCommand() { clusterId = getParameters().getClusterId(); volume = getGlusterVolumeDao().getById(getParameters().getVolumeId()); if (volume == null) { throw new RuntimeException(VdcBllMessages.GLUSTER_VOLUME_ID_INVALID.toString()); } if (clusterId == null) { clusterId = volume.getClusterId(); } getQueryReturnValue().setReturnValue(fetchTaskStatusDetails()); }
Source:
protected void syncSearch() { START if (getEntity() == null) { END return; } if (getEntity() != null) { GlusterVolumeEntity glusterVolumeEntity = (GlusterVolumeEntity) getEntity(); // If the items are same, just fire the item changed event to make sure that items are displayed if (getItems() == glusterVolumeEntity.getBricks()) { getItemsChangedEvent().raise(this, EventArgs.Empty); } else { setItems(glusterVolumeEntity.getBricks()); } } else { setItems(null); } } this check is redundant

Target:
protected void syncSearch() { if (getEntity() != null) { GlusterVolumeEntity glusterVolumeEntity = (GlusterVolumeEntity) getEntity(); // If the items are same, just fire the item changed event to make sure that items are displayed if (getItems() == glusterVolumeEntity.getBricks()) { getItemsChangedEvent().raise(this, EventArgs.Empty); } else { setItems(glusterVolumeEntity.getBricks()); } } else { setItems(null); } }
Source:
public static Parameter instantiate(SerializationStreamReader reader) throws SerializationException { UUID uuid = UUID_CustomFieldSerializer.instantiate(reader); START return Parameter.getByUuid(uuid.toString()); END } no reason for the uuid temp parameter :)

Target:
public static Parameter instantiate(SerializationStreamReader reader) throws SerializationException { return Parameter.getByUuid(UUID_CustomFieldSerializer.instantiate(reader).toString()); }
Source:
public ParametersMap put(Parameter param, Object value) { if (!isAssignableFrom(param.getJavaType(), value.getClass())) { START throw new InvalidParameterValueException(param.getName(), param.getJavaType(), value.getClass()); END } paramsMap.put(param, (Serializable) value); return this; } I think this should be pushed higher in patch chain.

Target:
public ParametersMap put(Parameter param, Object value) { if (value == null) { remove(param); } else { if (!isAssignableFrom(param.getJavaType(), value.getClass())) { throw new InvalidParameterValueException(param.getName(), param.getJavaType(), value.getClass()); } paramsMap.put(param, (Serializable) value); } return this; }
Source:
public List<permissions> getAllForEntity(Guid id, Guid userID, boolean isFiltered) { START Integer appMode = Config.<Integer> GetValue(ConfigValues.ApplicationMode); END MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("id", id).addValue("user_id", userID).addValue("is_filtered", isFiltered) .addValue("app_mode", appMode.intValue()); return getCallsHandler().executeReadList("GetPermissionsByEntityId", PermissionRowMapper.instance, parameterSource); } I think GetValue returns an "int" only, so no need to assign to Integer. Rather you can assign to int type and then pass to parameter creation code.

Target:
public List<permissions> getAllForEntity(Guid id, Guid userID, boolean isFiltered) { int appMode = Config.<Integer> GetValue(ConfigValues.ApplicationMode); MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("id", id).addValue("user_id", userID).addValue("is_filtered", isFiltered) .addValue("app_mode", appMode); return getCallsHandler().executeReadList("GetPermissionsByEntityId", PermissionRowMapper.instance, parameterSource); }
Source:
protected void executeQueryCommand() { START getQueryReturnValue().setReturnValue(DbFacade.getInstance().getVmTemplateDao().getCount()); END } please separate to a method, getVmTemplateDao() and use getDbFacade().

Target:
protected void executeQueryCommand() { getQueryReturnValue().setReturnValue(getVmTemplateDao().getCount()); }
Source:
protected Map<String, Pair<String, String>> getExclusiveLocks() { Map<String, Pair<String, String>> locks = new HashMap<String, Pair<String, String>>(); VDSGroup cluster = getVdsGroup(); if (cluster == null || cluster.supportsVirtService()) { locks.put(getParameters().getVdsId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VDS, START VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); END } return locks; } Vds lock should be acquired for gluster hosts as well

Target:
protected Map<String, Pair<String, String>> getExclusiveLocks() { Map<String, Pair<String, String>> locks = new HashMap<String, Pair<String, String>>(); locks.put(getParameters().getVdsId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VDS, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); return locks; }
Source:
public static boolean isOsSupportedForVirtIoScsi(int osId, Version clusterVersion) { START ArrayList<String> diskInterfaces = SimpleDependecyInjector.getInstance().get(OsRepository.class).getDiskInterfaces(osId, clusterVersion); END return diskInterfaces.contains(DiskInterface.VirtIO_SCSI.toString()); } Don't count on this being an ArrayList - use a List

Target:
public static boolean isOsSupportedForVirtIoScsi(int osId, Version clusterVersion) { List<String> diskInterfaces = SimpleDependecyInjector.getInstance().get(OsRepository.class).getDiskInterfaces(osId, clusterVersion); return diskInterfaces.contains(DiskInterface.VirtIO_SCSI.toString()); }
Source:
private String getValidBrickNames(List<GlusterBrickEntity> bricksForTask) { StringBuilder builder = new StringBuilder(); for (GlusterBrickEntity brick : bricksForTask) { builder.append(brick.getQualifiedName()); builder.append(", "); } START return builder.substring(0, builder.length() - 2).toString(); END } Are we sure that bricksForTask will never be empty? otherwise builder.length -2 would cause error

Target:
private String getValidBrickNames(List<GlusterBrickEntity> bricksForTask) { if (bricksForTask.size() == 0) { return ""; } StringBuilder builder = new StringBuilder(); for (GlusterBrickEntity brick : bricksForTask) { builder.append(brick.getQualifiedName()); builder.append(", "); } return builder.substring(0, builder.length() - 2).toString(); }
Source:
public void runMultipleActions(final VdcActionType actionType, final List<VdcActionParametersBase> parameters, final IFrontendActionAsyncCallback successCallback) { START runMultipleActions(actionType, parameters, successCallback, null, false); END } Changing this to true would still be useful to solve the unreported bug that I described.

Target:
public void runMultipleActions(final VdcActionType actionType, final List<VdcActionParametersBase> parameters, final IFrontendActionAsyncCallback successCallback) { runMultipleActions(actionType, parameters, successCallback, null, true); }
Source:
private static List<VmDevice> getPluggedInterfaces(List<VmDevice> devices) { START ArrayList<VmDevice> result = new ArrayList<VmDevice>(); END for (VmDevice device : devices) { if (isBridge(device) && device.getIsPlugged()) { result.add(device); } } return result; } The reference type should be just List

Target:
private static List<VmDevice> getPluggedInterfaces(List<VmDevice> devices) { List<VmDevice> result = new ArrayList<VmDevice>(); for (VmDevice device : devices) { if (isBridge(device) && device.getIsPlugged()) { result.add(device); } } return result; }
Source:
public NetworkModification(T parameters) { super(parameters); START this.setStoragePoolId(getNetwork().getDataCenterId()); END } "this." prefix not necessary

Target:
public NetworkModification(T parameters) { super(parameters); setStoragePoolId(getNetwork().getDataCenterId()); }
Source:
private void initVncKeyboardLayout() { final List<String> layouts = (List<String>) AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.VncKeyboardLayoutValidValues); START final ArrayList<String> vncKeyboardLayoutItems = new ArrayList<String>(); END vncKeyboardLayoutItems.add(null); vncKeyboardLayoutItems.addAll(layouts); getVncKeyboardLayout().setItems(vncKeyboardLayoutItems); getVncKeyboardLayout().setIsChangable(false); } why final? and please stick to a single type (List/ArrayList)

Target:
private void initVncKeyboardLayout() { List<String> layouts = (List<String>) AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.VncKeyboardLayoutValidValues); List<String> vncKeyboardLayoutItems = new ArrayList<String>(); vncKeyboardLayoutItems.add(null); vncKeyboardLayoutItems.addAll(layouts); getVncKeyboardLayout().setItems(vncKeyboardLayoutItems); getVncKeyboardLayout().setIsChangable(false); }
Source:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getRemoveCommand()) { remove(); } START else if ("Cancel".equals(command.getName())) { //$NON-NLS-1$ END cancel(); } } I don't see the point of having a cancel action in a subtab.

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getRemoveCommand()) { remove(); } }
Source:
START public List<ExternalSubnet> getSubnets() { END return subnets; } I don't think this getter is needed, and definitely not publicly.

Target:
private List<ExternalSubnet> getSubnets() { return subnets; }
Source:
private Provider<?> getProvider() { if (provider == null) { START provider = getDbFacade().getProviderDao().get(getExternalNetwork().getProviderId()); END } return provider; } if getExternalNetwork() returns null, you'll end up with NPE.

Target:
private Provider<?> getProvider() { if (provider == null && getExternalNetwork() != null) { provider = getDbFacade().getProviderDao().get(getExternalNetwork().getProviderId()); } return provider; }
Source:
private ProviderNetwork getExternalNetwork() { if (externalNetwork == null) { START Network network = getNetworkDAO().get(getParameters().getNetworkId()); END externalNetwork = network.getProvidedBy(); } return externalNetwork; } what guarantees getParameters().getNetworkId()) represents a real network ?

Target:
private ProviderNetwork getExternalNetwork() { if (externalNetwork == null) { Network network = getNetworkDAO().get(getParameters().getNetworkId()); if (network != null) { externalNetwork = network.getProvidedBy(); } } return externalNetwork; }
Source:
private void updateActionAvailability() { NetworkView network = getEntity(); START getNewCommand().setIsExecutionAllowed(network != null && network.isExternal()); END getRemoveCommand().setIsExecutionAllowed((getSelectedItems() != null && getSelectedItems().size() > 0)); } I thought the subtab wasn't supposed to even be visible if the network wasn't external?... And without this check you could just inline the getEntity().

Target:
private void updateActionAvailability() { getRemoveCommand().setIsExecutionAllowed((getSelectedItems() != null && getSelectedItems().size() > 0)); }
Source:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getNewCommand()) { newSubnet(); START } END else if (command == getRemoveCommand()) { remove(); } else if ("Cancel".equals(command.getName())) { //$NON-NLS-1$ cancel(); } } Formatting.

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getNewCommand()) { newSubnet(); } else if (command == getRemoveCommand()) { remove(); } }
Source:
START public void setName(EntityModel<String> name) { END this.name = name; } I see no reason for the setters to be public.

Target:
private void setName(EntityModel<String> name) { this.name = name; }
Source:
public void flush() { START if (subnet == null) { END subnet = new ExternalSubnet(); } subnet.setName(getName().getEntity()); Network network = getNetwork().getSelectedItem(); subnet.setExternalNetwork(network != null ? network.getProvidedBy() : null); subnet.setCidr(getCidr().getEntity()); subnet.setIpVersion(getIpVersion().getSelectedItem()); } Why not initiate the subnet to new ExternalSubnet() and get rid of this check?

Target:
public void flush() { subnet = new ExternalSubnet(); subnet.setName(getName().getEntity()); Network network = getNetwork().getSelectedItem(); subnet.setExternalNetwork(network.getProvidedBy()); subnet.setCidr(getCidr().getEntity()); subnet.setIpVersion(getIpVersion().getSelectedItem()); }
Source:
START protected void initLineModel(KeyValueLineModel keyValueLineModel, String key) { END keyValueLineModel.getValue().setIsAvailable(false); keyValueLineModel.getValues().setIsAvailable(false); } Actually, I think initLineModel() should be no-op too; the semantics of it are what happens when a different key is picked, but in this case nothing should change when a different key is picked, right? Both value boxes (constrained value and free text) are hidden all along. So I would hide them originally, say by extending the createNewLineModel() method, and implement this as no-op.

Target:
protected void initLineModel(KeyValueLineModel keyValueLineModel, String key) { // no implementation }
Source:
START public void setVms(ListModel<Pair<String, VM>> vms) { END this.vms = vms; } I think this could be private.

Target:
private void setVms(ListModel<Pair<String, VM>> vms) { this.vms = vms; }
Source:
public Object deepCopy(Object val) throws HibernateException { if (val == null) return null; if (val instanceof byte[]) { return new Guid((byte[]) val, true); } if (val instanceof UUID) return new Guid((UUID) val); if (val instanceof Guid) return new Guid(((Guid) val).getUuid()); START throw new UnsupportedOperationException("Can't convert " + val.getClass() + " to GUID"); END } Shouldn't this be HibernateException?

Target:
public Object deepCopy(Object val) throws HibernateException { if (val == null) return null; if (val instanceof byte[]) { return new Guid((byte[]) val, true); } if (val instanceof UUID) return new Guid((UUID) val); if (val instanceof Guid) return new Guid(((Guid) val).getUuid()); throw new HibernateException("Can't convert " + val.getClass() + " to GUID"); }
Source:
public List<Network> getAllByLabelForCluster(String label, Guid clusterId) { START List<Network> networksInCluster = getAllForCluster(clusterId, null, false); END List<Network> labeledNetworks = new ArrayList<>(); for (Network network : networksInCluster) { if (StringUtils.equals(network.getLabel(), label)) { labeledNetworks.add(network); } } return labeledNetworks; } Why not call just with id?

Target:
public List<Network> getAllByLabelForCluster(String label, Guid clusterId) { List<Network> networksInCluster = getAllForCluster(clusterId); List<Network> labeledNetworks = new ArrayList<>(); for (Network network : networksInCluster) { if (StringUtils.equals(network.getLabel(), label)) { labeledNetworks.add(network); } } return labeledNetworks; }
Source:
protected void onExportChanged() { boolean externalNetwork = (Boolean) getExport().getEntity(); getQos().setIsChangable(!externalNetwork); getAddQosCommand().setIsExecutionAllowed(!externalNetwork); String label = getNetworkLabel().getSelectedItem(); START if (externalNetwork) { END getNetworkLabel().setItems(new HashSet<String>()); } else { getNetworkLabel().setItems(dcLabels); } getNetworkLabel().setSelectedItem(label); } consider 'ternary if' here

Target:
protected void onExportChanged() { boolean externalNetwork = (Boolean) getExport().getEntity(); getQos().setIsChangable(!externalNetwork); getAddQosCommand().setIsExecutionAllowed(!externalNetwork); String label = getNetworkLabel().getSelectedItem(); getNetworkLabel().setItems(externalNetwork ? new HashSet<String>() : dcLabels); getNetworkLabel().setSelectedItem(label); }
Source:
private List<VM> getMigrableVmsRunningOnVds(final Guid hostId, Map<Guid, List<VM>> hostId2HaVmMapping) { List<VM> vms = hostId2HaVmMapping.get(hostId); vms = LinqUtils.filter(vms, new Predicate<VM>() { @Override public boolean eval(VM v) { return v.getMigrationSupport() == MigrationSupport.MIGRATABLE START && !hostId.equals(v.getDedicatedVmForVds()); END } }); return vms; } Migratable is enough.

Target:
private List<VM> getMigrableVmsRunningOnVds(final Guid hostId, Map<Guid, List<VM>> hostId2HaVmMapping) { List<VM> vms = hostId2HaVmMapping.get(hostId); vms = LinqUtils.filter(vms, new Predicate<VM>() { @Override public boolean eval(VM v) { return v.getMigrationSupport() == MigrationSupport.MIGRATABLE; } }); return vms; }
Source:
private Map<Guid, BrickProperties> getBrickPropertiesMap(GlusterVolumeAdvancedDetails volumeDetails) { Map<Guid, BrickProperties> brickStatusMap = new HashMap<Guid, BrickProperties>(); for (BrickDetails brickDetails : volumeDetails.getBrickDetails()) { START brickStatusMap.put(brickDetails.getBrickProperties().getBrickId(), brickDetails.getBrickProperties()); END } return brickStatusMap; } brickDetails.getBrickProperties().getBrickId() could be null if the brick is not present in DB

Target:
private Map<Guid, BrickProperties> getBrickPropertiesMap(GlusterVolumeAdvancedDetails volumeDetails) { Map<Guid, BrickProperties> brickStatusMap = new HashMap<Guid, BrickProperties>(); for (BrickDetails brickDetails : volumeDetails.getBrickDetails()) { if (brickDetails.getBrickProperties().getBrickId() != null) { brickStatusMap.put(brickDetails.getBrickProperties().getBrickId(), brickDetails.getBrickProperties()); } } return brickStatusMap; }
Source:
private boolean isMatchPath(String[] linkPathSegments, List<PathSegment> uriPathSegments) { for (int i = 0; i < linkPathSegments.length; i++) { String uriPathSegment = uriPathSegments.get(i).getPath(); START if (isUUID(uriPathSegment) || uriPathSegment.equals(linkPathSegments[i])) { END continue; } else { return false; } } return true; } Maybe invert the condition and return false: if (!isUUID(uriPathSegment) && !uriPathSegment.equals(linkPathSegments[i])) { return false; } That way you don't need the else branch.

Target:
private boolean isMatchPath(String[] linkPathSegments, List<PathSegment> uriPathSegments) { for (int i = 0; i < linkPathSegments.length; i++) { String uriPathSegment = uriPathSegments.get(i).getPath(); if (!isUUID(uriPathSegment) && !uriPathSegment.equals(linkPathSegments[i])) { return false; } } return true; }
Source:
START public EventsManager() throws NotificationServiceException { END try { ds = new StandaloneDataSource(); } catch (SQLException e) { throw new NotificationServiceException("Failed to obtain database connectivity", e); } } Why do we want to have runtime exception in the signature of the constructor?

Target:
public EventsManager() { try { ds = new StandaloneDataSource(); } catch (SQLException e) { throw new NotificationServiceException("Failed to obtain database connectivity", e); } }
Source:
public OneUuidReturnForXmlRpc glusterSnapshotCreate(String volumeName, String snapshotName, String description, boolean force) { JsonRpcRequest request = START new RequestBuilder("GlusterSnapshot.create").withOptionalParameter("volumeName", volumeName) END .withParameter("snapName", snapshotName) .withParameter("description", description) .withParameter("force", force) .build(); Map<String, Object> response = new FutureMap(this.client, request).withIgnoreResponseKey(); return new OneUuidReturnForXmlRpc(response); } is volumeName optional parameter?

Target:
public OneUuidReturnForXmlRpc glusterSnapshotCreate(String volumeName, String snapshotName, String description, boolean force) { JsonRpcRequest request = new RequestBuilder("GlusterSnapshot.create").withParameter("volumeName", volumeName) .withParameter("snapName", snapshotName) .withOptionalParameter("description", description) .withParameter("force", force) .build(); Map<String, Object> response = new FutureMap(this.client, request).withIgnoreResponseKey(); return new OneUuidReturnForXmlRpc(response); }
Source:
private void removeMemoryVolumes(String memoryVolume, Guid vmId) { VdcReturnValueBase retVal = getBackend().runInternalAction( VdcActionType.RemoveMemoryVolumes, new RemoveMemoryVolumesParameters(memoryVolume, vmId), START ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); END if (!retVal.getSucceeded()) { log.errorFormat("Failed to remove memory volumes: {0}", memoryVolume); } } seems like we don't need "createDefaultContexForTasks"

Target:
private void removeMemoryVolumes(String memoryVolume, Guid vmId) { VdcReturnValueBase retVal = getBackend().runInternalAction( VdcActionType.RemoveMemoryVolumes, new RemoveMemoryVolumesParameters(memoryVolume, vmId)); if (!retVal.getSucceeded()) { log.errorFormat("Failed to remove memory volumes: {0}", memoryVolume); } }
Source:
private void volumeType_SelectedItemChanged() { if (getVolumeType().getSelectedItem() == null || getDataCenter().getSelectedItem() == null) { return; } VolumeType volumeType = (VolumeType) getVolumeType().getSelectedItem(); START StorageType storageType = ((StorageDomain) getStorageDomain().getSelectedItem()).getStorageType(); END updateVolumeFormat(volumeType, storageType); updateShareable(volumeType, storageType); } please check getStorageDomain().getSelectedItem() for nullity - iirc, can be null in case storage domain is in maintenance.

Target:
private void volumeType_SelectedItemChanged() { if (getVolumeType().getSelectedItem() == null || getDataCenter().getSelectedItem() == null || getStorageDomain().getSelectedItem() == null) { return; } VolumeType volumeType = (VolumeType) getVolumeType().getSelectedItem(); StorageType storageType = ((StorageDomain) getStorageDomain().getSelectedItem()).getStorageType(); updateVolumeFormat(volumeType, storageType); updateShareable(volumeType, storageType); }
Source:
public synchronized HashSet<Guid> getDomainProblematicVdsList(Guid domainId) { HashSet<Guid> vdsList = new HashSet<>(); Map<Guid, Status> domainVdsStatus = domainsVisibility.get(domainId); for (Entry<Guid, Status> status : domainVdsStatus.entrySet()) { START if (status.getValue().isProblematic()) END vdsList.add(status.getKey()); } return vdsList; } please surround the block with

Target:
public synchronized HashSet<Guid> getDomainProblematicVdsList(Guid domainId) { HashSet<Guid> vdsList = new HashSet<>(); Map<Guid, Status> domainVdsStatus = domainsVisibility.get(domainId); for (Entry<Guid, Status> status : domainVdsStatus.entrySet()) { if (status.getValue().isProblematic()) { vdsList.add(status.getKey()); } } return vdsList; }
Source:
private SSLEngine createSSLEngine(boolean clientMode) { final SSLContext START ctx = END this.sslContext; if (ctx == null) { return null; } final SSLEngine engine = ctx.createSSLEngine(); engine.setUseClientMode(clientMode); return engine; } Why use a local variable?

Target:
private SSLEngine createSSLEngine(boolean clientMode) { final SSLEngine engine = this.sslContext.createSSLEngine(); engine.setUseClientMode(clientMode); return engine; }
Source:
protected DataCenter postPopulate(DataCenter model) { START model.setLocal(new Random().nextBoolean()); END model.setStorageFormat(MappingTestHelper.shuffle(StorageFormat.class).value()); return model; } This shouldn't be needed. The model is already randomly populated in the "populate" method. Enum types need this special treatment, but not booleans.

Target:
protected DataCenter postPopulate(DataCenter model) { model.setStorageFormat(MappingTestHelper.shuffle(StorageFormat.class).value()); return model; }
Source:
public static boolean isVersionMatchStorageType(Version version, boolean isLocalType) { if (isLocalType) { return version.compareTo(new Version(3, 0)) >= 0; } else { START return version.compareTo(new Version(3, 0)) >= 0; END } } I still don't see why we need the 'if..else' here? both cases are the same

Target:
public static boolean isVersionMatchStorageType(Version version, boolean isLocalType) { return version.compareTo(new Version(3, 0)) >= 0; }
Source:
public boolean isLocal() { START return getStorageType() == StorageType.LOCALFS; END } I'd add an isLocal() method to the StorageType enum and have this return getStorageType.isLocal()

Target:
public boolean isLocal() { return getStorageType().isLocal(); }
Source:
START public Boolean getHighlyAvailableLocalMaintenance() { END return this.mVdsStatistics.getHighlyAvailableLocalMaintenance(); } is there a special reason to use wrapped classes?

Target:
public boolean getHighlyAvailableLocalMaintenance() { return this.mVdsStatistics.getHighlyAvailableLocalMaintenance(); }
Source:
private void setGlobalHaMaintenance(boolean enabled) { VM vm = (VM) getSelectedItem(); if (vm == null) { return; } if (!vm.isHostedEngine()) { return; } SetHaMaintenanceParameters params = new SetHaMaintenanceParameters(vm.getRunOnVds(), HaMaintenanceMode.GLOBAL, enabled); START Frontend.getInstance().runAction(VdcActionType.SetHaMaintenance, params, null, this); END } minor: you can use runAction overload with type and params.

Target:
private void setGlobalHaMaintenance(boolean enabled) { VM vm = (VM) getSelectedItem(); if (vm == null) { return; } if (!vm.isHostedEngine()) { return; } SetHaMaintenanceParameters params = new SetHaMaintenanceParameters(vm.getRunOnVds(), HaMaintenanceMode.GLOBAL, enabled); Frontend.getInstance().runAction(VdcActionType.SetHaMaintenance, params); }
Source:
public void setRefreshRate(int interval) { if (getRefreshRate() == interval) { return; } reset(); logger.fine("GridTimer[" + name + "]: Refresh Rate set to: " + interval); //$NON-NLS-1$ //$NON-NLS-2$ // set the NORMAL interval normalInterval = interval; START ValueChangeEvent.fire(this, String.valueOf(getRefreshRate())); END } Hm, just a nit-picky question: shouldn't GridTimer implement HasValueChangeHandlers<Integer> instead of current HasValueChangeHandlers<String> ?

Target:
public void setRefreshRate(int interval) { if (getRefreshRate() == interval) { return; } reset(); logger.fine("GridTimer[" + name + "]: Refresh Rate set to: " + interval); //$NON-NLS-1$ //$NON-NLS-2$ // set the NORMAL interval normalInterval = interval; ValueChangeEvent.fire(this, getRefreshRate()); }
Source:
public static boolean canVmsBePaused(List<VM> items) { boolean result = true; for (VM vm : items) { result &= AsyncDataProvider.isSuspendSupportedByArchitecture(vm.getClusterArch(), START vm.getVdsGroupCompatibilityVersion()); END } return result; } Please check the result here and break if false , since all values are with AND , there is no point to continue if we got false

Target:
public static boolean canVmsBePaused(List<VM> items) { for (VM vm : items) { if (!AsyncDataProvider.isSuspendSupportedByArchitecture(vm.getClusterArch(), vm.getVdsGroupCompatibilityVersion())) { return false; } } return true; }
Source:
public FilterEntry(String eventName, boolean exclude, String transport, String name) { this.eventName = eventName; this.exclude = exclude; this.recipient = new Recipient(transport, name); START } END just a question... is there a rule in the styles not to: public FilterEntry(String messageName, boolean exclude, Recipient recipient) { this.messageName = messageName; this.exclude = exclude; this.recipient = recipient; } public FilterEntry(String messageName, boolean exclude, String transport, String name) { this(messageName, exclude, new Recipient(transport, name)); }

Target:
public FilterEntry(String eventName, boolean exclude, String transport, String name) { this(eventName, exclude, new Recipient(transport, name)); }
Source:
public FilterEntry(String eventName, boolean exclude, String transport, String name) { this.eventName = eventName; this.exclude = exclude; if (transport != null){ recipient = new Recipient(transport, name); } else { recipient = null; START } END } I sent you alternate cleaner solution for this. once again, please separate between the parsing and the data.

Target:
public FilterEntry(String eventName, boolean exclude, String transport, String name) { this.eventName = eventName; this.exclude = exclude; this.recipient = new Recipient(transport, name); }