output: #fixed code
                                  protected File createArchive(String archivename) throws Exception {
          ArchiveOutputStream out = null;
          OutputStream stream = null;
          try {
              archive = File.createTempFile("test", "." + archivename);
              archiveList = new ArrayList();
  
              stream = new FileOutputStream(archive);
              out = factory.createArchiveOutputStream(archivename, stream);
  
              final File file1 = getFile("test1.xml");
              final File file2 = getFile("test2.xml");
              final File file3 = getFile("test3.xml");
              final File file4 = getFile("test4.xml");
              final File file5 = getFile("test.txt");
              final File file6 = getFile("test with spaces.txt");
  
              addArchiveEntry(out, "testdata/test1.xml", file1);
              addArchiveEntry(out, "testdata/test2.xml", file2);
              addArchiveEntry(out, "test/test3.xml", file3);
              addArchiveEntry(out, "bla/test4.xml", file4);
              addArchiveEntry(out, "bla/test5.xml", file4);
              addArchiveEntry(out, "bla/blubber/test6.xml", file4);
              addArchiveEntry(out, "test.txt", file5);
              addArchiveEntry(out, "something/bla", file6);
              addArchiveEntry(out, "test with spaces.txt", file6);
  
              return archive;
          } finally {
              if (out != null) {
                  out.close();
              } else if (stream != null) {
                  stream.close();
              }
          }
      }
input: #vulnerable code 
                                  protected File createArchive(String archivename) throws Exception {
          ArchiveOutputStream out = null;
          OutputStream stream = null;
          try {
              archive = File.createTempFile("test", "." + archivename);
  
              stream = new FileOutputStream(archive);
              out = new ArchiveStreamFactory().createArchiveOutputStream(
                      archivename, stream);
  
              final File file1 = getFile("test1.xml");
              final File file2 = getFile("test2.xml");
              final File file3 = getFile("test3.xml");
              final File file4 = getFile("test4.xml");
              final File file5 = getFile("test.txt");
              final File file6 = getFile("test with spaces.txt");
  
              ZipArchiveEntry entry = new ZipArchiveEntry("testdata/test1.xml");
              entry.setSize(file1.length());
              out.putArchiveEntry(entry);
              IOUtils.copy(new FileInputStream(file1), out);
              out.closeArchiveEntry();
  
              entry = new ZipArchiveEntry("testdata/test2.xml");
              entry.setSize(file2.length());
              out.putArchiveEntry(entry);
              IOUtils.copy(new FileInputStream(file2), out);
              out.closeArchiveEntry();
  
              entry = new ZipArchiveEntry("test/test3.xml");
              entry.setSize(file3.length());
              out.putArchiveEntry(entry);
              IOUtils.copy(new FileInputStream(file3), out);
              out.closeArchiveEntry();
  
              entry = new ZipArchiveEntry("bla/test4.xml");
              entry.setSize(file4.length());
              out.putArchiveEntry(entry);
              IOUtils.copy(new FileInputStream(file4), out);
              out.closeArchiveEntry();
  
              entry = new ZipArchiveEntry("bla/test5.xml");
              entry.setSize(file4.length());
              out.putArchiveEntry(entry);
              IOUtils.copy(new FileInputStream(file4), out);
              out.closeArchiveEntry();
  
              entry = new ZipArchiveEntry("bla/blubber/test6.xml");
              entry.setSize(file4.length());
              out.putArchiveEntry(entry);
              IOUtils.copy(new FileInputStream(file4), out);
              out.closeArchiveEntry();
  
              entry = new ZipArchiveEntry("test.txt");
              entry.setSize(file5.length());
              out.putArchiveEntry(entry);
              IOUtils.copy(new FileInputStream(file5), out);
              out.closeArchiveEntry();
  
              entry = new ZipArchiveEntry("something/bla");
              entry.setSize(file6.length());
              out.putArchiveEntry(entry);
              IOUtils.copy(new FileInputStream(file6), out);
              out.closeArchiveEntry();
  
              entry = new ZipArchiveEntry("test with spaces.txt");
              entry.setSize(file6.length());
              out.putArchiveEntry(entry);
              IOUtils.copy(new FileInputStream(file6), out);
              out.closeArchiveEntry();
  
              return archive;
          } finally {
              if (out != null) {
                  out.close();
              } else if (stream != null) {
                  stream.close();
              }
          }
      } 
                              #location 21 
                              #vulnerability type RESOURCE_LEAK