Program: 155491
Project: 155491
Buggy source:
/** 
 * Switch the   {@link XAStatefulHolder}'s state appropriately after the acquired resource handle has been closed. The pooled resource will either be marked as closed or not accessible, depending on the value of the bean's <code>deferConnectionRelease</code> property and will be marked for release after 2PC execution in the latter case.
 * @param xaStatefulHolder the {@link XAStatefulHolder} to requeue.
 * @param bean the {@link ResourceBean} of the {@link XAResourceHolder}.
 * @throws BitronixSystemException if an internal error happens.
 */
public static void requeue(XAStatefulHolder xaStatefulHolder,ResourceBean bean) throws BitronixSystemException {
  BitronixTransaction currentTransaction=currentTransaction();
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + xaStatefulHolder + "String_Node_Str"+ currentTransaction);
  if (!TransactionContextHelper.isInEnlistingGlobalTransactionContext(xaStatefulHolder,currentTransaction)) {
    if (!TransactionContextHelper.isEnlistedInSomeTransaction(xaStatefulHolder)) {
      if (log.isDebugEnabled())       log.debug("String_Node_Str" + xaStatefulHolder);
      xaStatefulHolder.setState(XAResourceHolder.STATE_IN_POOL);
    }
 else {
      throw new BitronixSystemException("String_Node_Str");
    }
  }
 else   if (bean.getDeferConnectionRelease()) {
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + xaStatefulHolder);
    if (!TransactionContextHelper.isAlreadyRegisteredForDeferredRelease(xaStatefulHolder,currentTransaction)) {
      if (log.isDebugEnabled())       log.debug("String_Node_Str" + xaStatefulHolder);
      DeferredReleaseSynchronization synchronization=new DeferredReleaseSynchronization(xaStatefulHolder);
      currentTransaction.getSynchronizationScheduler().add(synchronization,Scheduler.ALWAYS_LAST_POSITION);
    }
 else     if (log.isDebugEnabled())     log.debug("String_Node_Str" + xaStatefulHolder);
    xaStatefulHolder.setState(XAResourceHolder.STATE_NOT_ACCESSIBLE);
  }
 else {
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + xaStatefulHolder);
    xaStatefulHolder.setState(XAResourceHolder.STATE_IN_POOL);
  }
}

Fixed version (ground truth):
/** 
 * Switch the   {@link XAStatefulHolder}'s state appropriately after the acquired resource handle has been closed. The pooled resource will either be marked as closed or not accessible, depending on the value of the bean's <code>deferConnectionRelease</code> property and will be marked for release after 2PC execution in the latter case.
 * @param xaStatefulHolder the {@link XAStatefulHolder} to requeue.
 * @param bean the {@link ResourceBean} of the {@link XAResourceHolder}.
 * @throws BitronixSystemException if an internal error happens.
 */
public static void requeue(XAStatefulHolder xaStatefulHolder,ResourceBean bean) throws BitronixSystemException {
  BitronixTransaction currentTransaction=currentTransaction();
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + xaStatefulHolder + "String_Node_Str"+ currentTransaction);
  if (!TransactionContextHelper.isInEnlistingGlobalTransactionContext(xaStatefulHolder,currentTransaction)) {
    if (!TransactionContextHelper.isEnlistedInSomeTransaction(xaStatefulHolder)) {
      if (log.isDebugEnabled())       log.debug("String_Node_Str" + xaStatefulHolder);
      xaStatefulHolder.setState(XAResourceHolder.STATE_IN_POOL);
    }
 else {
      throw new BitronixSystemException("String_Node_Str");
    }
  }
 else   if (bean.getDeferConnectionRelease()) {
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + xaStatefulHolder);
    if (!TransactionContextHelper.isAlreadyRegisteredForDeferredRelease(xaStatefulHolder,currentTransaction)) {
      if (log.isDebugEnabled())       log.debug("String_Node_Str" + xaStatefulHolder);
      DeferredReleaseSynchronization synchronization=new DeferredReleaseSynchronization(currentTransaction,xaStatefulHolder);
      currentTransaction.getSynchronizationScheduler().add(synchronization,Scheduler.ALWAYS_LAST_POSITION);
    }
 else     if (log.isDebugEnabled())     log.debug("String_Node_Str" + xaStatefulHolder);
    xaStatefulHolder.setState(XAResourceHolder.STATE_NOT_ACCESSIBLE);
  }
 else {
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + xaStatefulHolder);
    xaStatefulHolder.setState(XAResourceHolder.STATE_IN_POOL);
  }
}