#vulnerable code 
                                protected void downloadAndExport(String driverVersion) throws IOException {
        Optional<String> driverInCache = searchDriverInCache(driverVersion);
        String versionStr = isUnknown(driverVersion) ? "(latest version)"
                : driverVersion;

        if (driverInCache.isPresent() && !config().isOverride()) {
            storeVersionToDownload(driverVersion);
            downloadedVersion = driverVersion;
            log.debug("Driver {} {} found in cache", getDriverName(),
                    versionStr);
            exportDriver(driverInCache.get());
        } else {
            List<URL> candidateUrls = getCandidateUrls(driverVersion);
            if (candidateUrls.isEmpty()) {
                Architecture arch = config().getArchitecture();
                String os = config().getOs();
                String errorMessage = getDriverName() + " " + versionStr
                        + " for " + os + arch.toString() + " not found in "
                        + getDriverUrl();
                log.error(errorMessage);
                throw new WebDriverManagerException(errorMessage);
            }

            // Download first candidate URL
            URL url = candidateUrls.iterator().next();
            String exportValue = downloader.download(url, versionToDownload,
                    getDriverName());
            exportDriver(exportValue);
            downloadedVersion = versionToDownload;
        }
    } 
                            #location 8 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                protected void downloadAndExport(String driverVersion) throws IOException {
        Optional<String> driverInCache = searchDriverInCache(driverVersion);
        String versionStr = isUnknown(driverVersion) ? "(latest version)"
                : driverVersion;

        if (driverInCache.isPresent() && !config().isOverride()) {
            storeVersionToDownload(driverVersion);
            log.debug("Driver {} {} found in cache", getDriverName(),
                    versionStr);
            exportDriver(driverInCache.get());
        } else {
            List<URL> candidateUrls = getCandidateUrls(driverVersion);
            if (candidateUrls.isEmpty()) {
                Architecture arch = config().getArchitecture();
                String os = config().getOs();
                String errorMessage = getDriverName() + " " + versionStr
                        + " for " + os + arch.toString() + " not found in "
                        + getDriverUrl();
                log.error(errorMessage);
                throw new WebDriverManagerException(errorMessage);
            }

            // Download first candidate URL
            URL url = candidateUrls.iterator().next();
            String exportValue = downloader.download(url, versionToDownload,
                    getDriverName());
            exportDriver(exportValue);
        }
        downloadedVersion = versionToDownload;
    }