Source:
<code>private void prepare2() { PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment; EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext(); HostListModel model = enlistmentContext.getModel(); ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow(); StoragePool candidate = configureModel.getCandidateDataCenter(); DataCenterModel dataCenterModel = configureModel.getDataCenter(); String dataCenterName = (String) dataCenterModel.getName().getEntity(); <START> if (candidate == null || (candidate.getname() != null && !StringHelper.stringsEqual(candidate.getname(), dataCenterName))) { <END> StoragePool dataCenter = context.dataCenterFoundByName; if (dataCenter != null) { enlistmentContext.setDataCenterId(dataCenter.getId()); context.enlistment = null; enlistment.Prepared(); } else { dataCenter = new StoragePool(); dataCenter.setname(dataCenterName); dataCenter.setdescription((String) dataCenterModel.getDescription().getEntity()); dataCenter.setstorage_pool_type((StorageType) dataCenterModel.getStorageTypeList().getSelectedItem()); dataCenter.setcompatibility_version((Version) dataCenterModel.getVersion().getSelectedItem()); StoragePoolManagementParameter parameters = new StoragePoolManagementParameter(dataCenter); parameters.setCorrelationId(getCorrelationId()); Frontend.RunAction(VdcActionType.AddEmptyStoragePool, parameters, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { VdcReturnValueBase returnValue = result.getReturnValue(); context.addDataCenterReturnValue = returnValue; prepare3(); } }); } } else { enlistmentContext.setDataCenterId(configureModel.getDataCenter().getDataCenterId().getValue()); context.enlistment = null; enlistment.Prepared(); } }</code><technical_language>candidate.getname() != null is redundant</technical_language>

Target:
private void prepare2() { PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment; EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext(); HostListModel model = enlistmentContext.getModel(); ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow(); StoragePool candidate = configureModel.getCandidateDataCenter(); DataCenterModel dataCenterModel = configureModel.getDataCenter(); String dataCenterName = (String) dataCenterModel.getName().getEntity(); if (candidate == null || !StringHelper.stringsEqual(candidate.getname(), dataCenterName)) { StoragePool dataCenter = context.dataCenterFoundByName; if (dataCenter != null) { enlistmentContext.setDataCenterId(dataCenter.getId()); context.enlistment = null; enlistment.Prepared(); } else { dataCenter = new StoragePool(); dataCenter.setname(dataCenterName); dataCenter.setdescription((String) dataCenterModel.getDescription().getEntity()); dataCenter.setstorage_pool_type((StorageType) dataCenterModel.getStorageTypeList().getSelectedItem()); dataCenter.setcompatibility_version((Version) dataCenterModel.getVersion().getSelectedItem()); StoragePoolManagementParameter parameters = new StoragePoolManagementParameter(dataCenter); parameters.setCorrelationId(getCorrelationId()); Frontend.RunAction(VdcActionType.AddEmptyStoragePool, parameters, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { VdcReturnValueBase returnValue = result.getReturnValue(); context.addDataCenterReturnValue = returnValue; prepare3(); } }); } } else { enlistmentContext.setDataCenterId(configureModel.getDataCenter().getDataCenterId().getValue()); context.enlistment = null; enlistment.Prepared(); } }