Program: 155501
Project: 155501
Buggy source:
public void testRecoverMissingResource() throws Exception {
  final Xid xid0=new MockXid(0,0,BitronixXid.FORMAT_ID);
  xaResource.addInDoubtXid(xid0);
  Set names=new HashSet();
  names.add("String_Node_Str");
  journal.log(Status.STATUS_COMMITTING,new Uid(xid0.getGlobalTransactionId()),names);
  assertEquals(1,TransactionManagerServices.getJournal().collectDanglingRecords().size());
  TransactionManagerServices.getTransactionManager();
  assertEquals(1,TransactionManagerServices.getJournal().collectDanglingRecords().size());
  assertNull(TransactionManagerServices.getRecoverer().getCompletionException());
  assertEquals(0,TransactionManagerServices.getRecoverer().getCommittedCount());
  assertEquals(1,TransactionManagerServices.getRecoverer().getRolledbackCount());
  assertEquals(0,xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length);
  PoolingDataSource pds=new PoolingDataSource(){
    public XAStatefulHolder createPooledConnection(    Object xaFactory,    ResourceBean bean) throws Exception {
      JdbcPooledConnection pc=(JdbcPooledConnection)super.createPooledConnection(xaFactory,bean);
      MockXAResource xaResource=(MockXAResource)pc.getXAResource();
      xaResource.addInDoubtXid(UidGenerator.generateXid(new Uid(xid0.getGlobalTransactionId())));
      return pc;
    }
  }
;
  pds.setClassName(MockXADataSource.class.getName());
  pds.setUniqueName("String_Node_Str");
  pds.setMinPoolSize(1);
  pds.setMaxPoolSize(1);
  pds.init();
  JdbcConnectionHandle handle=(JdbcConnectionHandle)pds.getConnection();
  XAResource xaResource=handle.getPooledConnection().getXAResource();
  handle.close();
  assertEquals(0,xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length);
  assertEquals(0,TransactionManagerServices.getJournal().collectDanglingRecords().size());
  pds.close();
  TransactionManagerServices.getTransactionManager().shutdown();
}

Fixed version (ground truth):
public void testRecoverMissingResource() throws Exception {
  final Xid xid0=new MockXid(0,UidGenerator.generateUid().getArray(),BitronixXid.FORMAT_ID);
  xaResource.addInDoubtXid(xid0);
  Set names=new HashSet();
  names.add("String_Node_Str");
  journal.log(Status.STATUS_COMMITTING,new Uid(xid0.getGlobalTransactionId()),names);
  assertEquals(1,TransactionManagerServices.getJournal().collectDanglingRecords().size());
  TransactionManagerServices.getTransactionManager();
  assertEquals(1,TransactionManagerServices.getJournal().collectDanglingRecords().size());
  assertNull(TransactionManagerServices.getRecoverer().getCompletionException());
  assertEquals(0,TransactionManagerServices.getRecoverer().getCommittedCount());
  assertEquals(1,TransactionManagerServices.getRecoverer().getRolledbackCount());
  assertEquals(0,xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length);
  PoolingDataSource pds=new PoolingDataSource(){
    public XAStatefulHolder createPooledConnection(    Object xaFactory,    ResourceBean bean) throws Exception {
      JdbcPooledConnection pc=(JdbcPooledConnection)super.createPooledConnection(xaFactory,bean);
      MockXAResource xaResource=(MockXAResource)pc.getXAResource();
      xaResource.addInDoubtXid(UidGenerator.generateXid(new Uid(xid0.getGlobalTransactionId())));
      return pc;
    }
  }
;
  pds.setClassName(MockXADataSource.class.getName());
  pds.setUniqueName("String_Node_Str");
  pds.setMinPoolSize(1);
  pds.setMaxPoolSize(1);
  pds.init();
  JdbcConnectionHandle handle=(JdbcConnectionHandle)pds.getConnection();
  XAResource xaResource=handle.getPooledConnection().getXAResource();
  handle.close();
  assertEquals(0,xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length);
  assertEquals(0,TransactionManagerServices.getJournal().collectDanglingRecords().size());
  pds.close();
  TransactionManagerServices.getTransactionManager().shutdown();
}