Program: 138436
Project: 138436
Buggy source:
@Override protected String createSqlStatement(Analysis analysis){
  if (isDelimitedFile) {
    return "String_Node_Str";
  }
  this.cachedAnalysis=analysis;
  StringBuilder sql=new StringBuilder("String_Node_Str");
  EList<Indicator> indicators=analysis.getResults().getIndicators();
  EList<MetadataColumn> analysedElements=null;
  for (  Indicator indicator : indicators) {
    if (ColumnsetPackage.eINSTANCE.getColumnSetMultiValueIndicator().isSuperTypeOf(indicator.eClass())) {
      ColumnSetMultiValueIndicator colSetMultValIndicator=(ColumnSetMultiValueIndicator)indicator;
      if (analysedElements == null) {
        analysedElements=colSetMultValIndicator.getAnalyzedColumns();
      }
 else {
        analysedElements.addAll(colSetMultValIndicator.getAnalyzedColumns());
      }
    }
  }
  if (analysedElements == null || analysedElements.isEmpty()) {
    this.errorMessage=Messages.getString("String_Node_Str",analysis.getName());
    return null;
  }
  Set<ColumnSet> fromPart=new HashSet<ColumnSet>();
  final Iterator<MetadataColumn> iterator=analysedElements.iterator();
  while (iterator.hasNext()) {
    ModelElement modelElement=iterator.next();
    TdColumn col=SwitchHelpers.COLUMN_SWITCH.doSwitch(modelElement);
    if (col == null) {
      this.errorMessage=Messages.getString("String_Node_Str",modelElement);
      return null;
    }
    Classifier owner=col.getOwner();
    if (owner == null) {
      this.errorMessage=Messages.getString("String_Node_Str",col.getName());
    }
    ColumnSet colSet=SwitchHelpers.COLUMN_SET_SWITCH.doSwitch(owner);
    if (colSet == null) {
      this.errorMessage=Messages.getString("String_Node_Str",col.getName(),colSet);
      return null;
    }
    if (!analysis.getParameters().isStoreData()) {
      sql.append(this.quote(col.getName()));
      if (iterator.hasNext()) {
        sql.append(',');
      }
    }
    fromPart.add(colSet);
  }
  if (fromPart.size() != 1) {
    log.error("String_Node_Str" + fromPart.size() + "String_Node_Str");
    this.errorMessage="String_Node_Str";
    return null;
  }
  if (analysis.getParameters().isStoreData()) {
    List<TdColumn> columnList=TableHelper.getColumns(SwitchHelpers.TABLE_SWITCH.doSwitch(analysedElements.get(0).eContainer()));
    Iterator<TdColumn> iter=columnList.iterator();
    while (iter.hasNext()) {
      TdColumn column=iter.next();
      sql.append(this.quote(column.getName()));
      if (iter.hasNext()) {
        sql.append(',');
      }
    }
  }
  sql.append(dbms().from());
  ModelElement element=fromPart.iterator().next();
  Package parentRelation=PackageHelper.getParentPackage((MetadataTable)fromPart.iterator().next());
  if (parentRelation instanceof Schema) {
    sql.append(dbms().toQualifiedName(null,parentRelation.getName(),element.getName()));
  }
 else   if (parentRelation instanceof Catalog) {
    String ownerUser=null;
    if (ConnectionUtils.isSybaseeDBProducts(dbms().getDbmsName())) {
      ownerUser=ColumnSetHelper.getTableOwner((ModelElement)element);
    }
    sql.append(dbms().toQualifiedName(parentRelation.getName(),ownerUser,element.getName()));
  }
  ModelElementAnalysisHandler handler=new ModelElementAnalysisHandler();
  handler.setAnalysis(analysis);
  String stringDataFilter=handler.getStringDataFilter();
  sql.append(GenericSQLHandler.WHERE_CLAUSE);
  String sqlStatement=sql.toString();
  sqlStatement=dbms().addWhereToStatement(sqlStatement,stringDataFilter);
  return sqlStatement;
}

