Program: 126451
Project: 126451
Buggy source:
@Override public ConnectionItem openMetadataConnection(boolean creation,IRepositoryNode repoNode,INode node){
  RepositoryNode realNode;
  if (repoNode instanceof RepositoryNode) {
    realNode=(RepositoryNode)repoNode;
    IWizard relatedWizard=null;
    ERepositoryObjectType objectType=null;
    if (creation) {
      objectType=realNode.getContentType();
    }
 else {
      objectType=realNode.getObjectType();
    }
    if (objectType.equals(ERepositoryObjectType.METADATA_CONNECTIONS)) {
      relatedWizard=new DatabaseWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_DELIMITED)) {
      relatedWizard=new DelimitedFileWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_LDIF)) {
      relatedWizard=new LdifFileWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_POSITIONAL)) {
      relatedWizard=new FilePositionalWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_REGEXP)) {
      relatedWizard=new RegexpFileWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_XML)) {
      relatedWizard=new XmlFileWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_GENERIC_SCHEMA)) {
      relatedWizard=new GenericSchemaWizard(PlatformUI.getWorkbench(),creation,realNode,null,true);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_WSDL_SCHEMA)) {
      relatedWizard=new WSDLSchemaWizard(PlatformUI.getWorkbench(),creation,realNode,null,false);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_LDAP_SCHEMA)) {
      relatedWizard=new LDAPSchemaWizard(PlatformUI.getWorkbench(),creation,realNode,null,false);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_EXCEL)) {
      relatedWizard=new ExcelFileWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA)) {
      relatedWizard=new SalesforceSchemaWizard(PlatformUI.getWorkbench(),creation,realNode,null,false);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_EBCDIC)) {
      if (PluginChecker.isEBCDICPluginLoaded()) {
        IProviderService iebcdicService=GlobalServiceRegister.getDefault().findService("String_Node_Str");
        if (iebcdicService != null) {
          relatedWizard=iebcdicService.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_HL7)) {
      if (PluginChecker.isHL7PluginLoaded()) {
        IProviderService service=GlobalServiceRegister.getDefault().findService("String_Node_Str");
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_MDMCONNECTION)) {
      if (PluginChecker.isMDMPluginLoaded()) {
        IMDMProviderService service=(IMDMProviderService)GlobalServiceRegister.getDefault().getService(IMDMProviderService.class);
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_SAPCONNECTIONS)) {
      if (PluginChecker.isSAPWizardPluginLoaded()) {
        IProviderService service=GlobalServiceRegister.getDefault().findService("String_Node_Str");
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_HEADER_FOOTER)) {
      if (GlobalServiceRegister.getDefault().isServiceRegistered(IHeaderFooterProviderService.class)) {
        IHeaderFooterProviderService service=(IHeaderFooterProviderService)GlobalServiceRegister.getDefault().getService(IHeaderFooterProviderService.class);
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_FTP)) {
      if (PluginChecker.isFTPPluginLoaded()) {
        IProviderService service=GlobalServiceRegister.getDefault().findService("String_Node_Str");
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_BRMS)) {
      if (PluginChecker.isBRMSPluginLoaded()) {
        IProviderService service=GlobalServiceRegister.getDefault().findService("String_Node_Str");
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
    if (relatedWizard == null) {
      for (      IRepositoryContentHandler handler : RepositoryContentManager.getHandlers()) {
        if (handler.isRepObjType(objectType)) {
          relatedWizard=handler.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
          if (relatedWizard != null) {
            break;
          }
        }
      }
    }
    boolean changed=false;
    if (relatedWizard != null) {
      ConnectionItem connItem=null;
      if (node != null && relatedWizard instanceof RepositoryWizard) {
        connItem=((RepositoryWizard)relatedWizard).getConnectionItem();
        if (connItem != null) {
          changed=ComponentToRepositoryProperty.setValue(connItem.getConnection(),node);
        }
      }
      if (connItem != null && changed) {
        WizardDialog wizardDialog=new WizardDialog(Display.getCurrent().getActiveShell(),relatedWizard);
        wizardDialog.setPageSize(600,540);
        wizardDialog.create();
        if (wizardDialog.open() == wizardDialog.OK) {
          return connItem;
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public ConnectionItem openMetadataConnection(boolean creation,IRepositoryNode repoNode,INode node){
  RepositoryNode realNode;
  if (repoNode instanceof RepositoryNode) {
    realNode=(RepositoryNode)repoNode;
    IWizard relatedWizard=null;
    ERepositoryObjectType objectType=null;
    if (creation) {
      objectType=realNode.getContentType();
    }
 else {
      objectType=realNode.getObjectType();
    }
    if (objectType.equals(ERepositoryObjectType.METADATA_CONNECTIONS)) {
      relatedWizard=new DatabaseWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_DELIMITED)) {
      relatedWizard=new DelimitedFileWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_LDIF)) {
      relatedWizard=new LdifFileWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_POSITIONAL)) {
      relatedWizard=new FilePositionalWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_REGEXP)) {
      relatedWizard=new RegexpFileWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_XML)) {
      relatedWizard=new XmlFileWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_GENERIC_SCHEMA)) {
      relatedWizard=new GenericSchemaWizard(PlatformUI.getWorkbench(),creation,realNode,null,true);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_WSDL_SCHEMA)) {
      relatedWizard=new WSDLSchemaWizard(PlatformUI.getWorkbench(),creation,realNode,null,false);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_LDAP_SCHEMA)) {
      relatedWizard=new LDAPSchemaWizard(PlatformUI.getWorkbench(),creation,realNode,null,false);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_EXCEL)) {
      relatedWizard=new ExcelFileWizard(PlatformUI.getWorkbench(),creation,realNode,null);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA)) {
      relatedWizard=new SalesforceSchemaWizard(PlatformUI.getWorkbench(),creation,realNode,null,false);
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_EBCDIC)) {
      if (PluginChecker.isEBCDICPluginLoaded()) {
        IProviderService iebcdicService=GlobalServiceRegister.getDefault().findService("String_Node_Str");
        if (iebcdicService != null) {
          relatedWizard=iebcdicService.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_HL7)) {
      if (PluginChecker.isHL7PluginLoaded()) {
        IProviderService service=GlobalServiceRegister.getDefault().findService("String_Node_Str");
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_MDMCONNECTION)) {
      if (PluginChecker.isMDMPluginLoaded()) {
        IMDMProviderService service=(IMDMProviderService)GlobalServiceRegister.getDefault().getService(IMDMProviderService.class);
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_SAPCONNECTIONS)) {
      if (PluginChecker.isSAPWizardPluginLoaded()) {
        IProviderService service=GlobalServiceRegister.getDefault().findService("String_Node_Str");
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_HEADER_FOOTER)) {
      if (GlobalServiceRegister.getDefault().isServiceRegistered(IHeaderFooterProviderService.class)) {
        IHeaderFooterProviderService service=(IHeaderFooterProviderService)GlobalServiceRegister.getDefault().getService(IHeaderFooterProviderService.class);
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_FTP)) {
      if (PluginChecker.isFTPPluginLoaded()) {
        IProviderService service=GlobalServiceRegister.getDefault().findService("String_Node_Str");
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_FILE_BRMS)) {
      if (PluginChecker.isBRMSPluginLoaded()) {
        IProviderService service=GlobalServiceRegister.getDefault().findService("String_Node_Str");
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
    if (relatedWizard == null) {
      for (      IRepositoryContentHandler handler : RepositoryContentManager.getHandlers()) {
        if (handler.isRepObjType(objectType)) {
          relatedWizard=handler.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
          if (relatedWizard != null) {
            break;
          }
        }
      }
    }
    boolean changed=false;
    if (relatedWizard != null) {
      ConnectionItem connItem=null;
      if (node != null && relatedWizard instanceof RepositoryWizard) {
        connItem=((RepositoryWizard)relatedWizard).getConnectionItem();
        if (connItem != null) {
          changed=ComponentToRepositoryProperty.setValue(connItem,node);
        }
      }
      if (connItem != null && changed) {
        WizardDialog wizardDialog=new WizardDialog(Display.getCurrent().getActiveShell(),relatedWizard);
        wizardDialog.setPageSize(600,540);
        wizardDialog.create();
        if (wizardDialog.open() == wizardDialog.OK) {
          return connItem;
        }
      }
    }
  }
  return null;
}