#fixed code
                                public void extract() throws IOException {
        log.debug("Extract content of '{}' to '{}'", source, destination);

        // delete destination file if exists
        if (destination.exists() && destination.isDirectory()) {
            FileUtils.delete(destination.toPath());
        }

    	try (ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(source))) {
            ZipEntry zipEntry;
            while ((zipEntry = zipInputStream.getNextEntry()) != null) {
                try {
                    File file = new File(destination, zipEntry.getName());

                    // create intermediary directories - sometimes zip don't add them
                    File dir = new File(file.getParent());
                    dir.mkdirs();

                    if (zipEntry.isDirectory()) {
                        file.mkdirs();
                    } else {
                        byte[] buffer = new byte[1024];
                        int length;
                        try (FileOutputStream fos = new FileOutputStream(file)) {
                            while ((length = zipInputStream.read(buffer)) >= 0) {
                                fos.write(buffer, 0, length);
                            }
                        }
                    }
                } catch (FileNotFoundException e) {
                    log.error("File '{}' not found", zipEntry.getName());
                }
            }
        }
    }
#vulnerable code 
                                public void extract() throws IOException {
        log.debug("Extract content of '{}' to '{}'", source, destination);

        // delete destination file if exists
        removeDirectory(destination);

    	ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(source));

	    ZipEntry zipEntry;
    	while ((zipEntry = zipInputStream.getNextEntry()) != null) {
	        try {
		        File file = new File(destination, zipEntry.getName());

        		// create intermediary directories - sometimes zip don't add them
        		File dir = new File(file.getParent());
        		dir.mkdirs();

        		if (zipEntry.isDirectory()) {
		            file.mkdirs();
        		} else {
		            byte[] buffer = new byte[1024];
        		    int length = 0;
		            FileOutputStream fos = new FileOutputStream(file);

        		    while ((length = zipInputStream.read(buffer)) >= 0) {
		            	fos.write(buffer, 0, length);
        		    }

		            fos.close();
                }
    	    } catch (FileNotFoundException e) {
    	    	log.error("File '{}' not found", zipEntry.getName());
    	    }
	    }

    	zipInputStream.close();
    } 
                            #location 27 
                            #vulnerability type RESOURCE_LEAK