Program: 121535
Project: 121535
Buggy source:
/** 
 * nrousseau Comment method "checkNodeSchemaFromRepository".
 * @param nc
 * @param metadataTable
 * @return true if the data have been modified
 */
private List<UpdateResult> checkNodeSchemaFromRepository(final Node node,boolean onlySimpleShow){
  if (node == null) {
    return Collections.emptyList();
  }
  List<UpdateResult> schemaResults=new ArrayList<UpdateResult>();
  List<IProcess2> openedProcesses=UpdateManagerUtils.getOpenedProcess();
  if (PluginChecker.isEBCDICPluginLoaded()) {
    List<UpdateResult> resultForEBCDIC=checkNodeSchemaFromRepositoryForEBCDIC(node,onlySimpleShow);
    if (resultForEBCDIC != null && !resultForEBCDIC.isEmpty()) {
      return resultForEBCDIC;
    }
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerMapperService.class)) {
    List<UpdateResult> resultForTMap=checkNodeSchemaFromRepositoryForTMap(node,onlySimpleShow);
    if (resultForTMap != null && resultForTMap.size() > 0) {
      schemaResults.addAll(resultForTMap);
    }
  }
  List<IElementParameter> schemaTypeParams=node.getElementParametersFromField(EParameterFieldType.SCHEMA_TYPE);
  if (schemaTypeParams != null) {
    for (    IElementParameter schemaTypeParam : schemaTypeParams) {
      UpdateCheckResult result=null;
      IElementParameter schemaParam=schemaTypeParam.getChildParameters().get(EParameterName.SCHEMA_TYPE.getName());
      if (schemaParam != null && ((ElementParameter)schemaTypeParam).isDisplayedByDefault()) {
        if (schemaParam.getValue().equals(EmfComponent.REPOSITORY)) {
          String propertyValue=(String)schemaTypeParam.getChildParameters().get(EParameterName.REPOSITORY_SCHEMA_TYPE.getName()).getValue();
          ConnectionItem connectionItem=null;
          String schemaName=null;
          String[] names=UpdateManagerUtils.getSourceIdAndChildName(propertyValue);
          if (names != null && names.length > 1) {
            connectionItem=UpdateRepositoryUtils.getConnectionItemByItemId(names[0]);
            schemaName=names[1];
          }
          boolean builtIn=true;
          if (connectionItem != null) {
            final String uniqueName=node.getUniqueName();
            String newSourceId=getSchemaRenamedMap().get(propertyValue);
            Map<String,EUpdateResult> deletedOrReselect=getDeletedOrReselectTablesMap();
            List<Object> parameter=null;
            if (newSourceId != null && !newSourceId.equals(propertyValue)) {
              String[] newSourceIdAndName=UpdateManagerUtils.getSourceIdAndChildName(newSourceId);
              if (newSourceIdAndName != null) {
                IMetadataTable table=UpdateRepositoryUtils.getTableByName(connectionItem,newSourceIdAndName[1]);
                if (table != null) {
                  String source=UpdateRepositoryUtils.getRepositorySourceName(connectionItem);
                  final IMetadataTable copyOfrepositoryMetadata=table.clone();
                  copyOfrepositoryMetadata.setTableName(uniqueName);
                  copyOfrepositoryMetadata.setAttachedConnector(schemaTypeParam.getContext());
                  parameter=new ArrayList<Object>();
                  parameter.add(copyOfrepositoryMetadata);
                  parameter.add(propertyValue);
                  parameter.add(newSourceId);
                  result=new UpdateCheckResult(node);
                  result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.RENAME,parameter,source);
                  builtIn=false;
                }
              }
            }
 else             if (!deletedOrReselect.isEmpty()) {
              String source=UpdateRepositoryUtils.getRepositorySourceName(connectionItem);
              EUpdateResult status=deletedOrReselect.get(propertyValue);
              if (status != null) {
                if (status.equals(EUpdateResult.DELETE)) {
                  parameter=new ArrayList<Object>();
                  String tableName=propertyValue.split(UpdatesConstants.SEGMENT_LINE)[1];
                  parameter.add(tableName);
                  parameter.add(status);
                  result=new UpdateCheckResult(node);
                  result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.DELETE,parameter,source);
                  builtIn=false;
                }
 else                 if (status.equals(EUpdateResult.RELOAD)) {
                  parameter=new ArrayList<Object>();
                  String tableName=propertyValue.split(UpdatesConstants.SEGMENT_LINE)[1];
                  parameter.add(tableName);
                  parameter.add(status);
                  result=new UpdateCheckResult(node);
                  result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.RELOAD,parameter,source);
                  builtIn=false;
                }
              }
            }
 else {
              IMetadataTable table=UpdateRepositoryUtils.getTableByName(connectionItem,schemaName);
              if (table != null) {
                String source=UpdateRepositoryUtils.getRepositorySourceName(connectionItem) + UpdatesConstants.SEGMENT_LINE + table.getLabel();
                final IMetadataTable copyOfrepositoryMetadata=table.clone();
                copyOfrepositoryMetadata.setTableName(uniqueName);
                copyOfrepositoryMetadata.setAttachedConnector(schemaTypeParam.getContext());
                IMetadataTable metadataTable=node.getMetadataFromConnector(schemaTypeParam.getContext());
                if (onlySimpleShow || !metadataTable.sameMetadataAs(copyOfrepositoryMetadata,IMetadataColumn.OPTIONS_IGNORE_DBTYPE) || connectionItem instanceof GenericSchemaConnectionItem && !metadataTable.sameMetadataAs(copyOfrepositoryMetadata,IMetadataColumn.OPTIONS_NONE)) {
                  result=new UpdateCheckResult(node);
                  result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.UPDATE,copyOfrepositoryMetadata,source);
                  result.setContextModeConnectionItem(connectionItem);
                }
                builtIn=false;
              }
            }
          }
          if (builtIn) {
            result=new UpdateCheckResult(node);
            result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.BUIL_IN,schemaTypeParam.getContext());
          }
          if (result != null) {
            if (!openedProcesses.contains(getProcess())) {
              result.setFromItem(true);
            }
            result.setJob(getProcess());
            setConfigrationForReadOnlyJob(result);
            schemaResults.add(result);
          }
        }
      }
    }
  }
  return schemaResults;
}