Fixed version (ground truth):
@Override protected String createSqlStatement(Analysis analysis){
  if (isDelimitedFile) {
    return "String_Node_Str";
  }
  this.cachedAnalysis=analysis;
  StringBuilder sql=new StringBuilder("String_Node_Str");
  EList<Indicator> indicators=analysis.getResults().getIndicators();
  EList<ModelElement> analysedElements=null;
  for (  Indicator indicator : indicators) {
    if (ColumnsetPackage.eINSTANCE.getColumnSetMultiValueIndicator().isSuperTypeOf(indicator.eClass())) {
      ColumnSetMultiValueIndicator colSetMultValIndicator=(ColumnSetMultiValueIndicator)indicator;
      if (analysedElements == null) {
        analysedElements=colSetMultValIndicator.getAnalyzedColumns();
      }
 else {
        analysedElements.addAll(colSetMultValIndicator.getAnalyzedColumns());
      }
    }
  }
  if (analysedElements == null || analysedElements.isEmpty()) {
    this.errorMessage=Messages.getString("String_Node_Str",analysis.getName());
    return null;
  }
  Set<ColumnSet> fromPart=new HashSet<ColumnSet>();
  final Iterator<ModelElement> iterator=analysedElements.iterator();
  while (iterator.hasNext()) {
    ModelElement modelElement=iterator.next();
    TdColumn col=SwitchHelpers.COLUMN_SWITCH.doSwitch(modelElement);
    if (col == null) {
      this.errorMessage=Messages.getString("String_Node_Str",modelElement);
      return null;
    }
    Classifier owner=col.getOwner();
    if (owner == null) {
      this.errorMessage=Messages.getString("String_Node_Str",col.getName());
    }
    ColumnSet colSet=SwitchHelpers.COLUMN_SET_SWITCH.doSwitch(owner);
    if (colSet == null) {
      this.errorMessage=Messages.getString("String_Node_Str",col.getName(),colSet);
      return null;
    }
    if (!analysis.getParameters().isStoreData()) {
      sql.append(this.quote(col.getName()));
      if (iterator.hasNext()) {
        sql.append(',');
      }
    }
    fromPart.add(colSet);
  }
  if (fromPart.size() != 1) {
    log.error("String_Node_Str" + fromPart.size() + "String_Node_Str");
    this.errorMessage="String_Node_Str";
    return null;
  }
  if (analysis.getParameters().isStoreData()) {
    List<TdColumn> columnList=TableHelper.getColumns(SwitchHelpers.TABLE_SWITCH.doSwitch(analysedElements.get(0).eContainer()));
    Iterator<TdColumn> iter=columnList.iterator();
    while (iter.hasNext()) {
      TdColumn column=iter.next();
      sql.append(this.quote(column.getName()));
      if (iter.hasNext()) {
        sql.append(',');
      }
    }
  }
  sql.append(dbms().from());
  ModelElement element=fromPart.iterator().next();
  Package parentRelation=PackageHelper.getParentPackage((MetadataTable)fromPart.iterator().next());
  if (parentRelation instanceof Schema) {
    sql.append(dbms().toQualifiedName(null,parentRelation.getName(),element.getName()));
  }
 else   if (parentRelation instanceof Catalog) {
    String ownerUser=null;
    if (ConnectionUtils.isSybaseeDBProducts(dbms().getDbmsName())) {
      ownerUser=ColumnSetHelper.getTableOwner((ModelElement)element);
    }
    sql.append(dbms().toQualifiedName(parentRelation.getName(),ownerUser,element.getName()));
  }
  ModelElementAnalysisHandler handler=new ModelElementAnalysisHandler();
  handler.setAnalysis(analysis);
  String stringDataFilter=handler.getStringDataFilter();
  sql.append(GenericSQLHandler.WHERE_CLAUSE);
  String sqlStatement=sql.toString();
  sqlStatement=dbms().addWhereToStatement(sqlStatement,stringDataFilter);
  return sqlStatement;
}