Buggy code:
public class SQLGenerator implements SQLQueryGenerator { private static final long serialVersionUID = 7477161929752147045L ; private static final String EQ_OPERATOR = "%s<seq2seq4repair_space>=<seq2seq4repair_space>%s" ; private static final String NEQ_OPERATOR = "%s<seq2seq4repair_space><><seq2seq4repair_space>%s" ; private static final String GT_OPERATOR = "%s<seq2seq4repair_space>><seq2seq4repair_space>%s" ; private static final String GTE_OPERATOR = "%s<seq2seq4repair_space>>=<seq2seq4repair_space>%s" ; private static final String LT_OPERATOR = "%s<seq2seq4repair_space><<seq2seq4repair_space>%s" ; private static final String LTE_OPERATOR = "%s<seq2seq4repair_space><=<seq2seq4repair_space>%s" ; private static final String AND_OPERATOR = "%s<seq2seq4repair_space>AND<seq2seq4repair_space>%s" ; private static final String OR_OPERATOR = "%s<seq2seq4repair_space>OR<seq2seq4repair_space>%s" ; private static final String NOT_OPERATOR = "NOT<seq2seq4repair_space>%s" ; private static final String IS_NULL_OPERATOR = "%s<seq2seq4repair_space>IS<seq2seq4repair_space>NULL" ; private static final String IS_NOT_NULL_OPERATOR = "%s<seq2seq4repair_space>IS<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL" ; private static final String ADD_OPERATOR = "%s<seq2seq4repair_space>+<seq2seq4repair_space>%s" ; private static final String SUBSTRACT_OPERATOR = "%s<seq2seq4repair_space>-<seq2seq4repair_space>%s" ; private static final String MULTIPLY_OPERATOR = "%s<seq2seq4repair_space>*<seq2seq4repair_space>%s" ; private static final String LIKE_OPERATOR = "%s<seq2seq4repair_space>LIKE<seq2seq4repair_space>%s" ; private static final String INDENT = "<seq2seq4repair_space>" ; private static final String IS_TRUE_OPERATOR = "%s<seq2seq4repair_space>IS<seq2seq4repair_space>TRUE" ; private static final String VIEW_NAME = "QVIEW%s" ; private final DBMetadata metadata ; private final JDBCUtility jdbcutil ; private final SQLDialectAdapter sqladapter ; private boolean isDistinct = false ; private boolean isOrderBy = false ; private boolean isSI = false ; private Map < String , Integer > uriRefIds ; private static final Logger log = LoggerFactory . getLogger ( SQLGenerator . class ) ; public SQLGenerator ( DBMetadata metadata , JDBCUtility jdbcutil , SQLDialectAdapter sqladapter ) { } @ Override public void setUriIds ( Map < String , Integer > uriid ) { } @ Override public String generateSourceQuery ( DatalogProgram query , List < String > signature ) throws OBDAException { } private boolean hasSelectDistinctStatement ( DatalogProgram query ) { } private boolean hasOrderByClause ( DatalogProgram query ) { } private String generateQuery ( DatalogProgram query , List < String > signature , String indent ) throws OBDAException { } private LinkedHashSet < String > getBooleanConditionsString ( List < Function > atoms , SQLGenerator . QueryAliasIndex index ) { } private String getSQLCondition ( Function atom , SQLGenerator . QueryAliasIndex index ) { } private String getTableDefinitions ( List < Function > inneratoms , SQLGenerator . QueryAliasIndex index , boolean isTopLevel , boolean isLeftJoin , String indent ) { } private String getTableDefinition ( Function atom , SQLGenerator . QueryAliasIndex index , String indent ) { } private String getFROM ( CQIE query , SQLGenerator . QueryAliasIndex index ) { } private String getConditionsString ( List < Function > atoms , SQLGenerator . QueryAliasIndex index , boolean processShared , String indent ) { } private Set < Variable > getVariableReferencesWithLeftJoin ( Function atom ) { } private LinkedHashSet < String > getConditionsSharedVariablesAndConstants ( List < Function > atoms , SQLGenerator . QueryAliasIndex index , boolean processShared ) { } private int getVariableDataType ( Term term , SQLGenerator . QueryAliasIndex idx ) { } private String getWHERE ( CQIE query , SQLGenerator . QueryAliasIndex index ) { } private String getSelectClause ( List < String > signature , CQIE query , SQLGenerator . QueryAliasIndex index , boolean distinct ) throws OBDAException { List < Term > headterms = query . getHead ( ) . getTerms ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( "SELECT<seq2seq4repair_space>" ) ; if ( distinct ) { sb . append ( "DISTINCT<seq2seq4repair_space>" ) ; } if ( ( headterms . size ( ) ) == 0 ) { <START_BUG> sb . append ( "true<seq2seq4repair_space>as<seq2seq4repair_space>x" ) ; <END_BUG> return sb . toString ( ) ; } Iterator < Term > hit = headterms . iterator ( ) ; int hpos = 0 ; while ( hit . hasNext ( ) ) { Term ht = hit . next ( ) ; String typeColumn = getTypeColumnForSELECT ( ht , signature , hpos ) ; String langColumn = getLangColumnForSELECT ( ht , signature , hpos , index ) ; String mainColumn = getMainColumnForSELECT ( ht , signature , hpos , index ) ; sb . append ( "\n<seq2seq4repair_space>" ) ; sb . append ( typeColumn ) ; sb . append ( ",<seq2seq4repair_space>" ) ; sb . append ( langColumn ) ; sb . append ( ",<seq2seq4repair_space>" ) ; sb . append ( mainColumn ) ; if ( hit . hasNext ( ) ) { sb . append ( ",<seq2seq4repair_space>" ) ; } hpos ++ ; } return sb . toString ( ) ; } private String getMainColumnForSELECT ( Term ht , List < String > signature , int hpos , SQLGenerator . QueryAliasIndex index ) { } private String getLangColumnForSELECT ( Term ht , List < String > signature , int hpos , SQLGenerator . QueryAliasIndex index ) { } private String getTypeColumnForSELECT ( Term ht , List < String > signature , int hpos ) { } public String getSQLStringForTemplateFunction ( Function ov , SQLGenerator . QueryAliasIndex index ) { } private String getStringConcatenation ( SQLDialectAdapter adapter , String [ ] params ) { } private boolean isStringColType ( Term term , SQLGenerator . QueryAliasIndex index ) { } private String trim ( String string ) { } private boolean isUnary ( Function fun ) { } private boolean isBinary ( Function fun ) { } public String getSQLString ( Term term , SQLGenerator . QueryAliasIndex index , boolean useBrackets ) { } private int getUriid ( String uri ) { } private String getBooleanOperatorString ( Predicate functionSymbol ) { } private String getNumericalOperatorString ( Predicate functionSymbol ) { } public class QueryAliasIndex { Map < Function , String > viewNames = new HashMap < Function , String > ( ) ; Map < Function , String > tableNames = new HashMap < Function , String > ( ) ; Map < Function , DataDefinition > dataDefinitions = new HashMap < Function , DataDefinition > ( ) ; Map < Variable , LinkedHashSet < String > > columnReferences = new HashMap < Variable , LinkedHashSet < String > > ( ) ; int dataTableCount = 0 ; boolean isEmpty = false ; public QueryAliasIndex ( CQIE query ) { }

Fix:
sb . append ( "'true'<seq2seq4repair_space>as<seq2seq4repair_space>x" ) ;