#vulnerable code 
                                @Test
    public void testBasicBehaviour() throws Throwable {
        HTable table = new HTable(hbaseConf, TEST_TABLE);
        HBaseCommitTable commitTable = new HBaseCommitTable(table);

        ListenableFuture<Writer> futureWriter = commitTable.getWriter();
        Writer writer = futureWriter.get();
        ListenableFuture<Client> futureClient = commitTable.getClient();
        Client client = futureClient.get();

        // Test that the first time the table is empty
        assertEquals("Rows should be 0!", 0, rowCount());

        // Test the successful creation of 1000 txs in the table
        for (int i = 0; i < 1000; i++) {
            writer.addCommittedTransaction(i, i + 1);
        }
        writer.flush().get();
        assertEquals("Rows should be 1000!", 1000, rowCount());

        // Test the we get the right commit timestamps for each previously inserted tx
        for (long i = 0; i < 1000; i++) {
            ListenableFuture<Optional<Long>> ctf = client.getCommitTimestamp(i);
            Optional<Long> optional = ctf.get();
            Long ct = optional.get();
            assertEquals("Commit timestamp should be " + (i + 1), (i + 1), (long) ct);
        }
        assertEquals("Rows should be 1000!", 1000, rowCount());

        // Test the successful deletion of the 1000 txs
        Future<Void> f = null;
        for (long i = 0; i < 1000; i++) {
            f = client.completeTransaction(i);
        }
        f.get();
        assertEquals("Rows should be 0!", 0, rowCount());

        // Test we don't get a commit timestamp for a non-existent transaction id in the table
        ListenableFuture<Optional<Long>> ctf = client.getCommitTimestamp(0);
        Optional<Long> optional = ctf.get();
        assertFalse("Commit timestamp should not be present", optional.isPresent());

    } 
                            #location 8 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                @Test
    public void testBasicBehaviour() throws Throwable {
        HBaseCommitTable commitTable = new HBaseCommitTable(hbaseConf, TEST_TABLE);

        ListenableFuture<Writer> futureWriter = commitTable.getWriter();
        Writer writer = futureWriter.get();
        ListenableFuture<Client> futureClient = commitTable.getClient();
        Client client = futureClient.get();

        // Test that the first time the table is empty
        assertEquals("Rows should be 0!", 0, rowCount());

        // Test the successful creation of 1000 txs in the table
        for (int i = 0; i < 1000; i++) {
            writer.addCommittedTransaction(i, i + 1);
        }
        writer.flush().get();
        assertEquals("Rows should be 1000!", 1000, rowCount());

        // Test the we get the right commit timestamps for each previously inserted tx
        for (long i = 0; i < 1000; i++) {
            ListenableFuture<Optional<Long>> ctf = client.getCommitTimestamp(i);
            Optional<Long> optional = ctf.get();
            Long ct = optional.get();
            assertEquals("Commit timestamp should be " + (i + 1), (i + 1), (long) ct);
        }
        assertEquals("Rows should be 1000!", 1000, rowCount());

        // Test the successful deletion of the 1000 txs
        Future<Void> f = null;
        for (long i = 0; i < 1000; i++) {
            f = client.completeTransaction(i);
        }
        f.get();
        assertEquals("Rows should be 0!", 0, rowCount());

        // Test we don't get a commit timestamp for a non-existent transaction id in the table
        ListenableFuture<Optional<Long>> ctf = client.getCommitTimestamp(0);
        Optional<Long> optional = ctf.get();
        assertFalse("Commit timestamp should not be present", optional.isPresent());

    }