Program: 129671
Project: 129671
Buggy source:
public void execute(){
  if (extendedTableModel instanceof MetadataTableEditor) {
    MetadataTableEditor editor=(MetadataTableEditor)extendedTableModel;
    IMetadataTable metadataTable=editor.getMetadataTable();
    List<IMetadataColumn> listColumns=metadataTable.getListColumns();
    if (listColumns == null || listColumns.size() == 0) {
      return;
    }
    RepositoryNode genericSchemaNode=getGenericSchemaNode();
    boolean isGenericSchemaExisting=false;
    RepositoryObject repositoryObject=null;
    if (genericSchemaNode != null) {
    }
    IMetadataService metadataService=CoreRuntimePlugin.getInstance().getMetadataService();
    if (metadataService == null) {
      return;
    }
    WizardDialog dialog=metadataService.getGenericSchemaWizardDialog(new Shell(),PlatformUI.getWorkbench(),false,null,null,true);
    dialog.setPageSize(WIZARD_WIDTH,WIZARD_HEIGHT);
    dialog.create();
    Property property=null;
    if (dialog.open() != 0) {
      return;
    }
 else {
      property=metadataService.getPropertyFromWizardDialog();
    }
    repositoryObject=new RepositoryObject();
    GenericSchemaConnectionItem item=PropertiesFactory.eINSTANCE.createGenericSchemaConnectionItem();
    IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
    String nextId=factory.getNextId();
    property.setId(nextId);
    GenericSchemaConnection connection=ConnectionFactory.eINSTANCE.createGenericSchemaConnection();
    connection.setLabel("String_Node_Str");
    connection.setComment("String_Node_Str");
    if (this.dbmsId != null && this.dbmsId.length() > 0) {
      connection.setMappingTypeId(this.dbmsId);
      connection.setMappingTypeUsed(true);
    }
    MetadataTable createMetadataTable=ConnectionFactory.eINSTANCE.createMetadataTable();
    CoreRuntimePlugin.getInstance().getProxyRepositoryFactory().getNextId();
    metadataTable.setId(nextId);
    if (createMetadataTable.getNamespace() instanceof Package) {
      Package pkg=(Package)createMetadataTable.getNamespace();
      pkg.getDataManager().add(connection);
    }
    createMetadataTable.setLabel("String_Node_Str");
    for (    IMetadataColumn column : listColumns) {
      MetadataColumn createMetadataColumn=ConnectionFactory.eINSTANCE.createMetadataColumn();
      createMetadataColumn.setComment(column.getComment());
      createMetadataColumn.setLabel(column.getLabel());
      createMetadataColumn.setDefaultValue(column.getDefault());
      createMetadataColumn.setId(column.getId() + "String_Node_Str");
      createMetadataColumn.setKey(column.isKey());
      Integer length=column.getLength();
      if (length == null) {
        length=0;
      }
      createMetadataColumn.setLength(length);
      Integer precision=column.getPrecision();
      if (precision == null) {
        precision=0;
      }
      createMetadataColumn.setPrecision(precision);
      createMetadataColumn.setPattern(column.getPattern());
      createMetadataColumn.setNullable(column.isNullable());
      createMetadataColumn.setOriginalField(column.getOriginalDbColumnName());
      createMetadataColumn.setTalendType(column.getTalendType());
      createMetadataColumn.setSourceType(column.getType());
      createMetadataTable.getColumns().add(createMetadataColumn);
    }
    GenericPackage g=(GenericPackage)ConnectionHelper.getPackage(connection.getName(),(Connection)connection,GenericPackage.class);
    if (g != null) {
      g.getOwnedElement().add(createMetadataTable);
    }
 else {
      GenericPackage gpkg=ConnectionFactory.eINSTANCE.createGenericPackage();
      PackageHelper.addMetadataTable(createMetadataTable,gpkg);
      ConnectionHelper.addPackage(gpkg,connection);
    }
    item.setProperty(property);
    item.setConnection(connection);
    IPath path=metadataService.getPathForSaveAsGenericSchema();
    if (path == null) {
      this.saveMetaData(item,new Path("String_Node_Str"));
    }
 else {
      this.saveMetaData(item,path);
    }
    RepositoryManager.refreshCreatedNode(ERepositoryObjectType.METADATA_GENERIC_SCHEMA);
  }
}

