Buggy code:
@ SuppressWarnings ( "serial" ) public class JdoTransactionManager extends AbstractPlatformTransactionManager implements InitializingBean , ResourceTransactionManager { private PersistenceManagerFactory persistenceManagerFactory ; private DataSource dataSource ; private boolean autodetectDataSource = true ; private JdoDialect jdoDialect ; public JdoTransactionManager ( ) { } public JdoTransactionManager ( PersistenceManagerFactory pmf ) { } public void setPersistenceManagerFactory ( PersistenceManagerFactory pmf ) { } public PersistenceManagerFactory getPersistenceManagerFactory ( ) { } public void setDataSource ( DataSource dataSource ) { } public DataSource getDataSource ( ) { } public void setAutodetectDataSource ( boolean autodetectDataSource ) { } public void setJdoDialect ( JdoDialect jdoDialect ) { } public JdoDialect getJdoDialect ( ) { } @ 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 ) { JdoTransactionManager . JdoTransactionObject txObject = ( ( JdoTransactionManager . JdoTransactionObject ) ( transaction ) ) ; if ( ( txObject . hasConnectionHolder ( ) ) && ( ! ( txObject . getConnectionHolder ( ) . isSynchronizedWithTransaction ( ) ) ) ) { throw new IllegalTransactionStateException ( ( "Pre-bound<seq2seq4repair_space>JDBC<seq2seq4repair_space>Connection<seq2seq4repair_space>found!<seq2seq4repair_space>JdoTransactionManager<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>support<seq2seq4repair_space>" + ( ( "running<seq2seq4repair_space>within<seq2seq4repair_space>DataSourceTransactionManager<seq2seq4repair_space>if<seq2seq4repair_space>told<seq2seq4repair_space>to<seq2seq4repair_space>manage<seq2seq4repair_space>the<seq2seq4repair_space>DataSource<seq2seq4repair_space>itself.<seq2seq4repair_space>" + "It<seq2seq4repair_space>is<seq2seq4repair_space>recommended<seq2seq4repair_space>to<seq2seq4repair_space>use<seq2seq4repair_space>a<seq2seq4repair_space>single<seq2seq4repair_space>JdoTransactionManager<seq2seq4repair_space>for<seq2seq4repair_space>all<seq2seq4repair_space>transactions<seq2seq4repair_space>" ) + "on<seq2seq4repair_space>a<seq2seq4repair_space>single<seq2seq4repair_space>DataSource,<seq2seq4repair_space>no<seq2seq4repair_space>matter<seq2seq4repair_space>whether<seq2seq4repair_space>JDO<seq2seq4repair_space>or<seq2seq4repair_space>JDBC<seq2seq4repair_space>access." ) ) ) ; } PersistenceManager pm ; try { if ( ( ( txObject . getPersistenceManagerHolder ( ) ) == null ) || ( txObject . getPersistenceManagerHolder ( ) . isSynchronizedWithTransaction ( ) ) ) { PersistenceManager newPm = getPersistenceManagerFactory ( ) . getPersistenceManager ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( ( ( "Opened<seq2seq4repair_space>new<seq2seq4repair_space>PersistenceManager<seq2seq4repair_space>[" + newPm ) + "]<seq2seq4repair_space>for<seq2seq4repair_space>JDO<seq2seq4repair_space>transaction" ) ) ; } txObject . setPersistenceManagerHolder ( new PersistenceManagerHolder ( newPm ) , true ) ; } pm = txObject . getPersistenceManagerHolder ( ) . getPersistenceManager ( ) ; final int timeoutToUse = determineTimeout ( definition ) ; Object transactionData = getJdoDialect ( ) . beginTransaction ( pm . currentTransaction ( ) , new DelegatingTransactionDefinition ( definition ) { @ Override public int getTimeout ( ) { return timeoutToUse ; } } ) ; txObject . setTransactionData ( transactionData ) ; if ( timeoutToUse != ( TransactionDefinition . TIMEOUT_DEFAULT ) ) { txObject . getPersistenceManagerHolder ( ) . setTimeoutInSeconds ( timeoutToUse ) ; } if ( ( getDataSource ( ) ) != null ) { ConnectionHandle conHandle = getJdoDialect ( ) . getJdbcConnection ( pm , definition . isReadOnly ( ) ) ; if ( conHandle != null ) { ConnectionHolder conHolder = new ConnectionHolder ( conHandle ) ; if ( timeoutToUse != ( TransactionDefinition . TIMEOUT_DEFAULT ) ) { conHolder . setTimeoutInSeconds ( timeoutToUse ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( ( ( "Exposing<seq2seq4repair_space>JDO<seq2seq4repair_space>transaction<seq2seq4repair_space>as<seq2seq4repair_space>JDBC<seq2seq4repair_space>transaction<seq2seq4repair_space>[" + ( conHolder . getConnectionHandle ( ) ) ) + "]" ) ) ; } TransactionSynchronizationManager . bindResource ( getDataSource ( ) , conHolder ) ; txObject . setConnectionHolder ( conHolder ) ; } else { if ( logger . isDebugEnabled ( ) ) { logger . debug ( ( ( ( ( "Not<seq2seq4repair_space>exposing<seq2seq4repair_space>JDO<seq2seq4repair_space>transaction<seq2seq4repair_space>[" + pm ) + "]<seq2seq4repair_space>as<seq2seq4repair_space>JDBC<seq2seq4repair_space>transaction<seq2seq4repair_space>because<seq2seq4repair_space>JdoDialect<seq2seq4repair_space>[" ) + ( getJdoDialect ( ) ) ) + "]<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>support<seq2seq4repair_space>JDBC<seq2seq4repair_space>Connection<seq2seq4repair_space>retrieval" ) ) ; } } } if ( txObject . isNewPersistenceManagerHolder ( ) ) { TransactionSynchronizationManager . bindResource ( getPersistenceManagerFactory ( ) , txObject . getPersistenceManagerHolder ( ) ) ; } txObject . getPersistenceManagerHolder ( ) . setSynchronizedWithTransaction ( true ) ; } catch ( TransactionException ex ) { closePersistenceManagerAfterFailedBegin ( txObject ) ; throw ex ; <START_BUG> } catch ( Exception ex ) { <END_BUG> closePersistenceManagerAfterFailedBegin ( txObject ) ; throw new CannotCreateTransactionException ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>open<seq2seq4repair_space>JDO<seq2seq4repair_space>PersistenceManager<seq2seq4repair_space>for<seq2seq4repair_space>transaction" , ex ) ; } } protected void closePersistenceManagerAfterFailedBegin ( JdoTransactionManager . JdoTransactionObject txObject ) { } @ Override protected Object doSuspend ( Object transaction ) { } @ Override protected void doResume ( Object transaction , Object suspendedResources ) { } @ Override protected boolean shouldCommitOnGlobalRollbackOnly ( ) { } @ Override protected void doCommit ( DefaultTransactionStatus status ) { } @ Override protected void doRollback ( DefaultTransactionStatus status ) { } @ Override protected void doSetRollbackOnly ( DefaultTransactionStatus status ) { } @ Override protected void doCleanupAfterCompletion ( Object transaction ) { } protected DataAccessException convertJdoAccessException ( JDOException ex ) { } private class JdoTransactionObject extends JdbcTransactionObjectSupport { private PersistenceManagerHolder persistenceManagerHolder ; private boolean newPersistenceManagerHolder ; private Object transactionData ; public void setPersistenceManagerHolder ( PersistenceManagerHolder persistenceManagerHolder , boolean newPersistenceManagerHolder ) { } public PersistenceManagerHolder getPersistenceManagerHolder ( ) { } public boolean isNewPersistenceManagerHolder ( ) { } public boolean hasTransaction ( ) { } public void setTransactionData ( Object transactionData ) { } public Object getTransactionData ( ) { } public void setRollbackOnly ( ) { } @ Override public boolean isRollbackOnly ( ) { } @ Override public void flush ( ) { } } private static class SuspendedResourcesHolder { private final PersistenceManagerHolder persistenceManagerHolder ; private final ConnectionHolder connectionHolder ; private SuspendedResourcesHolder ( PersistenceManagerHolder pmHolder , ConnectionHolder conHolder ) { } private PersistenceManagerHolder getPersistenceManagerHolder ( ) { } private ConnectionHolder getConnectionHolder ( ) { } } }

Fix:
} catch ( Throwable ex ) {