Program: 129675
Project: 129675
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.
 */
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) {
    IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
    try {
      if (creation) {
        String nextId=factory.getNextId();
        connectionProperty.setId(nextId);
        connectionProperty.setLabel(connectionProperty.getDisplayName());
        factory.create(connectionItem,propertiesWizardPage.getDestinationPath());
      }
 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);
        factory.save(connectionItem);
        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=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();
    try {
      if (creation) {
        String nextId=factory.getNextId();
        connectionProperty.setId(nextId);
        connectionProperty.setLabel(connectionProperty.getDisplayName());
        final IWorkspaceRunnable op=new IWorkspaceRunnable(){
          public void run(          IProgressMonitor monitor) throws CoreException {
            try {
              factory.create(connectionItem,propertiesWizardPage.getDestinationPath());
            }
 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 {
        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);
        final IWorkspaceRunnable op=new IWorkspaceRunnable(){
          public void run(          IProgressMonitor monitor) throws CoreException {
            try {
              factory.save(connectionItem);
            }
 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) {
        }
        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;
  }
}