Program: 129173
Project: 129173
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=false;
  IWizardPage finalPage=getCurrentPage();
  if (finalPage == null) {
    finalPage=propertiesWizardPage;
  }
  deleteTemFile();
  if (connection.isInputModel()) {
    if (finalPage instanceof XmlFileWizardPage) {
      int step=((XmlFileWizardPage)finalPage).step;
      if (step == 2) {
        formIsPerformed=finalPage.isPageComplete();
        if (formIsPerformed) {
          List schemas=connection.getSchema();
          Set tables=ConnectionHelper.getTables(connection);
          if (!schemas.isEmpty() && !tables.isEmpty()) {
            XmlXPathLoopDescriptor currentSchema=(XmlXPathLoopDescriptor)schemas.get(0);
            MetadataTable currentTable=(MetadataTable)tables.toArray(new MetadataTable[0])[0];
            if (!currentSchema.getAbsoluteXPathQuery().equals(oldAbstractQueryPath)) {
              resetMetadata(currentSchema.getSchemaTargets(),true);
            }
 else {
              resetMetadata(currentSchema.getSchemaTargets(),false);
            }
          }
        }
      }
 else {
        formIsPerformed=finalPage.isPageComplete();
      }
    }
 else {
      formIsPerformed=finalPage.isPageComplete();
    }
  }
 else {
    formIsPerformed=finalPage.isPageComplete();
  }
  if (formIsPerformed) {
    final IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
    final IWorkspaceRunnable op=new IWorkspaceRunnable(){
      public void run(      IProgressMonitor monitor) throws CoreException {
        PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable(){
          @Override public void run(){
            if (creation) {
              String nextId=factory.getNextId();
              connectionProperty.setId(nextId);
              connectionProperty.setLabel(connectionProperty.getDisplayName());
              final RepositoryWorkUnit<Object> workUnit=new RepositoryWorkUnit<Object>("String_Node_Str",this){
                @Override protected void run() throws LoginException, PersistenceException {
                  factory.create(connectionItem,propertiesWizardPage.getDestinationPath());
                }
              }
;
              workUnit.setAvoidUnloadResources(true);
              factory.executeRepositoryWorkUnit(workUnit);
            }
 else {
              connectionProperty.setLabel(connectionProperty.getDisplayName());
              Map<String,SchemaTarget> schemaTargetMap=new HashMap<String,SchemaTarget>();
              EList<XmlXPathLoopDescriptor> schema=connection.getSchema();
              if (schema != null && schema.size() > 0) {
                XmlXPathLoopDescriptor xmlXPathLoopDescriptor=schema.get(0);
                if (xmlXPathLoopDescriptor != null) {
                  EList<SchemaTarget> schemaTargets=xmlXPathLoopDescriptor.getSchemaTargets();
                  if (schemaTargets != null && schemaTargets.size() > 0) {
                    for (                    SchemaTarget schemaTarget : schemaTargets) {
                      schemaTargetMap.put(schemaTarget.getTagName(),schemaTarget);
                    }
                  }
                }
              }
              Map<String,MetadataColumn> columnsMap=new HashMap<String,MetadataColumn>();
              MetadataTable[] tables=ConnectionHelper.getTables(connectionItem.getConnection()).toArray(new MetadataTable[0]);
              for (              MetadataTable table : tables) {
                EList<MetadataColumn> columns=table.getColumns();
                Iterator<MetadataColumn> columnsIter=columns.iterator();
                while (columnsIter.hasNext()) {
                  MetadataColumn column=columnsIter.next();
                  if (schemaTargetMap.get(column.getLabel()) == null) {
                    columnsIter.remove();
                  }
 else {
                    columnsMap.put(column.getLabel(),column);
                  }
                }
              }
              boolean hasAddedColumns=false;
              Iterator<Entry<String,SchemaTarget>> schemaTargetIter=schemaTargetMap.entrySet().iterator();
              while (schemaTargetIter.hasNext()) {
                Map.Entry<String,SchemaTarget> entry=schemaTargetIter.next();
                String key=entry.getKey();
                if (columnsMap.get(key) == null) {
                  hasAddedColumns=true;
                  break;
                }
              }
              if (hasAddedColumns) {
                MessageDialog.openInformation(getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
              }
              RepositoryUpdateManager.updateFileConnection(connectionItem);
              boolean isModified=propertiesWizardPage.isNameModifiedByUser();
              if (isModified) {
                if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
                  IDesignerCoreService service=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
                  if (service != null) {
                    service.refreshComponentView(connectionItem);
                  }
                }
              }
              final RepositoryWorkUnit<Object> workUnit=new RepositoryWorkUnit<Object>("String_Node_Str",this){
                @Override protected void run() throws LoginException, PersistenceException {
                  factory.save(connectionItem);
                }
              }
;
              workUnit.setAvoidUnloadResources(true);
              factory.executeRepositoryWorkUnit(workUnit);
              closeLockStrategy();
            }
            final RepositoryWorkUnit<Object> workUnit=new RepositoryWorkUnit<Object>("String_Node_Str",this){
              @Override protected void run() throws LoginException, PersistenceException {
                ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
              }
            }
;
            workUnit.setAvoidUnloadResources(true);
            factory.executeRepositoryWorkUnit(workUnit);
          }
        }
);
      }
    }
