Buggy code:
private + ( JDBCMsgRepository . JID_ID_COLUMN ) ) + "<seq2seq4repair_space>where<seq2seq4repair_space>" ) + ( JDBCMsgRepository . MSG_TO_UID_COLUMN ) ) + "<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>" ; private static final String MSG_DELETE_TO_JID_QUERY = ( ( ( "delete<seq2seq4repair_space>from<seq2seq4repair_space>" + ( JDBCMsgRepository . MSG_TABLE ) ) + "<seq2seq4repair_space>where<seq2seq4repair_space>" ) + ( JDBCMsgRepository . MSG_TO_UID_COLUMN ) ) + "<seq2seq4repair_space>=<seq2seq4repair_space>?" ; private static final String MSG_DELETE_IDS_TO_JID_QUERY = ( ( ( JDBCMsgRepository . MSG_DELETE_TO_JID_QUERY ) + "<seq2seq4repair_space>AND<seq2seq4repair_space>" ) + ( JDBCMsgRepository . MSG_ID_COLUMN ) ) + "<seq2seq4repair_space>IN<seq2seq4repair_space>(<seq2seq4repair_space>" ; private static final String MSG_DELETE_ID_QUERY = ( ( ( "delete<seq2seq4repair_space>from<seq2seq4repair_space>" + ( JDBCMsgRepository . MSG_TABLE ) ) + "<seq2seq4repair_space>where<seq2seq4repair_space>" ) + ( JDBCMsgRepository . MSG_ID_COLUMN ) ) + "<seq2seq4repair_space>=<seq2seq4repair_space>?" ; private static final String MSG_SELECT_EXPIRED_QUERY = ( "select<seq2seq4repair_space>*<seq2seq4repair_space>from<seq2seq4repair_space>" + ( JDBCMsgRepository . MSG_TABLE ) ) + "<seq2seq4repair_space>where<seq2seq4repair_space>expired<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>null<seq2seq4repair_space>order<seq2seq4repair_space>by<seq2seq4repair_space>expired" ; private static final String MSG_SELECT_EXPIRED_BEFORE_QUERY = ( "select<seq2seq4repair_space>*<seq2seq4repair_space>from<seq2seq4repair_space>" + ( JDBCMsgRepository . MSG_TABLE ) ) + "<seq2seq4repair_space>where<seq2seq4repair_space>expired<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>null<seq2seq4repair_space>and<seq2seq4repair_space>expired<seq2seq4repair_space><=<seq2seq4repair_space>?<seq2seq4repair_space>order<seq2seq4repair_space>by<seq2seq4repair_space>expired" ; private static final String MYSQL_CREATE_BROADCAST_MSGS_TABLE = "create<seq2seq4repair_space>table<seq2seq4repair_space>broadcast_msgs<seq2seq4repair_space>(<seq2seq4repair_space>" + ( ( ( ( "<seq2seq4repair_space>" + "id<seq2seq4repair_space>varchar(128)<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "expired<seq2seq4repair_space>datetime<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "msg<seq2seq4repair_space>varchar(4096)<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "<seq2seq4repair_space>primary<seq2seq4repair_space>key<seq2seq4repair_space>(id))" ) ; private static final String PGSQL_CREATE_BROADCAST_MSGS_TABLE = "create<seq2seq4repair_space>table<seq2seq4repair_space>broadcast_msgs<seq2seq4repair_space>(<seq2seq4repair_space>" + ( ( ( ( "<seq2seq4repair_space>" + "id<seq2seq4repair_space>varchar(128)<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "expired<seq2seq4repair_space>timestamp<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "msg<seq2seq4repair_space>varchar(4096)<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "<seq2seq4repair_space>primary<seq2seq4repair_space>key<seq2seq4repair_space>(id))" ) ; private static final String SQLSERVER_CREATE_BROADCAST_MSGS_TABLE = "create<seq2seq4repair_space>table<seq2seq4repair_space>broadcast_msgs<seq2seq4repair_space>(<seq2seq4repair_space>" + ( ( ( ( "<seq2seq4repair_space>" + "id<seq2seq4repair_space>varchar(128)<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "expired<seq2seq4repair_space>datetime<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "msg<seq2seq4repair_space>nvarchar(4000)<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "<seq2seq4repair_space>primary<seq2seq4repair_space>key<seq2seq4repair_space>(id))" ) ; private static final String DERBY_CREATE_BROADCAST_MSGS_TABLE = "create<seq2seq4repair_space>table<seq2seq4repair_space>broadcast_msgs<seq2seq4repair_space>(<seq2seq4repair_space>" + ( ( ( ( "<seq2seq4repair_space>" + "id<seq2seq4repair_space>varchar(128)<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "expired<seq2seq4repair_space>timestamp<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "msg<seq2seq4repair_space>varchar(4096)<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "<seq2seq4repair_space>primary<seq2seq4repair_space>key<seq2seq4repair_space>(id))" ) ; private static final String MYSQL_CREATE_BROADCAST_MSGS_RECIPIENTS_TABLE = "create<seq2seq4repair_space>table<seq2seq4repair_space>broadcast_msgs_recipients<seq2seq4repair_space>(<seq2seq4repair_space>" + ( ( ( "<seq2seq4repair_space>" + "msg_id<seq2seq4repair_space>varchar(128)<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "jid_id<seq2seq4repair_space>bigint<seq2seq4repair_space>unsigned<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "<seq2seq4repair_space>primary<seq2seq4repair_space>key<seq2seq4repair_space>(msg_id,<seq2seq4repair_space>jid_id))" ) ; private static final String PGSQL_CREATE_BROADCAST_MSGS_RECIPIENTS_TABLE = "create<seq2seq4repair_space>table<seq2seq4repair_space>broadcast_msgs_recipients<seq2seq4repair_space>(<seq2seq4repair_space>" + ( ( ( "<seq2seq4repair_space>" + "msg_id<seq2seq4repair_space>varchar(128)<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "jid_id<seq2seq4repair_space>bigint<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "<seq2seq4repair_space>primary<seq2seq4repair_space>key<seq2seq4repair_space>(msg_id,<seq2seq4repair_space>jid_id))" ) ; private static final String SQLSERVER_CREATE_BROADCAST_MSGS_RECIPIENTS_TABLE = "create<seq2seq4repair_space>table<seq2seq4repair_space>broadcast_msgs_recipients<seq2seq4repair_space>(<seq2seq4repair_space>" + ( ( ( "<seq2seq4repair_space>" + "msg_id<seq2seq4repair_space>varchar(128)<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "jid_id<seq2seq4repair_space>bigint<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "<seq2seq4repair_space>primary<seq2seq4repair_space>key<seq2seq4repair_space>(msg_id,<seq2seq4repair_space>jid_id))" ) ; private static final String DERBY_CREATE_BROADCAST_MSGS_RECIPIENTS_TABLE = "create<seq2seq4repair_space>table<seq2seq4repair_space>broadcast_msgs_recipients<seq2seq4repair_space>(<seq2seq4repair_space>" + ( ( ( "<seq2seq4repair_space>" + "msg_id<seq2seq4repair_space>varchar(128)<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "jid_id<seq2seq4repair_space>bigint<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL,<seq2seq4repair_space>" ) + "<seq2seq4repair_space>primary<seq2seq4repair_space>key<seq2seq4repair_space>(msg_id,<seq2seq4repair_space>jid_id))" ) ; private static final String MSG_SELECT_MESSAGES_TO_BROADCAST = "select<seq2seq4repair_space>id,<seq2seq4repair_space>expired,<seq2seq4repair_space>msg<seq2seq4repair_space>from<seq2seq4repair_space>broadcast_msgs<seq2seq4repair_space>where<seq2seq4repair_space>expired<seq2seq4repair_space>>=<seq2seq4repair_space>?" ; private static final String SQLSERVER_MSG_INSERT_MESSAGE_TO_BROADCAST = "insert<seq2seq4repair_space>into<seq2seq4repair_space>broadcast_msgs<seq2seq4repair_space>(id,<seq2seq4repair_space>expired,<seq2seq4repair_space>msg)<seq2seq4repair_space>values<seq2seq4repair_space>(?,<seq2seq4repair_space>?,<seq2seq4repair_space>?)<seq2seq4repair_space>where<seq2seq4repair_space>not<seq2seq4repair_space>exists<seq2seq4repair_space>(select<seq2seq4repair_space>1<seq2seq4repair_space>from<seq2seq4repair_space>broadcast_msgs<seq2seq4repair_space>where<seq2seq4repair_space>id<seq2seq4repair_space>=<seq2seq4repair_space>?)" ; private static final String SQL_MSG_INSERT_MESSAGE_TO_BROADCAST = "insert<seq2seq4repair_space>into<seq2seq4repair_space>broadcast_msgs<seq2seq4repair_space>(id,<seq2seq4repair_space>expired,<seq2seq4repair_space>msg)<seq2seq4repair_space>select<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?<seq2seq4repair_space>from<seq2seq4repair_space>(select<seq2seq4repair_space>1)<seq2seq4repair_space>x<seq2seq4repair_space>where<seq2seq4repair_space>not<seq2seq4repair_space>exists<seq2seq4repair_space>(select<seq2seq4repair_space>1<seq2seq4repair_space>from<seq2seq4repair_space>broadcast_msgs<seq2seq4repair_space>where<seq2seq4repair_space>id<seq2seq4repair_space>=<seq2seq4repair_space>?)" ; private static final String DERBY_MSG_INSERT_MESSAGE_TO_BROADCAST1 = "select<seq2seq4repair_space>id<seq2seq4repair_space>from<seq2seq4repair_space>broadcast_msgs<seq2seq4repair_space>where<seq2seq4repair_space>id<seq2seq4repair_space>=<seq2seq4repair_space>?" ; private static final String DERBY_MSG_INSERT_MESSAGE_TO_BROADCAST2 = "insert<seq2seq4repair_space>into<seq2seq4repair_space>broadcast_msgs<seq2seq4repair_space>(id,<seq2seq4repair_space>expired,<seq2seq4repair_space>msg)<seq2seq4repair_space>values<seq2seq4repair_space>(?,?,?)" ; private static final String MSG_SELECT_BROADCAST_RECIPIENTS = ( ( ( ( ( "select<seq2seq4repair_space>j." + ( JDBCMsgRepository . JID_COLUMN ) ) + "<seq2seq4repair_space>from<seq2seq4repair_space>broadcast_msgs_recipients<seq2seq4repair_space>r<seq2seq4repair_space>join<seq2seq4repair_space>" ) + ( JDBCMsgRepository . JID_TABLE ) ) + "<seq2seq4repair_space>j<seq2seq4repair_space>on<seq2seq4repair_space>j." ) + ( JDBCMsgRepository . JID_ID_COLUMN ) ) + "<seq2seq4repair_space>=<seq2seq4repair_space>r.jid_id<seq2seq4repair_space>where<seq2seq4repair_space>r.msg_id<seq2seq4repair_space>=<seq2seq4repair_space>?" ; private static final String SQLSERVER_MSG_ENSURE_BROADCAT_RECIPIETN = "insert<seq2seq4repair_space>into<seq2seq4repair_space>broadcast_msgs_recipients<seq2seq4repair_space>(msg_id,<seq2seq4repair_space>jid_id)<seq2seq4repair_space>values<seq2seq4repair_space>(?,<seq2seq4repair_space>?)<seq2seq4repair_space>where<seq2seq4repair_space>not<seq2seq4repair_space>exists<seq2seq4repair_space>(select<seq2seq4repair_space>1<seq2seq4repair_space>from<seq2seq4repair_space>broadcast_msgs_recipients<seq2seq4repair_space>where<seq2seq4repair_space>msg_id<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>and<seq2seq4repair_space>jid_id<seq2seq4repair_space>=<seq2seq4repair_space>?)" ; private static final String SQL_MSG_ENSURE_BROADCAT_RECIPIETN = "insert<seq2seq4repair_space>into<seq2seq4repair_space>broadcast_msgs_recipients<seq2seq4repair_space>(msg_id,<seq2seq4repair_space>jid_id)<seq2seq4repair_space>select<seq2seq4repair_space>?,<seq2seq4repair_space>?<seq2seq4repair_space>from<seq2seq4repair_space>(select<seq2seq4repair_space>1)<seq2seq4repair_space>x<seq2seq4repair_space>where<seq2seq4repair_space>not<seq2seq4repair_space>exists<seq2seq4repair_space>(select<seq2seq4repair_space>1<seq2seq4repair_space>from<seq2seq4repair_space>broadcast_msgs_recipients<seq2seq4repair_space>where<seq2seq4repair_space>msg_id<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>and<seq2seq4repair_space>jid_id<seq2seq4repair_space>=<seq2seq4repair_space>?)" ; private static final String DERBY_MSG_ENSURE_BROADCAT_RECIPIETN1 = "select<seq2seq4repair_space>1<seq2seq4repair_space>from<seq2seq4repair_space>broadcast_msgs_recipients<seq2seq4repair_space>where<seq2seq4repair_space>msg_id<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>and<seq2seq4repair_space>jid_id<seq2seq4repair_space>=<seq2seq4repair_space>?" ; private static final String DERBY_MSG_ENSURE_BROADCAT_RECIPIETN2 = "insert<seq2seq4repair_space>into<seq2seq4repair_space>broadcast_msgs_recipients<seq2seq4repair_space>(msg_id,<seq2seq4repair_space>jid_id)<seq2seq4repair_space>values<seq2seq4repair_space>(?,<seq2seq4repair_space>?)" ; private static final String GET_USER_UID_DEF_QUERY = ( ( ( ( ( ( ( "select<seq2seq4repair_space>" + ( JDBCMsgRepository . JID_ID_COLUMN ) ) + ",<seq2seq4repair_space>" ) + ( JDBCMsgRepository . JID_COLUMN ) ) + "<seq2seq4repair_space>from<seq2seq4repair_space>" ) + ( JDBCMsgRepository . JID_TABLE ) ) + "<seq2seq4repair_space>where<seq2seq4repair_space>" ) + ( JDBCMsgRepository . JID_SHA_COLUMN ) ) + "<seq2seq4repair_space>=<seq2seq4repair_space>?" ; private static final String MSG_COUNT_FOR_TO_AND_FROM_QUERY_DEF = ( ( ( ( ( "select<seq2seq4repair_space>count(*)<seq2seq4repair_space>from<seq2seq4repair_space>" + ( JDBCMsgRepository . MSG_TABLE ) ) + "<seq2seq4repair_space>where<seq2seq4repair_space>" ) + ( JDBCMsgRepository . MSG_TO_UID_COLUMN ) ) + "<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>and<seq2seq4repair_space>" ) + ( JDBCMsgRepository . MSG_FROM_UID_COLUMN ) ) + "<seq2seq4repair_space>=<seq2seq4repair_space>?" ; private static final String ADD_USER_JID_ID_QUERY = ( ( ( ( ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>" + ( JDBCMsgRepository . JID_TABLE ) ) + "<seq2seq4repair_space>(<seq2seq4repair_space>" ) + ( JDBCMsgRepository . JID_SHA_COLUMN ) ) + ",<seq2seq4repair_space>" ) + ( JDBCMsgRepository . JID_COLUMN ) ) + ")<seq2seq4repair_space>values<seq2seq4repair_space>(?,<seq2seq4repair_space>?)" ; private static final String GET_USER_UID_PROP_KEY = "user-uid-query" ; private static final String MSGS_COUNT_LIMIT_PROP_KEY = "count-limit-query" ; private static final int MAX_UID_CACHE_SIZE = 100000 ; private static final long MAX_UID_CACHE_TIME = 3600000 ; private DataRepository data_repo = null ; private String uid_query = JDBCMsgRepository . GET_USER_UID_DEF_QUERY ; private String msg_count_for_limit_query = JDBCMsgRepository . MSG_COUNT_FOR_TO_AND_FROM_QUERY_DEF ; private String msg_insert_message_to_broadcast = JDBCMsgRepository . SQL_MSG_INSERT_MESSAGE_TO_BROADCAST ; private String msg_ensure_broadcast_recipient = JDBCMsgRepository . SQL_MSG_ENSURE_BROADCAT_RECIPIETN ; private long msgs_store_limit = MSGS_STORE_LIMIT_VAL ; private boolean initialized = false ; private Map < BareJID , Long > uids_cache = Collections . synchronizedMap ( new tigase . util . SimpleCache < BareJID , Long > ( JDBCMsgRepository . MAX_UID_CACHE_SIZE , JDBCMsgRepository . MAX_UID_CACHE_TIME ) ) ; @ Override public void initRepository ( String conn_str , Map < String , String > map ) throws DBInitException { } @ Override public Map < MSG_TYPES , Long > getMessagesCount ( JID to ) throws UserNotFoundException { } @ Override public List < Element > getMessagesList ( JID to ) throws UserNotFoundException { } @ Override public Queue < Element > loadMessagesToJID ( List < String > db_ids , JID to , boolean delete , OfflineMessagesProcessor proc ) throws UserNotFoundException { } @ Override public int deleteMessagesToJID ( List < String > db_ids , JID to ) throws UserNotFoundException { } @ Override public Queue < Element > loadMessagesToJID ( JID to , boolean delete ) throws UserNotFoundException { } public Queue < Element > loadMessagesToJID ( JID to , boolean delete , OfflineMessagesProcessor proc ) throws UserNotFoundException { } private Queue < Element > parseLoadedMessages ( OfflineMessagesProcessor proc , ResultSet rs ) throws SQLException { } @ Override public void storeMessage ( JID from , JID to , Date expired , Element msg ) throws UserNotFoundException { } @ Override public void loadMessagesToBroadcast ( ) { } @ Override protected void insertBroadcastMessage ( String id , Element msg , Date expire , BareJID recipient ) { } @ Override protected void ensureBroadcastMessageRecipient ( String id , BareJID recipient ) { } private long addUserJID ( BareJID bareJID ) throws SQLException , UserNotFoundException { } private void checkDB ( ) throws SQLException { Statement stmt = null ; try { stmt = data_repo . createStatement ( null ) ; stmt . executeQuery ( ( ( ( ( ( ( "select<seq2seq4repair_space>" + ( JDBCMsgRepository . MSG_TYPE_COLUMN ) ) + "<seq2seq4repair_space>from<seq2seq4repair_space>" ) + ( JDBCMsgRepository . MSG_TABLE ) ) + "<seq2seq4repair_space>where<seq2seq4repair_space>" ) + ( JDBCMsgRepository . MSG_ID_COLUMN ) ) + "<seq2seq4repair_space>=<seq2seq4repair_space>0" ) ) ; } catch ( SQLException ex ) { JDBCMsgRepository . log . log ( Level . INFO , ( ( JDBCMsgRepository . MSG_TABLE ) + "<seq2seq4repair_space>table<seq2seq4repair_space>was<seq2seq4repair_space>in<seq2seq4repair_space>old<seq2seq4repair_space>version,<seq2seq4repair_space>performing<seq2seq4repair_space>update<seq2seq4repair_space>to<seq2seq4repair_space>add<seq2seq4repair_space>missing<seq2seq4repair_space>column" ) ) ; String alterTable = null ; try { <START_BUG> alterTable = ( ( ( "alter<seq2seq4repair_space>table<seq2seq4repair_space>" + ( JDBCMsgRepository . MSG_TABLE ) ) + "<seq2seq4repair_space>add<seq2seq4repair_space>" ) + ( JDBCMsgRepository . MSG_TYPE_COLUMN ) ) + "<seq2seq4repair_space>int<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL;" ; <END_BUG>

Fix:
alterTable = ( ( ( "alter<seq2seq4repair_space>table<seq2seq4repair_space>" + ( JDBCMsgRepository . MSG_TABLE ) ) + "<seq2seq4repair_space>add<seq2seq4repair_space>" ) + ( JDBCMsgRepository . MSG_TYPE_COLUMN ) ) + "<seq2seq4repair_space>int<seq2seq4repair_space>NOT<seq2seq4repair_space>NULL" ;