Program: 122826
Project: 122826
Buggy source:
/** 
 * DOC bqian Comment method "getChangeMetadataCommand".
 * @param selectedNode
 * @param node
 * @param list
 * @param connectionItem
 */
private Command getChangeMetadataCommand(RepositoryNode selectedNode,Node node,ConnectionItem connectionItem){
  if (selectedNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.METADATA_CON_TABLE || selectedNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.METADATA_SAP_FUNCTION || selectedNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.METADATA_SALESFORCE_MODULE) {
    String etlSchema=null;
    if (connectionItem.getConnection() instanceof DatabaseConnection) {
      DatabaseConnection connection=(DatabaseConnection)connectionItem.getConnection();
      if (connection instanceof DatabaseConnection) {
        etlSchema=connection.getUiSchema();
      }
      if (!"String_Node_Str".equals(etlSchema)) {
        IElementParameter e=node.getElementParameter("String_Node_Str");
        if (e != null) {
          if (connection.isContextMode() && ContextParameterUtils.isContainContextParam(etlSchema)) {
            e.setValue(etlSchema);
          }
 else {
            e.setValue(TalendTextUtils.addQuotes(etlSchema));
          }
        }
      }
    }
    IRepositoryViewObject object=selectedNode.getObject();
    MetadataTable table=null;
    if (object instanceof MetadataTableRepositoryObject) {
      table=((MetadataTableRepositoryObject)object).getTable();
    }
 else     if (object instanceof SAPFunctionRepositoryObject) {
      table=(MetadataTable)((SAPFunctionRepositoryObject)object).getAdapter(MetadataTable.class);
    }
 else     if (object instanceof SalesforceModuleRepositoryObject) {
      table=((SalesforceModuleRepositoryObject)object).getDefaultTable();
    }
    if (table != null) {
      String value=connectionItem.getProperty().getId() + "String_Node_Str" + table.getLabel();
      IElementParameter schemaParam=node.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
      IElementParameter queryParam=node.getElementParameterFromField(EParameterFieldType.QUERYSTORE_TYPE);
      if (queryParam != null) {
        queryParam=queryParam.getChildParameters().get(EParameterName.QUERYSTORE_TYPE.getName());
        if (queryParam != null) {
          queryParam.setValue(EmfComponent.BUILTIN);
        }
      }
      Command command=getSAPCommand(object,connectionItem,table,node);
      if (command != null)       return command;
      if (PluginChecker.isHL7PluginLoaded() && connectionItem instanceof HL7ConnectionItem) {
        Command hl7Cmd=new RepositoryChangeMetadataForHL7Command(node,IEbcdicConstant.TABLE_SCHEMAS,table.getLabel(),ConvertionHelper.convert(table));
        return hl7Cmd;
      }
      if (schemaParam == null) {
        return null;
      }
      if (node.isELTComponent()) {
        node.setPropertyValue(EParameterName.LABEL.getName(),"String_Node_Str");
      }
      schemaParam.getChildParameters().get(EParameterName.SCHEMA_TYPE.getName()).setValue(EmfComponent.REPOSITORY);
      RepositoryChangeMetadataCommand command2=new RepositoryChangeMetadataCommand(node,schemaParam.getName() + "String_Node_Str" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName(),value,ConvertionHelper.convert(table),null,connectionItem.getConnection());
      return command2;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * DOC bqian Comment method "getChangeMetadataCommand".
 * @param selectedNode
 * @param node
 * @param list
 * @param connectionItem
 */
private Command getChangeMetadataCommand(RepositoryNode selectedNode,Node node,ConnectionItem connectionItem){
  if (selectedNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.METADATA_CON_TABLE || selectedNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.METADATA_SAP_FUNCTION || selectedNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.METADATA_SALESFORCE_MODULE) {
    String etlSchema=null;
    if (connectionItem.getConnection() instanceof DatabaseConnection) {
      DatabaseConnection connection=(DatabaseConnection)connectionItem.getConnection();
      if (connection instanceof DatabaseConnection) {
        etlSchema=connection.getUiSchema();
      }
      if (!"String_Node_Str".equals(etlSchema)) {
        IElementParameter e=node.getElementParameter("String_Node_Str");
        if (e != null) {
          if (connection.isContextMode() && ContextParameterUtils.isContainContextParam(etlSchema)) {
            e.setValue(etlSchema);
          }
 else {
            e.setValue(TalendTextUtils.addQuotes(etlSchema));
          }
        }
      }
    }
    IRepositoryViewObject object=selectedNode.getObject();
    MetadataTable table=null;
    if (object instanceof MetadataTableRepositoryObject) {
      table=((MetadataTableRepositoryObject)object).getTable();
    }
 else     if (object instanceof SAPFunctionRepositoryObject) {
      table=(MetadataTable)((SAPFunctionRepositoryObject)object).getAdapter(MetadataTable.class);
    }
 else     if (object instanceof SalesforceModuleRepositoryObject) {
      table=((SalesforceModuleRepositoryObject)object).getDefaultTable();
    }
    if (table != null) {
      String value=connectionItem.getProperty().getId() + "String_Node_Str" + table.getLabel();
      IElementParameter schemaParam=node.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
      IElementParameter queryParam=node.getElementParameterFromField(EParameterFieldType.QUERYSTORE_TYPE);
      if (queryParam != null) {
        queryParam=queryParam.getChildParameters().get(EParameterName.QUERYSTORE_TYPE.getName());
        if (queryParam != null) {
          queryParam.setValue(EmfComponent.BUILTIN);
        }
      }
      Command command=getSAPCommand(object,connectionItem,table,node);
      if (command != null) {
        return command;
      }
      if (PluginChecker.isHL7PluginLoaded() && connectionItem instanceof HL7ConnectionItem) {
        Command hl7Cmd=new RepositoryChangeMetadataForHL7Command(node,IEbcdicConstant.TABLE_SCHEMAS,table.getLabel(),ConvertionHelper.convert(table));
        return hl7Cmd;
      }
      if (schemaParam == null) {
        return null;
      }
      if (node.isELTComponent()) {
        node.setPropertyValue(EParameterName.LABEL.getName(),"String_Node_Str");
      }
      schemaParam.getChildParameters().get(EParameterName.SCHEMA_TYPE.getName()).setValue(EmfComponent.REPOSITORY);
      RepositoryChangeMetadataCommand command2=new RepositoryChangeMetadataCommand(node,schemaParam.getName() + "String_Node_Str" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName(),value,ConvertionHelper.convert(table),null,connectionItem.getConnection());
      return command2;
    }
  }
  return null;
}