Program: 118646
Project: 118646
Buggy source:
@Override public void execute(){
  node.setPropertyValue(propName,newPropValue);
  if ((EParameterName.SCHEMA + "String_Node_Str" + EParameterName.REPOSITORY_SCHEMA_TYPE).equals(propName)) {
    IElementParameter elementParameter=node.getElementParameter(propName);
    if (elementParameter != null) {
      IElementParameter schemaTypeParam=elementParameter.getParentParameter().getChildParameters().get(EParameterName.SCHEMA_TYPE.getName());
      if (schemaTypeParam != null) {
        if (newPropValue != null && !"String_Node_Str".equals(newPropValue)) {
          schemaTypeParam.setValue(EmfComponent.REPOSITORY);
        }
 else {
          schemaTypeParam.setValue(EmfComponent.BUILTIN);
        }
      }
    }
  }
  if (node.isExternalNode() && !node.isELTComponent()) {
    for (    IElementParameter parameter : node.getElementParameters()) {
      if (parameter.getFieldType() == EParameterFieldType.TABLE) {
        if (!node.getMetadataList().isEmpty() && !node.getMetadataList().get(0).sameMetadataAs(newOutputMetadata)) {
          parameter.setValue(new ArrayList<Map<String,Object>>());
        }
      }
    }
  }
  if (node.isELTComponent()) {
    IElementParameter schemaParam=node.getElementParameter("String_Node_Str");
    if (schemaParam != null && schemaParam.getValue() != null && newPropValue != null && connection != null && connection.isContextMode() && ContextParameterUtils.isContainContextParam(schemaParam.getValue().toString())) {
      ConnectionItem connectionItem=MetadataToolHelper.getConnectionItemFromRepository(newPropValue.toString());
      ConnectionContextHelper.addContextForNodeParameter(node,connectionItem,false);
    }
  }
  boolean isXstreamCdcTypeMode=false;
  if (connection != null && connection instanceof DatabaseConnection) {
    String cdcTypeMode=((DatabaseConnection)connection).getCdcTypeMode();
    if (CDCTypeMode.XSTREAM_MODE == CDCTypeMode.indexOf(cdcTypeMode)) {
      isXstreamCdcTypeMode=true;
    }
  }
  node.getElementParameter(EParameterName.UPDATE_COMPONENTS.getName()).setValue(true);
  if (newOutputMetadata != null) {
    Map<String,String> addMap=newOutputMetadata.getAdditionalProperties();
    if (addMap.get(TaggedValueHelper.SYSTEMTABLENAME) != null && node.getComponent().getName().equals("String_Node_Str")) {
      setDBTableFieldValue(node,addMap.get(TaggedValueHelper.SYSTEMTABLENAME),oldOutputMetadata.getTableName());
    }
 else     if (isXstreamCdcTypeMode) {
      IElementParameter elementParameter=node.getElementParameter(propName);
      if (elementParameter != null) {
        String componentName=node.getComponent().getName();
        if (oracleCdcComponent[0].equals(componentName) || oracleCdcComponent[1].equals(componentName)) {
          IElementParameter schemaTypeParam=elementParameter.getParentParameter().getChildParameters().get(EParameterName.SCHEMA_TYPE.getName());
          IElementParameter schemaParam=node.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
          if (schemaTypeParam != null) {
            schemaTypeParam.setValue(EmfComponent.BUILTIN);
            if (schemaParam != null && schemaParam.getValue() != null && schemaParam.getValue() instanceof IMetadataTable) {
              newOutputMetadata.setListColumns((((IMetadataTable)schemaParam.getValue()).clone(true)).getListColumns());
            }
            if (oracleCdcComponent[1].equals(componentName)) {
              newOutputMetadata.setListColumns(new ArrayList<IMetadataColumn>());
            }
          }
        }
      }
      setDBTableFieldValue(node,newOutputMetadata.getTableName(),oldOutputMetadata.getTableName());
    }
 else {
      setDBTableFieldValue(node,newOutputMetadata.getTableName(),oldOutputMetadata.getTableName());
    }
    IElementParameter parameter=node.getElementParameter("String_Node_Str");
    if (parameter != null) {
      setSAPFunctionName(node,parameter.getValue() == null ? null : (String)parameter.getValue());
    }
    if (newPropValue instanceof String) {
      if (orginalTable != null && orginalTable instanceof SAPBWTable) {
        String innerIOType=((SAPBWTable)orginalTable).getInnerIOType();
        if (innerIOType != null) {
          node.getElementParameter("String_Node_Str").setValue(innerIOType);
          IElementParameter schemaTypeParam=node.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
          if (schemaTypeParam != null) {
            IMetadataTable metadataTable=node.getMetadataFromConnector(schemaTypeParam.getContext());
            metadataTable.getAdditionalProperties().put(SAPBWTableHelper.SAP_INFOOBJECT_INNER_TYPE,innerIOType);
          }
        }
      }
    }
    setTableRelevantParameterValues();
  }
  if (!node.getMetadataList().isEmpty() && !node.getMetadataList().get(0).sameMetadataAs(newOutputMetadata)) {
    IGenericWizardService wizardService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
      wizardService=(IGenericWizardService)GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
    }
    Connection conn=connection;
    if (conn == null) {
      conn=getConnection();
    }
    if (wizardService != null && wizardService.isGenericConnection(conn)) {
      wizardService.updateComponentSchema(node.getComponentProperties(),getSchemaElementParamName(),newOutputMetadata);
    }
  }
  super.setConnection(connection);
  super.execute();
  String propertyType=(String)node.getPropertyValue(EParameterName.PROPERTY_TYPE.getName());
  if (propertyType != null) {
    if (propertyType.equals(EmfComponent.REPOSITORY)) {
      String propertyValue=(String)node.getPropertyValue(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
      IRepositoryViewObject lastVersion=UpdateRepositoryUtils.getRepositoryObjectById(propertyValue);
      if (lastVersion == null) {
        return;
      }
      Item item=lastVersion.getProperty().getItem();
      if (item instanceof ConnectionItem) {
        List<? extends IElementParameter> elementParameters=new ArrayList(node.getElementParameters());
        for (        IElementParameter param : elementParameters) {
          if (param.getRepositoryValue() != null && !param.getRepositoryValue().equals("String_Node_Str")) {
            boolean isCustomSfConn=false;
            if (item instanceof SalesforceSchemaConnectionItem) {
              SalesforceSchemaConnection sfConn=(SalesforceSchemaConnection)((SalesforceSchemaConnectionItem)item).getConnection();
              isCustomSfConn=sfConn.isUseCustomModuleName();
            }
            if (param.getRepositoryValue().equals("String_Node_Str") || (param.getRepositoryValue().equals("String_Node_Str") && item instanceof SalesforceSchemaConnectionItem && !isCustomSfConn)) {
              continue;
            }
            if (param.getFieldType().equals(EParameterFieldType.TABLE) && param.getRepositoryValue().equals("String_Node_Str")) {
              List<Map<String,Object>> table=(List<Map<String,Object>>)node.getPropertyValue(param.getName());
              IMetadataTable metaTable=node.getMetadataList().get(0);
              RepositoryToComponentProperty.getTableXmlFileValue(((ConnectionItem)item).getConnection(),"String_Node_Str",param,table,newOutputMetadata);
              param.setRepositoryValueUsed(true);
            }
 else {
              String componentName=node.getComponent().getName();
              if (connection != null && (xmlComponent[0].equals(componentName) || xmlComponent[1].equals(componentName) || xmlComponent[2].equals(componentName)) && connection instanceof XmlFileConnection && XmlUtil.isXSDFile(TalendQuoteUtils.removeQuotes(((XmlFileConnection)connection).getXmlFilePath())) && param.getRepositoryValue().equals("String_Node_Str")) {
              }
 else {
                Object value=RepositoryToComponentProperty.getValue(((ConnectionItem)item).getConnection(),param.getRepositoryValue(),newOutputMetadata);
                if (value != null) {
                  param.setValue(value);
                }
              }
            }
          }
        }
      }
    }
  }
  node.setPropertyValue(EParameterName.UPDATE_COMPONENTS.getName(),Boolean.TRUE);
}

