Program: 126844
Project: 126844
Buggy source:
/** 
 * This method determine if the 'Finish' button is enable This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using wizard as execution context.
 */
@Override public boolean performFinish(){
  boolean formIsPerformed=contextManager.getListContext().size() != 0;
  if (formIsPerformed) {
    try {
      if (creation) {
        String nextId=factory.getNextId();
        contextProperty.setId(nextId);
        contextProperty.setLabel(contextProperty.getDisplayName());
        contextManager.saveToEmf(contextItem.getContext());
        contextItem.setDefaultContext(contextManager.getDefaultContext().getName());
        final IPath path=contextWizardPage0.getDestinationPath();
        final IWorkspaceRunnable op=new IWorkspaceRunnable(){
          public void run(          IProgressMonitor monitor) throws CoreException {
            try {
              factory.create(contextItem,path);
            }
 catch (            PersistenceException e) {
              ExceptionHandler.process(e);
            }
          }
        }
;
        IRunnableWithProgress iRunnableWithProgress=new IRunnableWithProgress(){
          public void run(          IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            IWorkspace workspace=ResourcesPlugin.getWorkspace();
            try {
              ISchedulingRule schedulingRule=workspace.getRoot();
              workspace.run(op,schedulingRule,IWorkspace.AVOID_UPDATE,monitor);
            }
 catch (            CoreException e) {
              throw new InvocationTargetException(e);
            }
          }
        }
;
        try {
          new ProgressMonitorDialog(null).run(true,true,iRunnableWithProgress);
        }
 catch (        InvocationTargetException e) {
          ExceptionHandler.process(e);
        }
catch (        InterruptedException e) {
        }
      }
 else {
        contextProperty.setLabel(contextProperty.getDisplayName());
        contextItem.getContext().clear();
        contextManager.saveToEmf(contextItem.getContext());
        contextItem.setDefaultContext(contextManager.getDefaultContext().getName());
        if (contextManager instanceof JobContextManager) {
          JobContextManager manager=(JobContextManager)contextManager;
          if (manager.isModified()) {
            Map<String,String> contextGroupRenamedMap=new HashMap<String,String>();
            Map<IContext,String> renameGroupContextMap=manager.getRenameGroupContext();
            for (            IContext context : renameGroupContextMap.keySet()) {
              String oldContextGroupName=renameGroupContextMap.get(context);
              contextGroupRenamedMap.put(oldContextGroupName,context.getName());
            }
            RepositoryUpdateManager.updateContext((JobContextManager)contextManager,contextItem);
            if (!contextGroupRenamedMap.isEmpty()) {
              SwitchContextGroupNameImpl.getInstance().updateContextForConnectionItems(contextGroupRenamedMap,contextItem);
            }
          }
        }
        final IWorkspaceRunnable op=new IWorkspaceRunnable(){
          public void run(          IProgressMonitor monitor) throws CoreException {
            try {
              factory.save(contextItem);
            }
 catch (            PersistenceException e) {
              ExceptionHandler.process(e);
            }
          }
        }
;
        IRunnableWithProgress iRunnableWithProgress=new IRunnableWithProgress(){
          public void run(          IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            IWorkspace workspace=ResourcesPlugin.getWorkspace();
            try {
              ISchedulingRule schedulingRule=workspace.getRoot();
              workspace.run(op,schedulingRule,IWorkspace.AVOID_UPDATE,monitor);
            }
 catch (            CoreException e) {
              throw new InvocationTargetException(e);
            }
          }
        }
;
        try {
          new ProgressMonitorDialog(null).run(true,true,iRunnableWithProgress);
        }
 catch (        InvocationTargetException e) {
          ExceptionHandler.process(e);
        }
catch (        InterruptedException e) {
        }
        updateRelatedView();
      }
      closeLockStrategy();
      ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
    }
 catch (    PersistenceException e) {
      String detailError=e.toString();
      new ErrorDialogWidthDetailArea(getShell(),PID,Messages.getString("String_Node_Str"),detailError);
      log.error(Messages.getString("String_Node_Str") + "String_Node_Str" + detailError);
      return false;
    }
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * This method determine if the 'Finish' button is enable This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using wizard as execution context.
 */
@Override public boolean performFinish(){
  boolean formIsPerformed=contextManager.getListContext().size() != 0;
  if (formIsPerformed) {
    try {
      if (creation) {
        String nextId=factory.getNextId();
        contextProperty.setId(nextId);
        contextManager.saveToEmf(contextItem.getContext());
        contextItem.setDefaultContext(contextManager.getDefaultContext().getName());
        final IPath path=contextWizardPage0.getDestinationPath();
        final IWorkspaceRunnable op=new IWorkspaceRunnable(){
          public void run(          IProgressMonitor monitor) throws CoreException {
            try {
              factory.create(contextItem,path);
            }
 catch (            PersistenceException e) {
              ExceptionHandler.process(e);
            }
          }
        }
;
        IRunnableWithProgress iRunnableWithProgress=new IRunnableWithProgress(){
          public void run(          IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            IWorkspace workspace=ResourcesPlugin.getWorkspace();
            try {
              ISchedulingRule schedulingRule=workspace.getRoot();
              workspace.run(op,schedulingRule,IWorkspace.AVOID_UPDATE,monitor);
            }
 catch (            CoreException e) {
              throw new InvocationTargetException(e);
            }
          }
        }
;
        try {
          new ProgressMonitorDialog(null).run(true,true,iRunnableWithProgress);
        }
 catch (        InvocationTargetException e) {
          ExceptionHandler.process(e);
        }
catch (        InterruptedException e) {
        }
      }
 else {
        contextItem.getContext().clear();
        contextManager.saveToEmf(contextItem.getContext());
        contextItem.setDefaultContext(contextManager.getDefaultContext().getName());
        if (contextManager instanceof JobContextManager) {
          JobContextManager manager=(JobContextManager)contextManager;
          if (manager.isModified()) {
            Map<String,String> contextGroupRenamedMap=new HashMap<String,String>();
            Map<IContext,String> renameGroupContextMap=manager.getRenameGroupContext();
            for (            IContext context : renameGroupContextMap.keySet()) {
              String oldContextGroupName=renameGroupContextMap.get(context);
              contextGroupRenamedMap.put(oldContextGroupName,context.getName());
            }
            RepositoryUpdateManager.updateContext((JobContextManager)contextManager,contextItem);
            if (!contextGroupRenamedMap.isEmpty()) {
              SwitchContextGroupNameImpl.getInstance().updateContextForConnectionItems(contextGroupRenamedMap,contextItem);
            }
          }
        }
        final IWorkspaceRunnable op=new IWorkspaceRunnable(){
          public void run(          IProgressMonitor monitor) throws CoreException {
            try {
              factory.save(contextItem);
            }
 catch (            PersistenceException e) {
              ExceptionHandler.process(e);
            }
          }
        }
;
        IRunnableWithProgress iRunnableWithProgress=new IRunnableWithProgress(){
          public void run(          IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            IWorkspace workspace=ResourcesPlugin.getWorkspace();
            try {
              ISchedulingRule schedulingRule=workspace.getRoot();
              workspace.run(op,schedulingRule,IWorkspace.AVOID_UPDATE,monitor);
            }
 catch (            CoreException e) {
              throw new InvocationTargetException(e);
            }
          }
        }
;
        try {
          new ProgressMonitorDialog(null).run(true,true,iRunnableWithProgress);
        }
 catch (        InvocationTargetException e) {
          ExceptionHandler.process(e);
        }
catch (        InterruptedException e) {
        }
        updateRelatedView();
      }
      closeLockStrategy();
      ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
    }
 catch (    PersistenceException e) {
      String detailError=e.toString();
      new ErrorDialogWidthDetailArea(getShell(),PID,Messages.getString("String_Node_Str"),detailError);
      log.error(Messages.getString("String_Node_Str") + "String_Node_Str" + detailError);
      return false;
    }
    return true;
  }
 else {
    return false;
  }
}