;
    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) {
    }
    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=false;
  IWizardPage finalPage=getCurrentPage();
  if (finalPage == null) {
    finalPage=propertiesWizardPage;
  }
  deleteTemFile();
  if (connection.isInputModel()) {
    if (finalPage instanceof XmlFileWizardPage) {
      int step=((XmlFileWizardPage)finalPage).step;
      if (step == 2) {
        formIsPerformed=finalPage.isPageComplete();
        if (formIsPerformed) {
          List schemas=connection.getSchema();
          Set tables=ConnectionHelper.getTables(connection);
          if (!schemas.isEmpty() && !tables.isEmpty()) {
            XmlXPathLoopDescriptor currentSchema=(XmlXPathLoopDescriptor)schemas.get(0);
            MetadataTable currentTable=(MetadataTable)tables.toArray(new MetadataTable[0])[0];
            if (!currentSchema.getAbsoluteXPathQuery().equals(oldAbstractQueryPath)) {
              resetMetadata(currentSchema.getSchemaTargets(),true);
            }
 else {
              resetMetadata(currentSchema.getSchemaTargets(),false);
            }
          }
        }
      }
 else {
        formIsPerformed=finalPage.isPageComplete();
      }
    }
 else {
      formIsPerformed=finalPage.isPageComplete();
    }
  }
 else {
    formIsPerformed=finalPage.isPageComplete();
  }
  if (formIsPerformed) {
    final IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
    final IWorkspaceRunnable op=new IWorkspaceRunnable(){
      public void run(      IProgressMonitor monitor) throws CoreException {
        PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable(){
          @Override public void run(){
            if (creation) {
              String nextId=factory.getNextId();
              connectionProperty.setId(nextId);
              connectionProperty.setLabel(connectionProperty.getDisplayName());
              final RepositoryWorkUnit<Object> workUnit=new RepositoryWorkUnit<Object>("String_Node_Str",this){
                @Override protected void run() throws LoginException, PersistenceException {
                  factory.create(connectionItem,propertiesWizardPage.getDestinationPath());
                }
              }
;
              workUnit.setAvoidUnloadResources(true);
              factory.executeRepositoryWorkUnit(workUnit);
            }
 else {
              connectionProperty.setLabel(connectionProperty.getDisplayName());
              Map<String,SchemaTarget> schemaTargetMap=new HashMap<String,SchemaTarget>();
              EList<XmlXPathLoopDescriptor> schema=connection.getSchema();
              if (schema != null && schema.size() > 0) {
                XmlXPathLoopDescriptor xmlXPathLoopDescriptor=schema.get(0);
                if (xmlXPathLoopDescriptor != null) {
                  EList<SchemaTarget> schemaTargets=xmlXPathLoopDescriptor.getSchemaTargets();
                  if (schemaTargets != null && schemaTargets.size() > 0) {
                    for (                    SchemaTarget schemaTarget : schemaTargets) {
                      schemaTargetMap.put(schemaTarget.getTagName(),schemaTarget);
                    }
                  }
                }
              }
              Map<String,MetadataColumn> columnsMap=new HashMap<String,MetadataColumn>();
              MetadataTable[] tables=ConnectionHelper.getTables(connectionItem.getConnection()).toArray(new MetadataTable[0]);
              for (              MetadataTable table : tables) {
                EList<MetadataColumn> columns=table.getColumns();
                Iterator<MetadataColumn> columnsIter=columns.iterator();
                while (columnsIter.hasNext()) {
                  MetadataColumn column=columnsIter.next();
                  if (schemaTargetMap.get(column.getLabel()) == null) {
                    columnsIter.remove();
                  }
 else {
                    columnsMap.put(column.getLabel(),column);
                  }
                }
              }
              boolean hasAddedColumns=false;
              Iterator<Entry<String,SchemaTarget>> schemaTargetIter=schemaTargetMap.entrySet().iterator();
              while (schemaTargetIter.hasNext()) {
                Map.Entry<String,SchemaTarget> entry=schemaTargetIter.next();
                String key=entry.getKey();
                if (columnsMap.get(key) == null) {
                  hasAddedColumns=true;
                  break;
                }
              }
              if (hasAddedColumns) {
                MessageDialog.openInformation(getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
              }
              RepositoryUpdateManager.updateFileConnection(connectionItem);
              refreshInFinish(propertiesWizardPage.isNameModifiedByUser());
              final RepositoryWorkUnit<Object> workUnit=new RepositoryWorkUnit<Object>("String_Node_Str",this){
                @Override protected void run() throws LoginException, PersistenceException {
                  factory.save(connectionItem);
                }
              }
;
              workUnit.setAvoidUnloadResources(true);
              factory.executeRepositoryWorkUnit(workUnit);
              closeLockStrategy();
            }
            final RepositoryWorkUnit<Object> workUnit=new RepositoryWorkUnit<Object>("String_Node_Str",this){
              @Override protected void run() throws LoginException, PersistenceException {
                ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
              }
            }
;
            workUnit.setAvoidUnloadResources(true);
            factory.executeRepositoryWorkUnit(workUnit);
          }
        }
);
      }
    }
;
    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) {
    }
    return true;
  }
 else {
    return false;
  }
}