#vulnerable code 
                                protected void checkArchiveContent(File archive, List expected)
            throws Exception {
        final InputStream is = new FileInputStream(archive);
        try {
            final BufferedInputStream buf = new BufferedInputStream(is);
            final ArchiveInputStream in =
                archive.getName().endsWith(".tar") ? // tar does not autodetect at present
                    factory.createArchiveInputStream("tar", buf) :        
                    factory.createArchiveInputStream(buf);
            this.checkArchiveContent(in, expected);
        } finally {
            is.close();
        }
    } 
                            #location 8 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                protected void checkArchiveContent(File archive, List expected)
            throws Exception {
        final InputStream is = new FileInputStream(archive);
        try {
            final BufferedInputStream buf = new BufferedInputStream(is);
            final ArchiveInputStream in = factory.createArchiveInputStream(buf);
            this.checkArchiveContent(in, expected);
        } finally {
            is.close();
        }
    }