Program: 147717
Project: 147717
Buggy source:
public void runWithType(ERepositoryObjectType type){
  DeployAllDialog dialog=new DeployAllDialog(getShell(),type);
  if (dialog.open() == IDialogConstants.OK_ID) {
    List<AbstractDeployCommand> selectededCommands=dialog.getSelectedCommands();
    if (selectededCommands.size() >= 0) {
      DeployService deployService=DeployService.getInstance();
      deployViewObject=deployService.getDeployViewObject(selectededCommands);
      IModelValidateResult validateResult=deployService.validateModel(deployViewObject);
      int selectedButton=validateResult.getSelectedButton();
      if (selectedButton == IModelValidationService.BUTTON_CANCEL) {
        return;
      }
      List<IRepositoryViewObject> validObjects=validateResult.getValidObjects(selectedButton);
      List<IRepositoryViewObject> invalidObjects=validateResult.getInvalidObjects(selectedButton);
      MDMServerDef serverDef=dialog.getServerDef();
      ConsistencyCheckResult consistencyCheckResult=deployService.checkConsistency(serverDef,validObjects);
      if (consistencyCheckResult == null || consistencyCheckResult.isCanceled()) {
        return;
      }
 else {
        validObjects=consistencyCheckResult.getToDeployObjects();
      }
      deployService.removeInvalidCommands(invalidObjects,selectededCommands);
      deployService.removeInvalidCommands(consistencyCheckResult.getToSkipObjects(),selectededCommands);
      LockedDirtyObjectDialog lockDirtyDialog=new LockedDirtyObjectDialog(getShell(),Messages.AbstractDeployAction_promptToSaveEditors,validObjects);
      if (lockDirtyDialog.needShowDialog() && lockDirtyDialog.open() == IDialogConstants.CANCEL_ID) {
        return;
      }
      lockDirtyDialog.saveDirtyObjects();
      IStatus status=deployService.runCommands(selectededCommands,serverDef);
      try {
        deployService.updateServerConsistencyStatus(serverDef,status);
      }
 catch (      XtentisException e) {
        log.error(e.getMessage(),e);
      }
      deployService.generateValidationFailedDeployStatus(status,invalidObjects);
      deployService.generateConsistencyCancelDeployStatus(status,consistencyCheckResult.getToSkipObjects());
      updateChangedStatus(status);
      if (status.isMultiStatus()) {
        showDeployStatus(status);
      }
      updateLastServer(status,new NullProgressMonitor());
    }
  }
}

Fixed version (ground truth):
public void runWithType(ERepositoryObjectType type){
  DeployAllDialog dialog=new DeployAllDialog(getShell(),type);
  if (dialog.open() == IDialogConstants.OK_ID) {
    List<AbstractDeployCommand> selectededCommands=dialog.getSelectedCommands();
    if (selectededCommands.size() >= 0) {
      DeployService deployService=DeployService.getInstance();
      deployViewObject=deployService.getDeployViewObject(selectededCommands);
      IModelValidateResult validateResult=deployService.validateModel(deployViewObject);
      int selectedButton=validateResult.getSelectedButton();
      if (selectedButton == IModelValidationService.BUTTON_CANCEL) {
        return;
      }
      List<IRepositoryViewObject> validObjects=validateResult.getValidObjects(selectedButton);
      List<IRepositoryViewObject> invalidObjects=validateResult.getInvalidObjects(selectedButton);
      MDMServerDef serverDef=dialog.getServerDef();
      ConsistencyCheckResult consistencyCheckResult=deployService.checkConsistency(serverDef,validObjects);
      if (consistencyCheckResult == null || consistencyCheckResult.isCanceled()) {
        return;
      }
 else {
        validObjects=consistencyCheckResult.getToDeployObjects();
      }
      deployService.removeInvalidCommands(invalidObjects,selectededCommands);
      deployService.removeInvalidCommands(consistencyCheckResult.getToSkipObjects(),selectededCommands);
      LockedDirtyObjectDialog lockDirtyDialog=new LockedDirtyObjectDialog(getShell(),Messages.AbstractDeployAction_promptToSaveEditors,validObjects);
      if (lockDirtyDialog.needShowDialog() && lockDirtyDialog.open() == IDialogConstants.CANCEL_ID) {
        return;
      }
      lockDirtyDialog.saveDirtyObjects();
      IStatus status=deployService.runCommands(selectededCommands,serverDef);
      try {
        deployService.updateServerConsistencyStatus(serverDef,status);
      }
 catch (      XtentisException e) {
        log.error(e.getMessage(),e);
      }
catch (      RemoteException e) {
        log.error(e.getMessage(),e);
      }
      deployService.generateValidationFailedDeployStatus(status,invalidObjects);
      deployService.generateConsistencyCancelDeployStatus(status,consistencyCheckResult.getToSkipObjects());
      updateChangedStatus(status);
      if (status.isMultiStatus()) {
        showDeployStatus(status);
      }
      updateLastServer(status,new NullProgressMonitor());
    }
  }
}