Source:
<code>public void afterCompletion(int status) { Collections.reverse(preJcaSyncs); for (Synchronization preJcaSync : preJcaSyncs) { if (TransactionLogger.ROOT_LOGGER.isTraceEnabled()) { TransactionLogger.ROOT_LOGGER.trace("JCAOrderedLastSynchronizationList.preJcaSyncs.afterCompletion - Class: " + preJcaSync.getClass() + " HashCode: " + preJcaSync.hashCode() + " toString: " + preJcaSync); } preJcaSync.afterCompletion(status); } <START> for (Synchronization jcaSync : jcaSyncs) { <END> if (TransactionLogger.ROOT_LOGGER.isTraceEnabled()) { TransactionLogger.ROOT_LOGGER.trace("JCAOrderedLastSynchronizationList.jcaSyncs.afterCompletion - Class: " + jcaSync.getClass() + " HashCode: " + jcaSync.hashCode() + " toString: " + jcaSync); } jcaSync.afterCompletion(status); } if (jcaOrderedLastSynchronizations.remove(tx) == null) { Transaction altKey = null; Iterator<Entry<Transaction, JCAOrderedLastSynchronizationList>> iterator = jcaOrderedLastSynchronizations.entrySet().iterator(); while (altKey == null && iterator.hasNext()) { Map.Entry<Transaction, JCAOrderedLastSynchronizationList> next = iterator.next(); if (next.getValue().equals(this)) { altKey = next.getKey(); iterator.remove(); if (TransactionLogger.ROOT_LOGGER.isTraceEnabled()) { TransactionLogger.ROOT_LOGGER.tracef("Removed: %s [%s]", System.identityHashCode(tx), tx.toString()); } break; } } if (altKey == null) { TransactionLogger.ROOT_LOGGER.transactionNotFound(tx); } } }</code><technical_language>Missing a reverse()</technical_language>

Target:
public void afterCompletion(int status) { Collections.reverse(preJcaSyncs); for (Synchronization preJcaSync : preJcaSyncs) { if (TransactionLogger.ROOT_LOGGER.isTraceEnabled()) { TransactionLogger.ROOT_LOGGER.trace("JCAOrderedLastSynchronizationList.preJcaSyncs.afterCompletion - Class: " + preJcaSync.getClass() + " HashCode: " + preJcaSync.hashCode() + " toString: " + preJcaSync); } try { preJcaSync.afterCompletion(status); } catch (Exception e) { TransactionLogger.ROOT_LOGGER.preJcaSyncAfterCompletionFailed(preJcaSync, tx, e); } } Collections.reverse(jcaSyncs); for (Synchronization jcaSync : jcaSyncs) { if (TransactionLogger.ROOT_LOGGER.isTraceEnabled()) { TransactionLogger.ROOT_LOGGER.trace("JCAOrderedLastSynchronizationList.jcaSyncs.afterCompletion - Class: " + jcaSync.getClass() + " HashCode: " + jcaSync.hashCode() + " toString: " + jcaSync); } try { jcaSync.afterCompletion(status); } catch (Exception e) { TransactionLogger.ROOT_LOGGER.jcaSyncAfterCompletionFailed(jcaSync, tx, e); } } if (jcaOrderedLastSynchronizations.remove(tx) == null) { Transaction altKey = null; Iterator<Entry<Transaction, JCAOrderedLastSynchronizationList>> iterator = jcaOrderedLastSynchronizations.entrySet().iterator(); while (altKey == null && iterator.hasNext()) { Map.Entry<Transaction, JCAOrderedLastSynchronizationList> next = iterator.next(); if (next.getValue().equals(this)) { altKey = next.getKey(); iterator.remove(); if (TransactionLogger.ROOT_LOGGER.isTraceEnabled()) { TransactionLogger.ROOT_LOGGER.tracef("Removed: %s [%s]", System.identityHashCode(tx), tx.toString()); } break; } } if (altKey == null) { TransactionLogger.ROOT_LOGGER.transactionNotFound(tx); } } }