Program: 154857
Project: 154857
Buggy source:
synchronized XaTransaction commit(Xid xid,boolean onePhase) throws XAException {
  XidStatus status=xidMap.get(xid);
  if (status == null) {
    throw new XAException("String_Node_Str" + xid + "String_Node_Str");
  }
  TransactionStatus txStatus=status.getTransactionStatus();
  XaTransaction xaTransaction=txStatus.getTransaction();
  if (onePhase) {
    if (!xaTransaction.isReadOnly()) {
      if (!xaTransaction.isRecovered()) {
        xaTransaction.prepare();
        long txId=txIdGenerator.generate(dataSource,xaTransaction.getIdentifier());
        xaTransaction.setCommitTxId(txId);
        log.commitOnePhase(xaTransaction.getIdentifier(),xaTransaction.getCommitTxId());
      }
    }
    txStatus.markAsPrepared();
  }
  if (!txStatus.prepared() || txStatus.rollback()) {
    throw new XAException("String_Node_Str" + "String_Node_Str");
  }
  if (!xaTransaction.isReadOnly()) {
    if (!xaTransaction.isRecovered()) {
      if (!onePhase) {
        long txId=txIdGenerator.generate(dataSource,xaTransaction.getIdentifier());
        xaTransaction.setCommitTxId(txId);
        log.commitTwoPhase(xaTransaction.getIdentifier(),xaTransaction.getCommitTxId());
      }
    }
    txStatus.markCommitStarted();
    if (xaTransaction.isRecovered() && xaTransaction.getCommitTxId() == -1) {
      xaTransaction.setCommitTxId(dataSource.getLastCommittedTxId() + 1);
    }
    xaTransaction.commit();
  }
  log.done(xaTransaction.getIdentifier());
  xidMap.remove(xid);
  if (xaTransaction.isRecovered()) {
    recoveredTxCount--;
    checkIfRecoveryComplete();
  }
  return xaTransaction;
}

Fixed version (ground truth):
synchronized XaTransaction commit(Xid xid,boolean onePhase) throws XAException {
  XidStatus status=xidMap.get(xid);
  if (status == null) {
    throw new XAException("String_Node_Str" + xid + "String_Node_Str");
  }
  TransactionStatus txStatus=status.getTransactionStatus();
  XaTransaction xaTransaction=txStatus.getTransaction();
  if (onePhase) {
    if (!xaTransaction.isReadOnly()) {
      if (!xaTransaction.isRecovered()) {
        xaTransaction.prepare();
        long txId=txIdGenerator.generate(dataSource,xaTransaction.getIdentifier());
        xaTransaction.setCommitTxId(txId);
        log.commitOnePhase(xaTransaction.getIdentifier(),xaTransaction.getCommitTxId());
      }
    }
    txStatus.markAsPrepared();
  }
  if (!txStatus.prepared() || txStatus.rollback()) {
    throw new XAException("String_Node_Str" + "String_Node_Str");
  }
  if (!xaTransaction.isReadOnly()) {
    if (!xaTransaction.isRecovered()) {
      if (!onePhase) {
        long txId=txIdGenerator.generate(dataSource,xaTransaction.getIdentifier());
        xaTransaction.setCommitTxId(txId);
        log.commitTwoPhase(xaTransaction.getIdentifier(),xaTransaction.getCommitTxId());
      }
    }
    txStatus.markCommitStarted();
    if (xaTransaction.isRecovered() && xaTransaction.getCommitTxId() == -1) {
      xaTransaction.setCommitTxId(dataSource.getLastCommittedTxId() + 1);
    }
    xaTransaction.commit();
  }
  if (!xaTransaction.isRecovered()) {
    log.done(xaTransaction.getIdentifier());
  }
  xidMap.remove(xid);
  if (xaTransaction.isRecovered()) {
    recoveredTxCount--;
    checkIfRecoveryComplete();
  }
  return xaTransaction;
}