#vulnerable code 
                                public void testRead() throws Exception {
        final File archive = new File(getClass().getResource("data.ar").toURI());

        final ArInputStream ar = new ArInputStream(new FileInputStream(archive));
        final ArEntry entry1 = ar.getNextEntry();

        assertEquals("data.tgz", entry1.getName());
        assertEquals(148, entry1.getLength());

        for (int i = 0; i < entry1.getLength(); i++) {
            ar.read();          
        }
        
        final ArEntry entry2 = ar.getNextEntry();
        
        assertNull(entry2);
        
        ar.close();
    } 
                            #location 12 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public void testRead() throws Exception {
        final File archive = new File(getClass().getResource("data.ar").toURI());

        final ArArchiveInputStream ar = new ArArchiveInputStream(new FileInputStream(archive));
        final ArArchiveEntry entry1 = ar.getNextArEntry();

        assertEquals("data.tgz", entry1.getName());
        assertEquals(148, entry1.getLength());

        for (int i = 0; i < entry1.getLength(); i++) {
            ar.read();          
        }
        
        final ArArchiveEntry entry2 = ar.getNextArEntry();
        
        assertNull(entry2);
        
        ar.close();
    }