Buggy code:
@ SuppressWarnings ( "serial" ) public class DataSourceTransactionManager extends AbstractPlatformTransactionManager implements InitializingBean , ResourceTransactionManager { private DataSource dataSource ; public DataSourceTransactionManager ( ) { } public DataSourceTransactionManager ( DataSource dataSource ) { } public void setDataSource ( DataSource dataSource ) { } public DataSource getDataSource ( ) { } @ Override public void afterPropertiesSet ( ) { } @ Override public Object getResourceFactory ( ) { } @ Override protected Object doGetTransaction ( ) { } @ Override protected boolean isExistingTransaction ( Object transaction ) { } @ Override protected void doBegin ( Object transaction , TransactionDefinition definition ) { DataSourceTransactionManager . DataSourceTransactionObject txObject = ( ( DataSourceTransactionManager . DataSourceTransactionObject ) ( transaction ) ) ; Connection con = null ; try { if ( ( ( txObject . getConnectionHolder ( ) ) == null ) || ( txObject . getConnectionHolder ( ) . isSynchronizedWithTransaction ( ) ) ) { Connection newCon = this . dataSource . getConnection ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( ( ( "Acquired<seq2seq4repair_space>Connection<seq2seq4repair_space>[" + newCon ) + "]<seq2seq4repair_space>for<seq2seq4repair_space>JDBC<seq2seq4repair_space>transaction" ) ) ; } txObject . setConnectionHolder ( new ConnectionHolder ( newCon ) , true ) ; } txObject . getConnectionHolder ( ) . setSynchronizedWithTransaction ( true ) ; con = txObject . getConnectionHolder ( ) . getConnection ( ) ; Integer previousIsolationLevel = DataSourceUtils . prepareConnectionForTransaction ( con , definition ) ; txObject . setPreviousIsolationLevel ( previousIsolationLevel ) ; if ( con . getAutoCommit ( ) ) { txObject . setMustRestoreAutoCommit ( true ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( ( ( "Switching<seq2seq4repair_space>JDBC<seq2seq4repair_space>Connection<seq2seq4repair_space>[" + con ) + "]<seq2seq4repair_space>to<seq2seq4repair_space>manual<seq2seq4repair_space>commit" ) ) ; } con . setAutoCommit ( false ) ; } txObject . getConnectionHolder ( ) . setTransactionActive ( true ) ; int timeout = determineTimeout ( definition ) ; if ( timeout != ( TransactionDefinition . TIMEOUT_DEFAULT ) ) { txObject . getConnectionHolder ( ) . setTimeoutInSeconds ( timeout ) ; } if ( txObject . isNewConnectionHolder ( ) ) { TransactionSynchronizationManager . bindResource ( getDataSource ( ) , txObject . getConnectionHolder ( ) ) ; } <START_BUG> } catch ( Exception ex ) { <END_BUG> DataSourceUtils . releaseConnection ( con , this . dataSource ) ; throw new CannotCreateTransactionException ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>open<seq2seq4repair_space>JDBC<seq2seq4repair_space>Connection<seq2seq4repair_space>for<seq2seq4repair_space>transaction" , ex ) ; } } @ Override protected Object doSuspend ( Object transaction ) { } @ Override protected void doResume ( Object transaction , Object suspendedResources ) { } @ Override protected void doCommit ( DefaultTransactionStatus status ) { } @ Override protected void doRollback ( DefaultTransactionStatus status ) { } @ Override protected void doSetRollbackOnly ( DefaultTransactionStatus status ) { } @ Override protected void doCleanupAfterCompletion ( Object transaction ) { } private static class DataSourceTransactionObject extends JdbcTransactionObjectSupport { private boolean newConnectionHolder ; private boolean mustRestoreAutoCommit ; public void setConnectionHolder ( ConnectionHolder connectionHolder , boolean newConnectionHolder ) { } public boolean isNewConnectionHolder ( ) { } public void setMustRestoreAutoCommit ( boolean mustRestoreAutoCommit ) { } public boolean isMustRestoreAutoCommit ( ) { } public void setRollbackOnly ( ) { } @ Override public boolean isRollbackOnly ( ) { } } }

Fix:
} catch ( Throwable ex ) {