#vulnerable code 
                               public void createArchive(String dir, String archiveFileName) {

      try {

         File srcDir = new File(dir);
         String filename = dir + "-" + archiveFileName + ".tar.gz";

         FileOutputStream fout = new FileOutputStream(filename);
         CompressorOutputStream cout = new GzipCompressorOutputStream(fout);
         TarArchiveOutputStream taos = new TarArchiveOutputStream(cout);

         taos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR);
         taos.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
         archiveResults(archiveFileName, taos, srcDir, "", true);
         taos.close();

         logger.info("Archive: " + filename + " was created");

      } catch (Exception ioe) {
         logger.info("Couldn't create archive. {}", ioe);
      }

   } 
                            #location 19 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                               public void createArchive(String dir, String archiveFileName) {
      if(! createZipArchive(dir, archiveFileName)){
         logger.info("Couldn't create zip archive. Trying tar.gz");
         if(! createTarArchive(dir, archiveFileName)){
            logger.info("Couldn't create tar.gz archive.");
         }
      }
   }