Fixed version (ground truth):
@Override public void execute(){
  if (extendedTableModel instanceof MetadataTableEditor) {
    MetadataTableEditor editor=(MetadataTableEditor)extendedTableModel;
    IMetadataTable metadataTable=editor.getMetadataTable();
    List<IMetadataColumn> listColumns=metadataTable.getListColumns();
    if (listColumns == null || listColumns.size() == 0) {
      return;
    }
    RepositoryNode genericSchemaNode=getGenericSchemaNode();
    boolean isGenericSchemaExisting=false;
    RepositoryObject repositoryObject=null;
    if (genericSchemaNode != null) {
    }
    IMetadataService metadataService=CoreRuntimePlugin.getInstance().getMetadataService();
    if (metadataService == null) {
      return;
    }
    WizardDialog dialog=metadataService.getGenericSchemaWizardDialog(new Shell(),PlatformUI.getWorkbench(),false,null,null,true);
    dialog.setPageSize(WIZARD_WIDTH,WIZARD_HEIGHT);
    dialog.create();
    Property property=null;
    if (dialog.open() != 0) {
      return;
    }
 else {
      property=metadataService.getPropertyFromWizardDialog();
    }
    repositoryObject=new RepositoryObject();
    GenericSchemaConnectionItem item=PropertiesFactory.eINSTANCE.createGenericSchemaConnectionItem();
    IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
    String nextId=factory.getNextId();
    property.setId(nextId);
    GenericSchemaConnection connection=ConnectionFactory.eINSTANCE.createGenericSchemaConnection();
    connection.setLabel("String_Node_Str");
    connection.setComment("String_Node_Str");
    if (this.dbmsId != null && this.dbmsId.length() > 0) {
      connection.setMappingTypeId(this.dbmsId);
      connection.setMappingTypeUsed(true);
    }
    MetadataTable createMetadataTable=ConnectionFactory.eINSTANCE.createMetadataTable();
    CoreRuntimePlugin.getInstance().getProxyRepositoryFactory().getNextId();
    metadataTable.setId(nextId);
    if (createMetadataTable.getNamespace() instanceof Package) {
      Package pkg=(Package)createMetadataTable.getNamespace();
      pkg.getDataManager().add(connection);
    }
    createMetadataTable.setLabel("String_Node_Str");
    for (    IMetadataColumn column : listColumns) {
      MetadataColumn createMetadataColumn=ConnectionFactory.eINSTANCE.createMetadataColumn();
      createMetadataColumn.setComment(column.getComment());
      createMetadataColumn.setLabel(column.getLabel());
      createMetadataColumn.setDefaultValue(column.getDefault());
      createMetadataColumn.setId(column.getId() + "String_Node_Str");
      createMetadataColumn.setKey(column.isKey());
      Integer length=column.getLength();
      if (length == null) {
        length=0;
      }
      createMetadataColumn.setLength(length);
      Integer precision=column.getPrecision();
      if (precision == null) {
        precision=0;
      }
      createMetadataColumn.setPrecision(precision);
      createMetadataColumn.setPattern(column.getPattern());
      createMetadataColumn.setNullable(column.isNullable());
      createMetadataColumn.setOriginalField(column.getOriginalDbColumnName());
      createMetadataColumn.setTalendType(column.getTalendType());
      createMetadataColumn.setSourceType(column.getType());
      createMetadataTable.getColumns().add(createMetadataColumn);
    }
    GenericPackage g=(GenericPackage)ConnectionHelper.getPackage(connection.getName(),connection,GenericPackage.class);
    if (g != null) {
      g.getOwnedElement().add(createMetadataTable);
    }
 else {
      GenericPackage gpkg=ConnectionFactory.eINSTANCE.createGenericPackage();
      PackageHelper.addMetadataTable(createMetadataTable,gpkg);
      ConnectionHelper.addPackage(gpkg,connection);
    }
    item.setProperty(property);
    item.setConnection(connection);
    IPath path=metadataService.getPathForSaveAsGenericSchema();
    if (path == null) {
      this.saveMetaData(item,new Path("String_Node_Str"));
    }
 else {
      this.saveMetaData(item,path);
    }
  }
}