#vulnerable code 
                             public static void upZipFile(File zipFile, String folderPath) throws ZipException, IOException {
		File desDir = new File(folderPath);
		if (!desDir.exists()) {
			desDir.mkdirs();
		}
		ZipFile zf = new ZipFile(zipFile);
		for (Enumeration<?> entries = zf.entries(); entries.hasMoreElements(); ) {
			ZipEntry entry = ((ZipEntry) entries.nextElement());
			InputStream in = zf.getInputStream(entry);
			String str = folderPath;
			File desFile = new File(str, java.net.URLEncoder.encode(entry.getName(), "UTF-8"));

			if (!desFile.exists()) {
				File fileParentDir = desFile.getParentFile();
				if (!fileParentDir.exists()) {
					fileParentDir.mkdirs();
				}
			}

			OutputStream out = new FileOutputStream(desFile);
			byte[] buffer = new byte[1024 * 1024];
			int realLength = in.read(buffer);
			while (realLength != -1) {
				out.write(buffer, 0, realLength);
				realLength = in.read(buffer);
			}

			out.close();
			in.close();

		}
	} 
                            #location 5 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                             public static void upZipFile(File zipFile, String folderPath) throws ZipException, IOException {
		File desDir = new File(folderPath);
		if (!desDir.exists()) {
			if (!desDir.mkdirs()) {
				System.out.println("was not successful.");
			}
		}
		ZipFile zf = new ZipFile(zipFile);
		for (Enumeration<?> entries = zf.entries(); entries.hasMoreElements(); ) {
			ZipEntry entry = ((ZipEntry) entries.nextElement());
			InputStream in = zf.getInputStream(entry);
			String str = folderPath;
			File desFile = new File(str, java.net.URLEncoder.encode(entry.getName(), "UTF-8"));

			if (!desFile.exists()) {
				File fileParentDir = desFile.getParentFile();
				if (!fileParentDir.exists()) {
					if (!fileParentDir.mkdirs()) {
						System.out.println("was not successful.");
					}
				}
			}

			OutputStream out = new FileOutputStream(desFile);
			byte[] buffer = new byte[1024 * 1024];
			int realLength = in.read(buffer);
			while (realLength != -1) {
				out.write(buffer, 0, realLength);
				realLength = in.read(buffer);
			}

			out.close();
			in.close();

		}
	}