#vulnerable code 
                                public void testCreateParentDirectories() throws Exception {
        File archive = new File("target/data.tar");
        if (archive.exists()) {
            archive.delete();
        }
        
        DataBuilder builder = new DataBuilder(new NullConsole());
        
        DataProducer producer = new DataProducerFile(new File("pom.xml"), "/usr/share/myapp/pom.xml", null, null, null); 
        
        builder.buildData(Arrays.asList(producer), archive, new StringBuilder(), Compression.NONE);
        
        int count = 0;
        TarArchiveInputStream in = new TarArchiveInputStream(new FileInputStream(archive));
        while (in.getNextTarEntry() != null) {
            count++;
        }
        
        assertEquals("entries", 4, count);
    } 
                            #location 19 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public void testCreateParentDirectories() throws Exception {
        File archive = new File("target/data.tar");
        if (archive.exists()) {
            archive.delete();
        }
        
        DataBuilder builder = new DataBuilder(new NullConsole());
        
        DataProducer producer = new DataProducerFile(new File("pom.xml"), "/usr/share/myapp/pom.xml", null, null, null); 
        
        builder.buildData(Arrays.asList(producer), archive, new StringBuilder(), Compression.NONE);
        
        int count = 0;
        TarArchiveInputStream in = null;
        try {
            in = new TarArchiveInputStream(new FileInputStream(archive));
            while (in.getNextTarEntry() != null) {
                count++;
            }
        } finally {
            if (in != null) {
                in.close();
            }
        }
        
        assertEquals("entries", 4, count);
    }