#fixed code
                                @Test
    public void testBasicWrite() throws Exception {
        final SessionOutputBufferMock transmitter = new SessionOutputBufferMock();
        final IdentityOutputStream outstream = new IdentityOutputStream(transmitter);
        outstream.write(new byte[] {'a', 'b'}, 0, 2);
        outstream.write('c');
        outstream.flush();

        final byte[] input = transmitter.getData();

        Assert.assertNotNull(input);
        final byte[] expected = new byte[] {'a', 'b', 'c'};
        Assert.assertEquals(expected.length, input.length);
        for (int i = 0; i < expected.length; i++) {
            Assert.assertEquals(expected[i], input[i]);
        }
        outstream.close();
    }
#vulnerable code 
                                @Test
    public void testBasicWrite() throws Exception {
        final SessionOutputBufferMock transmitter = new SessionOutputBufferMock();
        final IdentityOutputStream outstream = new IdentityOutputStream(transmitter);
        outstream.write(new byte[] {'a', 'b'}, 0, 2);
        outstream.write('c');
        outstream.flush();

        final byte[] input = transmitter.getData();

        Assert.assertNotNull(input);
        final byte[] expected = new byte[] {'a', 'b', 'c'};
        Assert.assertEquals(expected.length, input.length);
        for (int i = 0; i < expected.length; i++) {
            Assert.assertEquals(expected[i], input[i]);
        }
    } 
                            #location 7 
                            #vulnerability type RESOURCE_LEAK