Source:
<code>public void importFileStorageAddDomain(ArrayList<StorageDomain> domains) { StorageDomain sdToAdd = Linq.firstOrDefault(domains); StorageDomainStatic sdsToAdd = sdToAdd.getStorageStaticData(); StorageDomainManagementParameter params = new StorageDomainManagementParameter(sdsToAdd); params.setVdsId(hostId); Frontend.getInstance().runAction(VdcActionType.AddExistingFileStorageDomain, params, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { Object[] array = (Object[]) result.getState(); StorageListModel storageListModel = (StorageListModel) array[0]; StorageDomain sdToAdd1 = (StorageDomain) array[1]; VdcReturnValueBase returnVal = result.getReturnValue(); boolean success = returnVal != null && returnVal.getSucceeded(); if (success) { StorageModel model = (StorageModel) storageListModel.getWindow(); StoragePool dataCenter = model.getDataCenter().getSelectedItem(); if (!dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) { storageListModel.attachStorageToDataCenter(sdToAdd1.getId(), dataCenter.getId(), model.getActivateDomain().getEntity()); onFinish(storageListModel.context, true, storageListModel.storageModel, null); } else { postImportFileStorage(storageListModel.context, true, storageListModel.storageModel, null); } } else { postImportFileStorage(storageListModel.context, false, storageListModel.storageModel, ""); <START> Frontend.getInstance().runAction(VdcActionType.RemoveStorageServerConnection, <END> new StorageServerConnectionParametersBase(fileConnection, hostId), null, this); } } }, new Object[] {this, sdToAdd}); }</code><technical_language>call 'cleanConnection' method</technical_language>

Target:
public void importFileStorageAddDomain(ArrayList<StorageDomain> domains) { StorageDomain sdToAdd = Linq.firstOrDefault(domains); StorageDomainStatic sdsToAdd = sdToAdd.getStorageStaticData(); StorageDomainManagementParameter params = new StorageDomainManagementParameter(sdsToAdd); params.setVdsId(hostId); Frontend.getInstance().runAction(VdcActionType.AddExistingFileStorageDomain, params, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { Object[] array = (Object[]) result.getState(); StorageListModel storageListModel = (StorageListModel) array[0]; StorageDomain sdToAdd1 = (StorageDomain) array[1]; VdcReturnValueBase returnVal = result.getReturnValue(); boolean success = returnVal != null && returnVal.getSucceeded(); if (success) { StorageModel model = (StorageModel) storageListModel.getWindow(); StoragePool dataCenter = model.getDataCenter().getSelectedItem(); if (!dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) { storageListModel.attachStorageToDataCenter(sdToAdd1.getId(), dataCenter.getId(), model.getActivateDomain().getEntity()); onFinish(storageListModel.context, true, storageListModel.storageModel, null); } else { postImportFileStorage(storageListModel.context, true, storageListModel.storageModel, null); } } else { postImportFileStorage(storageListModel.context, false, storageListModel.storageModel, ""); storageListModel.cleanConnection(fileConnection, hostId); } } }, new Object[] {this, sdToAdd}); }