Buggy code:
public class MysqlPersistenceService implements QueryablePersistenceService , ManagedService { private static final Pattern EXTRACT_CONFIG_PATTERN = Pattern . compile ( "^(.*?)\\.([0-9.a-zA-Z]+)$" ) ; private static final Logger logger = LoggerFactory . getLogger ( MysqlPersistenceService . class ) ; private String driverClass = "com.mysql.jdbc.Driver" ; private String url ; private String user ; private String password ; private boolean initialized = false ; protected ItemRegistry itemRegistry ; private PersistentStateRestorer persistentStateRestorer ; private int errCnt ; private int errReconnectThreshold = 0 ; private int waitTimeout = - 1 ; private Connection connection = null ; private Map < String , String > sqlTables = new HashMap < String , String > ( ) ; private Map < String , String > sqlTypes = new HashMap < String , String > ( ) ; public void activate ( ) { } public void deactivate ( ) { } public void setItemRegistry ( ItemRegistry itemRegistry ) { } public void unsetItemRegistry ( ItemRegistry itemRegistry ) { } public void setPersistentStateRestorer ( PersistentStateRestorer persistentStateRestorer ) { } public void unsetPersistentStateRestorer ( PersistentStateRestorer persistentStateRestorer ) { } public String getName ( ) { } private String getTable ( Item item ) { Statement statement = null ; String sqlCmd = null ; int rowId = 0 ; String itemName = item . getName ( ) ; String tableName = sqlTables . get ( itemName ) ; if ( tableName != null ) return tableName ; try { sqlCmd = new String ( ( ( "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>Items<seq2seq4repair_space>(ItemName)<seq2seq4repair_space>VALUES<seq2seq4repair_space>('" + itemName ) + "')" ) ) ; statement = connection . createStatement ( ) ; statement . executeUpdate ( sqlCmd , Statement . RETURN_GENERATED_KEYS ) ; ResultSet resultSet = statement . getGeneratedKeys ( ) ; if ( ( resultSet != null ) && ( resultSet . next ( ) ) ) { rowId = resultSet . getInt ( 1 ) ; } if ( rowId == 0 ) { throw new SQLException ( ( ( "mySQL:<seq2seq4repair_space>Creating<seq2seq4repair_space>table<seq2seq4repair_space>for<seq2seq4repair_space>item<seq2seq4repair_space>'" + itemName ) + "'<seq2seq4repair_space>failed." ) ) ; } tableName = new String ( ( "Item" + rowId ) ) ; MysqlPersistenceService . logger . debug ( "mySQL:<seq2seq4repair_space>new<seq2seq4repair_space>item<seq2seq4repair_space>{}<seq2seq4repair_space>is<seq2seq4repair_space>Item{}" , itemName , rowId ) ; } catch ( SQLException e ) { <START_BUG> MysqlPersistenceService . logger . error ( "mySQL:<seq2seq4repair_space>Could<seq2seq4repair_space>not<seq2seq4repair_space>create<seq2seq4repair_space>table<seq2seq4repair_space>for<seq2seq4repair_space>item<seq2seq4repair_space>'{}':<seq2seq4repair_space>" , itemName , e . getMessage ( ) ) ; <END_BUG> } finally { if ( statement != null ) { try { statement . close ( ) ; } catch ( SQLException logOrIgnore ) { } } } if ( tableName == null ) { MysqlPersistenceService . logger . error ( "mySQL:<seq2seq4repair_space>tableName<seq2seq4repair_space>was<seq2seq4repair_space>null" ) ; return null ; } String mysqlType = new String ( "DOUBLE" ) ; String itemType = item . getClass ( ) . toString ( ) . toUpperCase ( ) ; itemType = itemType . substring ( ( ( itemType . lastIndexOf ( '.' ) ) + 1 ) ) ; if ( ( sqlTypes . get ( itemType ) ) != null ) { mysqlType = sqlTypes . get ( itemType ) ; } sqlCmd = new String ( ( ( ( ( "CREATE<seq2seq4repair_space>TABLE<seq2seq4repair_space>" + tableName ) + "<seq2seq4repair_space>(Time<seq2seq4repair_space>DATETIME,<seq2seq4repair_space>Value<seq2seq4repair_space>" ) + mysqlType ) + ",<seq2seq4repair_space>PRIMARY<seq2seq4repair_space>KEY(Time));" ) ) ; MysqlPersistenceService . logger . debug ( ( "SQL:<seq2seq4repair_space>" + sqlCmd ) ) ; try { statement = connection . createStatement ( ) ; statement . executeUpdate ( sqlCmd ) ; MysqlPersistenceService . logger . debug ( ( ( ( ( "mySQL:<seq2seq4repair_space>Table<seq2seq4repair_space>created<seq2seq4repair_space>for<seq2seq4repair_space>item<seq2seq4repair_space>'" + itemName ) + "'<seq2seq4repair_space>with<seq2seq4repair_space>datatype<seq2seq4repair_space>" ) + mysqlType ) + "<seq2seq4repair_space>in<seq2seq4repair_space>SQL<seq2seq4repair_space>database." ) ) ; sqlTables . put ( itemName , tableName ) ; } catch ( Exception e ) { MysqlPersistenceService . logger . error ( ( ( ( ( ( "mySQL:<seq2seq4repair_space>Could<seq2seq4repair_space>not<seq2seq4repair_space>create<seq2seq4repair_space>table<seq2seq4repair_space>for<seq2seq4repair_space>item<seq2seq4repair_space>'" + itemName ) + "'<seq2seq4repair_space>with<seq2seq4repair_space>statement<seq2seq4repair_space>'" ) + sqlCmd ) + "':<seq2seq4repair_space>" ) + ( e . getMessage ( ) ) ) ) ; } finally { if ( statement != null ) { try { statement . close ( ) ; } catch ( Exception hidden ) { } } } if ( ( sqlTables . get ( itemName ) ) == null ) { MysqlPersistenceService . logger . error ( "mySQL:<seq2seq4repair_space>Item<seq2seq4repair_space>'{}'<seq2seq4repair_space>was<seq2seq4repair_space>not<seq2seq4repair_space>added<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>table<seq2seq4repair_space>-<seq2seq4repair_space>removing<seq2seq4repair_space>index" , itemName ) ; sqlCmd = new String ( ( ( "DELETE<seq2seq4repair_space>FROM<seq2seq4repair_space>Items<seq2seq4repair_space>WHERE<seq2seq4repair_space>ItemName='" + itemName ) + "'" ) ) ; MysqlPersistenceService . logger . debug ( "SQL:<seq2seq4repair_space>{}" , sqlCmd ) ; try { statement = connection . createStatement ( ) ; statement . executeUpdate ( sqlCmd ) ; } catch ( Exception e ) { MysqlPersistenceService . logger . error ( ( ( ( ( ( "mySQL:<seq2seq4repair_space>Could<seq2seq4repair_space>not<seq2seq4repair_space>remove<seq2seq4repair_space>index<seq2seq4repair_space>for<seq2seq4repair_space>item<seq2seq4repair_space>'" + itemName ) + "'<seq2seq4repair_space>with<seq2seq4repair_space>statement<seq2seq4repair_space>'" ) + sqlCmd ) + "':<seq2seq4repair_space>" ) + ( e . getMessage ( ) ) ) ) ; } finally { if ( statement != null ) { try { statement . close ( ) ; } catch ( Exception hidden ) { } } } } return tableName ; } public void store ( Item item , String alias ) { } public void store ( Item item ) { } private boolean isConnected ( ) { } private void connectToDatabase ( ) { } private void disconnectFromDatabase ( ) { } protected String formatAlias ( String alias , Object ... values ) { } public void updated ( Dictionary < String , ? > config ) throws ConfigurationException { } @ Override public Iterable < HistoricItem > query ( FilterCriteria filter ) { } }

Fix:
MysqlPersistenceService . logger . error ( "mySQL:<seq2seq4repair_space>Could<seq2seq4repair_space>not<seq2seq4repair_space>create<seq2seq4repair_space>item<seq2seq4repair_space>for<seq2seq4repair_space>'{}'<seq2seq4repair_space>in<seq2seq4repair_space>table<seq2seq4repair_space>'Items'<seq2seq4repair_space>with<seq2seq4repair_space>statement<seq2seq4repair_space>'{}':<seq2seq4repair_space>{}" , itemName , sqlCmd , e . getMessage ( ) ) ;