Program: 123884
Project: 123884
Buggy source:
public void convertToProcessNode(ConnectionItem connectionItem,String tableName) throws ProcessorException {
  EDatabaseComponentName name=EDatabaseComponentName.getCorrespondingComponentName(connectionItem,ERepositoryObjectType.METADATA_CONNECTIONS);
  String componentName=null;
  componentName=name.getDefaultComponentName();
  IComponent dbInputComponent=ComponentsFactoryProvider.getInstance().get(componentName);
  Process process=new Process(GuessSchemaProcess.getNewmockProperty());
  node=new Node(dbInputComponent,process);
  selectedContext=node.getProcess().getContextManager().getDefaultContext();
  IMetadataTable table=UpdateRepositoryUtils.getTableByName(connectionItem,tableName);
  IElementParameter propertyParam=((Node)node).getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
  IElementParameter schemaParam=((Node)node).getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
  String propertyId=connectionItem.getProperty().getId();
  String schema=databaseConnection.getUiSchema();
  String dbType=databaseConnection.getDatabaseType();
  String value=connectionItem.getProperty().getId() + "String_Node_Str" + table.getLabel();
  CompoundCommand cc=new CompoundCommand();
  ChangeValuesFromRepository changeValueCommand=new ChangeValuesFromRepository((Node)node,databaseConnection,propertyParam.getName() + "String_Node_Str" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(),propertyId);
  cc.add(changeValueCommand);
  RepositoryChangeMetadataCommand changeMetadataCommand=new RepositoryChangeMetadataCommand((Node)node,schemaParam.getName() + "String_Node_Str" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName(),value,table,null,null);
  cc.add(changeMetadataCommand);
  QueryGuessCommand queryGuessCommand=new QueryGuessCommand((Node)node,node.getMetadataList().get(0),schema,dbType,databaseConnection);
  cc.add(queryGuessCommand);
  cc.execute();
  IElementParameter query=node.getElementParameter("String_Node_Str");
  memoSQL=query.getValue().toString();
}

Fixed version (ground truth):
public void convertToProcessNode(ConnectionItem connectionItem,String tableName) throws ProcessorException {
  EDatabaseComponentName name=EDatabaseComponentName.getCorrespondingComponentName(connectionItem,ERepositoryObjectType.METADATA_CONNECTIONS);
  String componentName=null;
  componentName=name.getDefaultComponentName();
  IComponent dbInputComponent=ComponentsFactoryProvider.getInstance().get(componentName);
  Process process=new Process(GuessSchemaProcess.getNewmockProperty());
  node=new Node(dbInputComponent,process);
  selectedContext=node.getProcess().getContextManager().getDefaultContext();
  IMetadataTable table=UpdateRepositoryUtils.getTableByName(connectionItem,tableName);
  if (table == null) {
    table=new MetadataTable();
    table.setTableName(tableName);
    table.setLabel(tableName);
  }
  IElementParameter propertyParam=((Node)node).getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
  IElementParameter schemaParam=((Node)node).getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
  String propertyId=connectionItem.getProperty().getId();
  String schema=databaseConnection.getUiSchema();
  String dbType=databaseConnection.getDatabaseType();
  String value=connectionItem.getProperty().getId() + "String_Node_Str" + table.getLabel();
  CompoundCommand cc=new CompoundCommand();
  ChangeValuesFromRepository changeValueCommand=new ChangeValuesFromRepository((Node)node,databaseConnection,propertyParam.getName() + "String_Node_Str" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(),propertyId);
  cc.add(changeValueCommand);
  RepositoryChangeMetadataCommand changeMetadataCommand=new RepositoryChangeMetadataCommand((Node)node,schemaParam.getName() + "String_Node_Str" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName(),value,table,null,null);
  cc.add(changeMetadataCommand);
  QueryGuessCommand queryGuessCommand=new QueryGuessCommand((Node)node,node.getMetadataList().get(0),schema,dbType,databaseConnection);
  cc.add(queryGuessCommand);
  cc.execute();
  IElementParameter query=node.getElementParameter("String_Node_Str");
  memoSQL=query.getValue().toString();
  String memoSQLTemp=TalendTextUtils.removeQuotesIfExist(memoSQL);
  if ((memoSQLTemp == null || memoSQLTemp.equals("String_Node_Str")) && tableName != null && !tableName.equals("String_Node_Str")) {
    memoSQL="String_Node_Str" + tableName;
    memoSQL=TalendTextUtils.addSQLQuotes(memoSQL);
  }
}