Program: 155486
Project: 155486
Buggy source:
/** 
 * Commit transactions that have a dangling COMMITTING record in the journal. Step 2.
 * @return a Set of all committed GTRIDs encoded as strings.
 * @throws java.io.IOException if there is an I/O error reading the journal.
 */
private Set commitDanglingTransactions() throws IOException {
  Set committedGtrids=new HashSet();
  Map danglingRecords=TransactionManagerServices.getJournal().collectDanglingRecords();
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + danglingRecords.size() + "String_Node_Str");
  Iterator it=danglingRecords.entrySet().iterator();
  while (it.hasNext()) {
    Map.Entry entry=(Map.Entry)it.next();
    Uid gtrid=(Uid)entry.getKey();
    TransactionLogRecord tlog=(TransactionLogRecord)entry.getValue();
    Set uniqueNames=tlog.getUniqueNames();
    Set danglingTransactions=getDanglingTransactionsInRecoveredXids(uniqueNames,tlog.getGtrid());
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + gtrid);
    commit(danglingTransactions);
    if (log.isDebugEnabled())     log.debug("String_Node_Str" + gtrid);
    committedGtrids.add(gtrid);
    Set participatingUniqueNames=filterParticipatingUniqueNamesInRecoveredXids(uniqueNames);
    if (participatingUniqueNames.size() > 0) {
      if (log.isDebugEnabled())       log.debug("String_Node_Str" + gtrid + "String_Node_Str"+ buildUniqueNamesString(participatingUniqueNames)+ "String_Node_Str");
      TransactionManagerServices.getJournal().log(Status.STATUS_COMMITTED,tlog.getGtrid(),participatingUniqueNames);
    }
 else {
      if (log.isDebugEnabled())       log.debug("String_Node_Str" + gtrid + "String_Node_Str");
      committedGtrids.remove(gtrid);
    }
  }
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + committedGtrids.size() + "String_Node_Str");
  return committedGtrids;
}

Fixed version (ground truth):
/** 
 * Commit transactions that have a dangling COMMITTING record in the journal. Step 2.
 * @return a Set of all committed GTRIDs encoded as strings.
 * @throws java.io.IOException if there is an I/O error reading the journal.
 */
private Set commitDanglingTransactions() throws IOException {
  Set committedGtrids=new HashSet();
  Map danglingRecords=TransactionManagerServices.getJournal().collectDanglingRecords();
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + danglingRecords.size() + "String_Node_Str");
  Iterator it=danglingRecords.entrySet().iterator();
  while (it.hasNext()) {
    Map.Entry entry=(Map.Entry)it.next();
    Uid gtrid=(Uid)entry.getKey();
    TransactionLogRecord tlog=(TransactionLogRecord)entry.getValue();
    Set uniqueNames=tlog.getUniqueNames();
    Set danglingTransactions=getDanglingTransactionsInRecoveredXids(uniqueNames,tlog.getGtrid());
    if (danglingTransactions.size() > 0) {
      if (log.isDebugEnabled())       log.debug("String_Node_Str" + gtrid);
      commit(danglingTransactions);
      if (log.isDebugEnabled())       log.debug("String_Node_Str" + gtrid);
      committedGtrids.add(gtrid);
      Set participatingUniqueNames=filterParticipatingUniqueNamesInRecoveredXids(uniqueNames);
      if (participatingUniqueNames.size() > 0) {
        if (log.isDebugEnabled())         log.debug("String_Node_Str" + gtrid + "String_Node_Str"+ buildUniqueNamesString(participatingUniqueNames)+ "String_Node_Str");
        TransactionManagerServices.getJournal().log(Status.STATUS_COMMITTED,tlog.getGtrid(),participatingUniqueNames);
      }
 else {
        if (log.isDebugEnabled())         log.debug("String_Node_Str" + gtrid + "String_Node_Str");
        committedGtrids.remove(gtrid);
      }
    }
 else {
      if (log.isDebugEnabled())       log.debug("String_Node_Str" + gtrid);
    }
  }
  if (log.isDebugEnabled())   log.debug("String_Node_Str" + committedGtrids.size() + "String_Node_Str");
  return committedGtrids;
}