Program: 129515
Project: 129515
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=(IProviderService)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=(IProviderService)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=(IProviderService)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=(IProviderService)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=(IProviderService)GlobalServiceRegister.getDefault().findService("String_Node_Str");
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
    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,500);
        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=(IProviderService)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=(IProviderService)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);
          if (node != null && "String_Node_Str".equals(node.getComponent().getName())) {
            if (relatedWizard != null && relatedWizard instanceof RepositoryWizard) {
              ConnectionItem connItem=((RepositoryWizard)relatedWizard).getConnectionItem();
              if (connItem != null && connItem instanceof MDMConnectionItem) {
                org.talend.core.model.metadata.builder.connection.Connection connection=((MDMConnectionItem)connItem).getConnection();
                if (connection != null && connection instanceof MDMConnection) {
                  if (oldMdmConValues.containsKey("String_Node_Str") && oldMdmConValues.get("String_Node_Str") != null) {
                    ((MDMConnection)connection).setUsername(oldMdmConValues.get("String_Node_Str").toString());
                    ((MDMConnection)connection).setPassword(oldMdmConValues.get("String_Node_Str").toString());
                    ((MDMConnection)connection).setServer(oldMdmConValues.get("String_Node_Str").toString());
                    ((MDMConnection)connection).setPort(oldMdmConValues.get("String_Node_Str").toString());
                  }
 else {
                    ((MDMConnection)connection).setUsername("String_Node_Str");
                    ((MDMConnection)connection).setPassword("String_Node_Str");
                    ((MDMConnection)connection).setServer("String_Node_Str");
                    ((MDMConnection)connection).setPort("String_Node_Str");
                  }
                }
              }
            }
          }
        }
      }
    }
 else     if (objectType.equals(ERepositoryObjectType.METADATA_SAPCONNECTIONS)) {
      if (PluginChecker.isSAPWizardPluginLoaded()) {
        IProviderService service=(IProviderService)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=(IProviderService)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=(IProviderService)GlobalServiceRegister.getDefault().findService("String_Node_Str");
        if (service != null) {
          relatedWizard=service.newWizard(PlatformUI.getWorkbench(),creation,realNode,null);
        }
      }
    }
    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,500);
        wizardDialog.create();
        if (wizardDialog.open() == wizardDialog.OK) {
          return connItem;
        }
      }
    }
  }
  return null;
}