Program: 118661
Project: 118661
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();
  }
  List<ComponentProperties> componentProperties=null;
  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);
      if (wizardService != null && wizardService.isGenericConnection(connection)) {
        componentProperties=wizardService.getAllComponentProperties(connection);
      }
    }
    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);
                boolean isGenericRepositoryValue=RepositoryToComponentProperty.isGenericRepositoryValue(connection,componentProperties,param.getName());
                if (param.getFieldType().equals(EParameterFieldType.TEXT) || param.getFieldType().equals(EParameterFieldType.HIDDEN_TEXT)) {
                  if (isGenericRepositoryValue && value != null && value instanceof String) {
                    if (!ContextParameterUtils.isContextMode(connection,StringUtils.trimToNull(value.toString()))) {
                      value=TalendQuoteUtils.addQuotesIfNotExist(value.toString());
                    }
                  }
                }
                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();
        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);
}