#fixed code
                              public static boolean unpackJar(String jarName, String folderName, boolean del) {
    jarName = FileManager.slashify(jarName, false);
    if (!jarName.endsWith(".jar")) {
      jarName += ".jar";
    }
    if (!new File(jarName).isAbsolute()) {
      log(-1, "unpackJar: jar path not absolute");
      return false;
    }
    if (folderName == null) {
      folderName = jarName.substring(0, jarName.length() - 4);
    } else if (!new File(folderName).isAbsolute()) {
      log(-1, "unpackJar: folder path not absolute");
      return false;
    }
    folderName = FileManager.slashify(folderName, true);
    ZipInputStream in;
    BufferedOutputStream out;
    try {
      if (del) {
        FileManager.deleteFileOrFolder(folderName);
      }
      in = new ZipInputStream(new BufferedInputStream(new FileInputStream(jarName)));
      log0(lvl, "unpackJar: %s to %s", jarName, folderName);
      boolean isExecutable;
      int n;
      File f;
      for (ZipEntry z = in.getNextEntry(); z != null; z = in.getNextEntry()) {
        if (z.isDirectory()) {
          (new File(folderName, z.getName())).mkdirs();
        } else {
          n = z.getName().lastIndexOf(EXECUTABLE);
          if (n >= 0) {
            f = new File(folderName, z.getName().substring(0, n));
            isExecutable = true;
          } else {
            f = new File(folderName, z.getName());
            isExecutable = false;
          }
          f.getParentFile().mkdirs();
          out = new BufferedOutputStream(new FileOutputStream(f));
          bufferedWrite(in, out);
          out.close();
          if (isExecutable) {
            f.setExecutable(true, false);
          }
        }
      }
      in.close();
    } catch (Exception ex) {
      log0(-1, "unpackJar: " + ex.getMessage());
      return false;
    }
    log0(lvl, "unpackJar: completed");
    return true;
  }
#vulnerable code 
                              public static boolean unpackJar(String jarName, String folderName, boolean del) {
    ZipInputStream in = null;
    BufferedOutputStream out = null;
    try {
      if (del) {
        FileManager.deleteFileOrFolder(folderName);
      }
      in = new ZipInputStream(new BufferedInputStream(new FileInputStream(jarName)));
      log0(lvl, "unpackJar: %s to %s", jarName, folderName);
      boolean isExecutable;
      int n;
      File f;
      for (ZipEntry z = in.getNextEntry(); z != null; z = in.getNextEntry()) {
        if (z.isDirectory()) {
          (new File(folderName, z.getName())).mkdirs();
        } else {
          n = z.getName().lastIndexOf(EXECUTABLE);
          if (n >= 0) {
            f = new File(folderName, z.getName().substring(0, n));
            isExecutable = true;
          } else {
            f = new File(folderName, z.getName());
            isExecutable = false;
          }
          f.getParentFile().mkdirs();
          out = new BufferedOutputStream(new FileOutputStream(f));
          bufferedWrite(in, out);
          out.close();
          if (isExecutable) {
            f.setExecutable(true, false);
          }
        }
      }
      in.close();
    } catch (Exception ex) {
      log0(-1, "unpackJar: " + ex.getMessage());
      return false;
    }
    log0(lvl, "unpackJar: completed");
    return true;
  } 
                            #location 35 
                            #vulnerability type RESOURCE_LEAK