Fixed version (ground truth):
/** 
 * nrousseau Comment method "checkNodeSchemaFromRepository".
 * @param nc
 * @param metadataTable
 * @return true if the data have been modified
 */
private List<UpdateResult> checkNodeSchemaFromRepository(final Node node,boolean onlySimpleShow){
  if (node == null) {
    return Collections.emptyList();
  }
  List<UpdateResult> schemaResults=new ArrayList<UpdateResult>();
  List<IProcess2> openedProcesses=UpdateManagerUtils.getOpenedProcess();
  if (PluginChecker.isEBCDICPluginLoaded()) {
    List<UpdateResult> resultForEBCDIC=checkNodeSchemaFromRepositoryForEBCDIC(node,onlySimpleShow);
    if (resultForEBCDIC != null && !resultForEBCDIC.isEmpty()) {
      return resultForEBCDIC;
    }
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerMapperService.class)) {
    List<UpdateResult> resultForTMap=checkNodeSchemaFromRepositoryForTMap(node,onlySimpleShow);
    if (resultForTMap != null && resultForTMap.size() > 0) {
      schemaResults.addAll(resultForTMap);
    }
  }
  List<IElementParameter> schemaTypeParams=node.getElementParametersFromField(EParameterFieldType.SCHEMA_TYPE);
  if (schemaTypeParams != null) {
    for (    IElementParameter schemaTypeParam : schemaTypeParams) {
      UpdateCheckResult result=null;
      IElementParameter schemaParam=schemaTypeParam.getChildParameters().get(EParameterName.SCHEMA_TYPE.getName());
      if (schemaParam != null && ((ElementParameter)schemaTypeParam).isDisplayedByDefault()) {
        if (schemaParam.getValue().equals(EmfComponent.REPOSITORY)) {
          String propertyValue=(String)schemaTypeParam.getChildParameters().get(EParameterName.REPOSITORY_SCHEMA_TYPE.getName()).getValue();
          ConnectionItem connectionItem=null;
          String schemaName=null;
          String[] names=UpdateManagerUtils.getSourceIdAndChildName(propertyValue);
          if (names != null && names.length > 1) {
            connectionItem=UpdateRepositoryUtils.getConnectionItemByItemId(names[0]);
            schemaName=names[1];
          }
          boolean builtIn=true;
          if (connectionItem != null) {
            final String uniqueName=node.getUniqueName();
            String newSourceId=getSchemaRenamedMap().get(propertyValue);
            Map<String,EUpdateResult> deletedOrReselect=getDeletedOrReselectTablesMap();
            String connectionId=(String)node.getPropertyValue(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
            List<Object> parameter=null;
            if (newSourceId != null && !newSourceId.equals(propertyValue)) {
              String[] newSourceIdAndName=UpdateManagerUtils.getSourceIdAndChildName(newSourceId);
              if (newSourceIdAndName != null) {
                IMetadataTable table=UpdateRepositoryUtils.getTableByName(connectionItem,newSourceIdAndName[1]);
                if (table != null) {
                  String source=UpdateRepositoryUtils.getRepositorySourceName(connectionItem);
                  final IMetadataTable copyOfrepositoryMetadata=table.clone();
                  copyOfrepositoryMetadata.setTableName(uniqueName);
                  copyOfrepositoryMetadata.setAttachedConnector(schemaTypeParam.getContext());
                  parameter=new ArrayList<Object>();
                  parameter.add(copyOfrepositoryMetadata);
                  parameter.add(propertyValue);
                  parameter.add(newSourceId);
                  result=new UpdateCheckResult(node);
                  result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.RENAME,parameter,source);
                  builtIn=false;
                }
              }
            }
 else             if (!deletedOrReselect.isEmpty() && connectionId != null) {
              String source=UpdateRepositoryUtils.getRepositorySourceName(connectionItem);
              EUpdateResult status=deletedOrReselect.get(propertyValue);
              if (status != null) {
                if (status.equals(EUpdateResult.DELETE)) {
                  parameter=new ArrayList<Object>();
                  String tableName=propertyValue.split(UpdatesConstants.SEGMENT_LINE)[1];
                  parameter.add(tableName);
                  parameter.add(status);
                  result=new UpdateCheckResult(node);
                  result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.DELETE,parameter,source);
                  builtIn=false;
                }
 else                 if (status.equals(EUpdateResult.RELOAD)) {
                  parameter=new ArrayList<Object>();
                  String tableName=propertyValue.split(UpdatesConstants.SEGMENT_LINE)[1];
                  parameter.add(tableName);
                  parameter.add(status);
                  result=new UpdateCheckResult(node);
                  result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.RELOAD,parameter,source);
                  builtIn=false;
                }
              }
            }
 else {
              IMetadataTable table=UpdateRepositoryUtils.getTableByName(connectionItem,schemaName);
              if (table != null) {
                String source=UpdateRepositoryUtils.getRepositorySourceName(connectionItem) + UpdatesConstants.SEGMENT_LINE + table.getLabel();
                final IMetadataTable copyOfrepositoryMetadata=table.clone();
                copyOfrepositoryMetadata.setTableName(uniqueName);
                copyOfrepositoryMetadata.setAttachedConnector(schemaTypeParam.getContext());
                IMetadataTable metadataTable=node.getMetadataFromConnector(schemaTypeParam.getContext());
                if (onlySimpleShow || !metadataTable.sameMetadataAs(copyOfrepositoryMetadata,IMetadataColumn.OPTIONS_IGNORE_DBTYPE) || connectionItem instanceof GenericSchemaConnectionItem && !metadataTable.sameMetadataAs(copyOfrepositoryMetadata,IMetadataColumn.OPTIONS_NONE)) {
                  result=new UpdateCheckResult(node);
                  result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.UPDATE,copyOfrepositoryMetadata,source);
                  result.setContextModeConnectionItem(connectionItem);
                }
                builtIn=false;
              }
            }
          }
          if (builtIn) {
            result=new UpdateCheckResult(node);
            result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.BUIL_IN,schemaTypeParam.getContext());
          }
          if (result != null) {
            if (!openedProcesses.contains(getProcess())) {
              result.setFromItem(true);
            }
            result.setJob(getProcess());
            setConfigrationForReadOnlyJob(result);
            schemaResults.add(result);
          }
        }
      }
    }
  }
  return schemaResults;
}