#fixed code
                                public void testDetection() throws Exception {
        final ArchiveStreamFactory factory = new ArchiveStreamFactory();

        final ArchiveInputStream ar = factory.createArchiveInputStream(
                                                                       new BufferedInputStream(new FileInputStream(
                                                                                                                   new File(getClass().getClassLoader().getResource("bla.ar").getFile())))); 
        assertNotNull(ar);
        assertTrue(ar instanceof ArArchiveInputStream);

        final ArchiveInputStream tar = factory.createArchiveInputStream(
                                                                        new BufferedInputStream(new FileInputStream(
                                                                                                                    new File(getClass().getClassLoader().getResource("bla.tar").getFile()))));
        assertNotNull(tar);
        assertTrue(tar instanceof TarArchiveInputStream);

        final ArchiveInputStream zip = factory.createArchiveInputStream(
                                                                        new BufferedInputStream(new FileInputStream(
                                                                                                                    new File(getClass().getClassLoader().getResource("bla.zip").getFile()))));
        assertNotNull(zip);
        assertTrue(zip instanceof ZipArchiveInputStream);

        final ArchiveInputStream jar = factory.createArchiveInputStream(
                                                                        new BufferedInputStream(new FileInputStream(
                                                                                                                    new File(getClass().getClassLoader().getResource("bla.jar").getFile()))));
        assertNotNull(jar);
        assertTrue(jar instanceof ZipArchiveInputStream);

        final ArchiveInputStream cpio = factory.createArchiveInputStream(
                                                                         new BufferedInputStream(new FileInputStream(
                                                                                                                     new File(getClass().getClassLoader().getResource("bla.cpio").getFile()))));
        assertNotNull(cpio);
        assertTrue(cpio instanceof CpioArchiveInputStream);

        //              final ArchiveInputStream tgz = factory.createArchiveInputStream(
        //                              new BufferedInputStream(new FileInputStream(
        //                                              new File(getClass().getClassLoader().getResource("bla.tgz").getFile()))));
        //              assertTrue(tgz instanceof TarArchiveInputStream);

    }
#vulnerable code 
                                public void testDetection() throws Exception {
        final ArchiveStreamFactory factory = new ArchiveStreamFactory();

        final ArchiveInputStream ar = factory.createArchiveInputStream(
                                                                       new BufferedInputStream(new FileInputStream(
                                                                                                                   new File(getClass().getClassLoader().getResource("bla.ar").getFile())))); 
        assertNotNull(ar);
        assertTrue(ar instanceof ArArchiveInputStream);

        final ArchiveInputStream tar = factory.createArchiveInputStream(
                                                                        new BufferedInputStream(new FileInputStream(
                                                                                                                    new File(getClass().getClassLoader().getResource("bla.tar").getFile()))));
        assertNotNull(tar);
        assertTrue(tar instanceof TarArchiveInputStream);

        final ArchiveInputStream zip = factory.createArchiveInputStream(
                                                                        new BufferedInputStream(new FileInputStream(
                                                                                                                    new File(getClass().getClassLoader().getResource("bla.zip").getFile()))));
        assertNotNull(zip);
        assertTrue(zip instanceof ZipArchiveInputStream);

        final ArchiveInputStream jar = factory.createArchiveInputStream(
                                                                        new BufferedInputStream(new FileInputStream(
                                                                                                                    new File(getClass().getClassLoader().getResource("bla.jar").getFile()))));
        assertNotNull(jar);
        assertTrue(jar instanceof JarArchiveInputStream);

        final ArchiveInputStream cpio = factory.createArchiveInputStream(
                                                                         new BufferedInputStream(new FileInputStream(
                                                                                                                     new File(getClass().getClassLoader().getResource("bla.cpio").getFile()))));
        assertNotNull(cpio);
        assertTrue(cpio instanceof CpioArchiveInputStream);

        //              final ArchiveInputStream tgz = factory.createArchiveInputStream(
        //                              new BufferedInputStream(new FileInputStream(
        //                                              new File(getClass().getClassLoader().getResource("bla.tgz").getFile()))));
        //              assertTrue(tgz instanceof TarArchiveInputStream);

    } 
                            #location 28 
                            #vulnerability type RESOURCE_LEAK