Fixed version (ground truth):
@Override public void execute(){
  node.setPropertyValue(propName,newPropValue);
  if ((EParameterName.SCHEMA + "String_Node_Str" + EParameterName.REPOSITORY_SCHEMA_TYPE).equals(propName)) {
    IElementParameter elementParameter=node.getElementParameter(propName);
    if (elementParameter != null) {
      IElementParameter schemaTypeParam=elementParameter.getParentParameter().getChildParameters().get(EParameterName.SCHEMA_TYPE.getName());
      if (schemaTypeParam != null) {
        if (newPropValue != null && !"String_Node_Str".equals(newPropValue)) {
          schemaTypeParam.setValue(EmfComponent.REPOSITORY);
        }
 else {
          schemaTypeParam.setValue(EmfComponent.BUILTIN);
        }
      }
    }
  }
  if (node.isExternalNode() && !node.isELTComponent()) {
    for (    IElementParameter parameter : node.getElementParameters()) {
      if (parameter.getFieldType() == EParameterFieldType.TABLE) {
        if (!node.getMetadataList().isEmpty() && !node.getMetadataList().get(0).sameMetadataAs(newOutputMetadata)) {
          parameter.setValue(new ArrayList<Map<String,Object>>());
        }
      }
    }
  }
  if (node.isELTComponent()) {
    IElementParameter schemaParam=node.getElementParameter("String_Node_Str");
    if (schemaParam != null && schemaParam.getValue() != null && newPropValue != null && connection != null && connection.isContextMode() && ContextParameterUtils.isContainContextParam(schemaParam.getValue().toString())) {
      ConnectionItem connectionItem=MetadataToolHelper.getConnectionItemFromRepository(newPropValue.toString());
      ConnectionContextHelper.addContextForNodeParameter(node,connectionItem,false);
    }
  }
  boolean isXstreamCdcTypeMode=false;
  if (connection != null && connection instanceof DatabaseConnection) {
    String cdcTypeMode=((DatabaseConnection)connection).getCdcTypeMode();
    if (CDCTypeMode.XSTREAM_MODE == CDCTypeMode.indexOf(cdcTypeMode)) {
      isXstreamCdcTypeMode=true;
    }
  }
  node.getElementParameter(EParameterName.UPDATE_COMPONENTS.getName()).setValue(true);
  if (newOutputMetadata != null) {
    Map<String,String> addMap=newOutputMetadata.getAdditionalProperties();
    if (addMap.get(TaggedValueHelper.SYSTEMTABLENAME) != null && node.getComponent().getName().equals("String_Node_Str")) {
      setDBTableFieldValue(node,addMap.get(TaggedValueHelper.SYSTEMTABLENAME),oldOutputMetadata.getTableName());
    }
 else     if (isXstreamCdcTypeMode) {
      IElementParameter elementParameter=node.getElementParameter(propName);
      if (elementParameter != null) {
        String componentName=node.getComponent().getName();
        if (oracleCdcComponent[0].equals(componentName) || oracleCdcComponent[1].equals(componentName)) {
          IElementParameter schemaTypeParam=elementParameter.getParentParameter().getChildParameters().get(EParameterName.SCHEMA_TYPE.getName());
          IElementParameter schemaParam=node.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
          if (schemaTypeParam != null) {
            schemaTypeParam.setValue(EmfComponent.BUILTIN);
            if (schemaParam != null && schemaParam.getValue() != null && schemaParam.getValue() instanceof IMetadataTable) {
              newOutputMetadata.setListColumns((((IMetadataTable)schemaParam.getValue()).clone(true)).getListColumns());
            }
            if (oracleCdcComponent[1].equals(componentName)) {
              newOutputMetadata.setListColumns(new ArrayList<IMetadataColumn>());
            }
          }
        }
      }
      setDBTableFieldValue(node,newOutputMetadata.getTableName(),oldOutputMetadata.getTableName());
    }
 else {
      setDBTableFieldValue(node,newOutputMetadata.getTableName(),oldOutputMetadata.getTableName());
    }
    IElementParameter parameter=node.getElementParameter("String_Node_Str");
    if (parameter != null) {
      setSAPFunctionName(node,parameter.getValue() == null ? null : (String)parameter.getValue());
    }
    if (newPropValue instanceof String) {
      if (orginalTable != null && orginalTable instanceof SAPBWTable) {
        String innerIOType=((SAPBWTable)orginalTable).getInnerIOType();
        String sourceSysName=((SAPBWTable)orginalTable).getSourceSystemName();
        IElementParameter schemaTypeParam=node.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
        IMetadataTable metadataTable=null;
        if (schemaTypeParam != null) {
          metadataTable=node.getMetadataFromConnector(schemaTypeParam.getContext());
        }
        if (metadataTable != null) {
          if (innerIOType != null) {
            IElementParameter param=node.getElementParameter("String_Node_Str");
            if (param != null) {
              param.setValue(innerIOType);
              metadataTable.getAdditionalProperties().put(SAPBWTableHelper.SAP_INFOOBJECT_INNER_TYPE,innerIOType);
            }
          }
          if (sourceSysName != null) {
            IElementParameter param=node.getElementParameter("String_Node_Str");
            if (param != null) {
              param.setValue(TalendTextUtils.addQuotes(sourceSysName));
              metadataTable.getAdditionalProperties().put(SAPBWTableHelper.SAP_DATASOURCE_SOURCESYSNAME,sourceSysName);
            }
          }
        }
      }
    }
    setTableRelevantParameterValues();
  }
  if (!node.getMetadataList().isEmpty() && !node.getMetadataList().get(0).sameMetadataAs(newOutputMetadata)) {
    IGenericWizardService wizardService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
      wizardService=(IGenericWizardService)GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
    }
    Connection conn=connection;
    if (conn == null) {
      conn=getConnection();
    }
    if (wizardService != null && wizardService.isGenericConnection(conn)) {
      wizardService.updateComponentSchema(node.getComponentProperties(),getSchemaElementParamName(),newOutputMetadata);
    }
  }
  super.setConnection(connection);
  super.execute();
  String propertyType=(String)node.getPropertyValue(EParameterName.PROPERTY_TYPE.getName());
  if (propertyType != null) {
    if (propertyType.equals(EmfComponent.REPOSITORY)) {
      String propertyValue=(String)node.getPropertyValue(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
      IRepositoryViewObject lastVersion=UpdateRepositoryUtils.getRepositoryObjectById(propertyValue);
      if (lastVersion == null) {
        return;
      }
      Item item=lastVersion.getProperty().getItem();
      if (item instanceof ConnectionItem) {
        List<? extends IElementParameter> elementParameters=new ArrayList(node.getElementParameters());
        for (        IElementParameter param : elementParameters) {
          if (param.getRepositoryValue() != null && !param.getRepositoryValue().equals("String_Node_Str")) {
            boolean isCustomSfConn=false;
            if (item instanceof SalesforceSchemaConnectionItem) {
              SalesforceSchemaConnection sfConn=(SalesforceSchemaConnection)((SalesforceSchemaConnectionItem)item).getConnection();
              isCustomSfConn=sfConn.isUseCustomModuleName();
            }
            if (param.getRepositoryValue().equals("String_Node_Str") || (param.getRepositoryValue().equals("String_Node_Str") && item instanceof SalesforceSchemaConnectionItem && !isCustomSfConn)) {
              continue;
            }
            if (param.getFieldType().equals(EParameterFieldType.TABLE) && param.getRepositoryValue().equals("String_Node_Str")) {
              List<Map<String,Object>> table=(List<Map<String,Object>>)node.getPropertyValue(param.getName());
              IMetadataTable metaTable=node.getMetadataList().get(0);
              RepositoryToComponentProperty.getTableXmlFileValue(((ConnectionItem)item).getConnection(),"String_Node_Str",param,table,newOutputMetadata);
              param.setRepositoryValueUsed(true);
            }
 else {
              String componentName=node.getComponent().getName();
              if (connection != null && (xmlComponent[0].equals(componentName) || xmlComponent[1].equals(componentName) || xmlComponent[2].equals(componentName)) && connection instanceof XmlFileConnection && XmlUtil.isXSDFile(TalendQuoteUtils.removeQuotes(((XmlFileConnection)connection).getXmlFilePath())) && param.getRepositoryValue().equals("String_Node_Str")) {
              }
 else {
                Object value=RepositoryToComponentProperty.getValue(((ConnectionItem)item).getConnection(),param.getRepositoryValue(),newOutputMetadata);
                if (value != null) {
                  param.setValue(value);
                }
              }
            }
          }
        }
      }
    }
  }
  node.setPropertyValue(EParameterName.UPDATE_COMPONENTS.getName(),Boolean.TRUE);
}