Program: 121246
Project: 121246
Buggy source:
@SuppressWarnings("String_Node_Str") private String getSqlStatement(){
  String sql="String_Node_Str";
  List<String> tables=new ArrayList<String>();
  List<String> columns=new ArrayList<String>();
  List<String> wheres=new ArrayList<String>();
  if (editor != null) {
    if (editor.getViewer().getContents() instanceof ErDiagramPart) {
      String schemaPrefix="String_Node_Str".equals(getSchema()) ? "String_Node_Str" : getSchema() + "String_Node_Str";
      String schemaPrefixWithDoubleQuotes="String_Node_Str".equals(getSchema()) ? "String_Node_Str" : "String_Node_Str" + getSchema() + "String_Node_Str";
      ErDiagramPart er=(ErDiagramPart)editor.getViewer().getContents();
      for (      Object object : er.getChildren()) {
        if (object instanceof TablePart) {
          TablePart tablePart=(TablePart)object;
          Table table=(Table)tablePart.getModel();
          if (TextUtil.isDoubleQuotesNeededDbType(getCurrentDbType())) {
            tables.add(schemaPrefixWithDoubleQuotes + "String_Node_Str" + table.getElementName()+ "String_Node_Str");
          }
 else {
            tables.add(schemaPrefix + TalendTextUtils.addQuotesWithSpaceField(table.getElementName(),getCurrentDbType()));
          }
          boolean oracleDbType=TextUtil.isOracleDbType(getCurrentDbType());
          for (          Object obj : tablePart.getChildren()) {
            if (obj instanceof ColumnPart) {
              ColumnPart columnPart=(ColumnPart)obj;
              Column column=(Column)columnPart.getModel();
              CheckBox isSelected=columnPart.getPrimativeFigure().getFigureCustomColumnIsSelectedFigure();
              if (isSelected != null && isSelected.isSelected() && !column.getElementName().equals("String_Node_Str")) {
                if (TextUtil.isDoubleQuotesNeededDbType(getCurrentDbType())) {
                  columns.add(schemaPrefixWithDoubleQuotes + "String_Node_Str" + table.getElementName()+ "String_Node_Str"+ column.getElementName()+ "String_Node_Str");
                }
 else {
                  String leftQuote=TalendTextUtils.getQuoteByDBType(getCurrentDbType(),true);
                  String rightQuote=TalendTextUtils.getQuoteByDBType(getCurrentDbType(),false);
                  String columnContent=column.getElementName();
                  Pattern pattern=Pattern.compile("String_Node_Str");
                  Matcher matcher=pattern.matcher(columnContent);
                  EDatabaseTypeName dbType=EDatabaseTypeName.getTypeFromDbType(getCurrentDbType());
                  boolean sqlKeyword=KeywordsValidator.isSqlKeyword(column.getElementName(),dbType.getProduct());
                  if (!matcher.matches() || (sqlKeyword && oracleDbType)) {
                    columns.add(schemaPrefix + TalendTextUtils.addQuotesWithSpaceField(table.getElementName(),getCurrentDbType()) + "String_Node_Str"+ TalendTextUtils.addQuotesWithSpaceField(leftQuote + column.getElementName() + rightQuote,getCurrentDbType()));
                  }
 else {
                    columns.add(schemaPrefix + TalendTextUtils.addQuotesWithSpaceField(table.getElementName(),getCurrentDbType()) + "String_Node_Str"+ TalendTextUtils.addQuotesWithSpaceField(column.getElementName(),getCurrentDbType()));
                  }
                }
              }
              for (              Relation rel : (List<Relation>)column.getOutputs()) {
                Column source=rel.getSource();
                Column target=rel.getTarget();
                if (TextUtil.isDoubleQuotesNeededDbType(getCurrentDbType())) {
                  String where1=schemaPrefixWithDoubleQuotes + "String_Node_Str" + source.getTable().getElementName()+ "String_Node_Str"+ source.getElementName()+ "String_Node_Str"+ schemaPrefixWithDoubleQuotes+ "String_Node_Str"+ target.getTable().getElementName()+ "String_Node_Str"+ target.getElementName()+ "String_Node_Str";
                  if (!wheres.contains(where1)) {
                    wheres.add(where1);
                  }
                }
 else {
                  String where1=schemaPrefix + TalendTextUtils.addQuotesWithSpaceField(source.getTable().getElementName(),getCurrentDbType()) + "String_Node_Str"+ TalendTextUtils.addQuotesWithSpaceField(source.getElementName(),getCurrentDbType())+ "String_Node_Str"+ schemaPrefix+ TalendTextUtils.addQuotesWithSpaceField(target.getTable().getElementName(),getCurrentDbType())+ "String_Node_Str"+ TalendTextUtils.addQuotesWithSpaceField(target.getElementName(),getCurrentDbType());
                  if (!wheres.contains(where1)) {
                    wheres.add(where1);
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  sql=getSelectStatement(tables,columns,wheres);
  if (sql.endsWith("String_Node_Str")) {
    return sql.substring(0,sql.length() - 1);
  }
 else   if (sql.endsWith("String_Node_Str")) {
    return sql.substring(0,sql.length() - 5);
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private String getSqlStatement(){
  String sql="String_Node_Str";
  List<String> tables=new ArrayList<String>();
  List<String> columns=new ArrayList<String>();
  List<String> wheres=new ArrayList<String>();
  if (editor != null) {
    if (editor.getViewer().getContents() instanceof ErDiagramPart) {
      String schemaPrefix="String_Node_Str".equals(getSchema()) ? "String_Node_Str" : getSchema() + "String_Node_Str";
      String schemaPrefixWithDoubleQuotes="String_Node_Str".equals(getSchema()) ? "String_Node_Str" : "String_Node_Str" + getSchema() + "String_Node_Str";
      ErDiagramPart er=(ErDiagramPart)editor.getViewer().getContents();
      for (      Object object : er.getChildren()) {
        if (object instanceof TablePart) {
          TablePart tablePart=(TablePart)object;
          Table table=(Table)tablePart.getModel();
          if (TextUtil.isDoubleQuotesNeededDbType(getCurrentDbType())) {
            tables.add(schemaPrefixWithDoubleQuotes + "String_Node_Str" + table.getElementName()+ "String_Node_Str");
          }
 else {
            tables.add(schemaPrefix + TalendTextUtils.addQuotesWithSpaceField(table.getElementName(),getCurrentDbType()));
          }
          boolean oracleDbType=TextUtil.isOracleDbType(getCurrentDbType());
          for (          Object obj : tablePart.getChildren()) {
            if (obj instanceof ColumnPart) {
              ColumnPart columnPart=(ColumnPart)obj;
              Column column=(Column)columnPart.getModel();
              CheckBox isSelected=columnPart.getPrimativeFigure().getFigureCustomColumnIsSelectedFigure();
              if (isSelected != null && isSelected.isSelected() && !column.getElementName().equals("String_Node_Str")) {
                if (TextUtil.isDoubleQuotesNeededDbType(getCurrentDbType())) {
                  columns.add(schemaPrefixWithDoubleQuotes + "String_Node_Str" + table.getElementName()+ "String_Node_Str"+ column.getElementName()+ "String_Node_Str");
                }
 else {
                  String leftQuote=TalendTextUtils.getQuoteByDBType(getCurrentDbType(),true);
                  String rightQuote=TalendTextUtils.getQuoteByDBType(getCurrentDbType(),false);
                  String columnContent=column.getElementName();
                  Pattern pattern=Pattern.compile("String_Node_Str");
                  Matcher matcher=pattern.matcher(columnContent);
                  EDatabaseTypeName dbType=EDatabaseTypeName.getTypeFromDbType(getCurrentDbType());
                  boolean sqlKeyword=KeywordsValidator.isSqlKeyword(column.getElementName(),dbType.getProduct());
                  if (!matcher.matches() || (sqlKeyword && oracleDbType)) {
                    columns.add(schemaPrefix + TalendTextUtils.addQuotesWithSpaceField(table.getElementName(),getCurrentDbType()) + "String_Node_Str"+ TalendTextUtils.addQuotesWithSpaceField(leftQuote + column.getElementName() + rightQuote,getCurrentDbType()));
                  }
 else {
                    columns.add(schemaPrefix + TalendTextUtils.addQuotesWithSpaceField(table.getElementName(),getCurrentDbType()) + "String_Node_Str"+ TalendTextUtils.addQuotesWithSpaceField(column.getElementName(),getCurrentDbType()));
                  }
                }
              }
              for (              Relation rel : (List<Relation>)column.getOutputs()) {
                Column source=rel.getSource();
                Column target=rel.getTarget();
                if (TextUtil.isDoubleQuotesNeededDbType(getCurrentDbType())) {
                  String where1=schemaPrefixWithDoubleQuotes + "String_Node_Str" + source.getTable().getElementName()+ "String_Node_Str"+ source.getElementName()+ "String_Node_Str"+ schemaPrefixWithDoubleQuotes+ "String_Node_Str"+ target.getTable().getElementName()+ "String_Node_Str"+ target.getElementName()+ "String_Node_Str";
                  if (!wheres.contains(where1)) {
                    wheres.add(where1);
                  }
                }
 else {
                  String where1=schemaPrefix + TalendTextUtils.addQuotesWithSpaceField(source.getTable().getElementName(),getCurrentDbType()) + "String_Node_Str"+ TalendTextUtils.addQuotesWithSpaceField(source.getElementName(),getCurrentDbType())+ "String_Node_Str"+ schemaPrefix+ TalendTextUtils.addQuotesWithSpaceField(target.getTable().getElementName(),getCurrentDbType())+ "String_Node_Str"+ TalendTextUtils.addQuotesWithSpaceField(target.getElementName(),getCurrentDbType());
                  if (!wheres.contains(where1)) {
                    wheres.add(where1);
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  Connection conn=null;
  if (rootNode != null) {
    Item connectionItem=rootNode.getObject().getProperty().getItem();
    if (connectionItem instanceof ConnectionItem) {
      conn=((ConnectionItem)connectionItem).getConnection();
    }
  }
  if (getCurrentDbType() != null && (getCurrentDbType().equals(EDatabaseTypeName.MSSQL.getDisplayName()) || getCurrentDbType().equals(EDatabaseTypeName.MSSQL.name())) && conn != null) {
    List<String> newTables=new ArrayList<String>();
    for (    String str : tables) {
      newTables.add(getMssqlCatalog(str,conn));
    }
    tables=newTables;
  }
  sql=getSelectStatement(tables,columns,wheres);
  if (sql.endsWith("String_Node_Str")) {
    return sql.substring(0,sql.length() - 1);
  }
 else   if (sql.endsWith("String_Node_Str")) {
    return sql.substring(0,sql.length() - 5);
  }
  return "String_Node_Str";
}