output
stringlengths
64
73.2k
input
stringlengths
208
73.3k
instruction
stringclasses
1 value
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(proxyValue, proxyUser, proxyPass); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(driverManagerType); urlFilter = new UrlF...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(proxyValue, proxyUser, proxyPass); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(driverManagerType); urlFilter = ne...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public BrowserManager useTaobaoMirror() { return useTaobaoMirror("wdm.geckoDriverTaobaoUrl"); }
#vulnerable code @Override public BrowserManager useTaobaoMirror() { String taobaoUrl = null; try { taobaoUrl = WdmConfig .getString(WdmConfig.getString("wdm.geckoDriverTaobaoUrl")); driverUrl = new URL(taobaoUrl); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (isUnkn...
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected List<URL> getDriversFromGitHub() throws IOException { List<URL> urls; URL driverUrl = getDriverUrl(); log.info("Reading {} to seek {}", driverUrl, getDriverName()); Optional<URL> mirrorUrl = getMirrorUrl(); if (mirrorUrl.isPr...
#vulnerable code protected List<URL> getDriversFromGitHub() throws IOException { List<URL> urls; URL driverUrl = getDriverUrl(); log.info("Reading {} to seek {}", driverUrl, getDriverName()); Optional<URL> mirrorUrl = getMirrorUrl(); if (mirrorUr...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static final File extract(File compressedFile, String export) throws IOException { log.trace("Compressed file {}", compressedFile); File file = null; if (compressedFile.getName().toLowerCase().endsWith("tar.bz2")) { file = unBZip2(compressedFile, export); }...
#vulnerable code public static final File extract(File compressedFile, String export) throws IOException { log.trace("Compressed file {}", compressedFile); File file = null; if (compressedFile.getName().toLowerCase().endsWith("tar.bz2")) { file = unBZip2(compressedFile, export...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static File checkPhantom(File archive, String export) throws IOException { File target = null; String phantomName = "phantomjs"; if (export.contains(phantomName)) { String fileNoExtension = archive.getName().replace(".tar.bz2", "") .replace(".zip", ""); ...
#vulnerable code private static File checkPhantom(File archive, String export) throws IOException { File target; String phantomName = "phantomjs"; if (export.contains(phantomName)) { String fileNoExtension = archive.getName().replace(".tar.bz2", "") .replace(".zip", ""); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static final synchronized void download(URL url, String version, String export) throws IOException { File targetFile = new File(getTarget(version, url)); File binary; if (!targetFile.getParentFile().exists() || WdmConfig.getBoolean("wdm.override")) { log....
#vulnerable code public static final synchronized void download(URL url, String version, String export) throws IOException { File targetFile = new File(getTarget(version, url)); File binary; if (!targetFile.getParentFile().exists() || WdmConfig.getBoolean("wdm.override")) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public BrowserManager useTaobaoMirror() { return useTaobaoMirror("wdm.chromeDriverTaobaoUrl"); }
#vulnerable code @Override public BrowserManager useTaobaoMirror() { String taobaoUrl = null; try { taobaoUrl = WdmConfig.getString( WdmConfig.getString("wdm.chromeDriverTaobaoUrl")); driverUrl = new URL(taobaoUrl); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected List<URL> filterCandidateUrls(Architecture arch, String version, boolean getLatest) throws IOException { List<URL> urls = getDrivers(); List<URL> candidateUrls; log.trace("All URLs: {}", urls); boolean continueSearchingVe...
#vulnerable code protected List<URL> filterCandidateUrls(Architecture arch, String version, boolean getLatest) throws IOException { List<URL> urls = getDrivers(); List<URL> candidateUrls; log.trace("All URLs: {}", urls); boolean continueSearc...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected File postDownload(File archive) { log.trace("Post processing for Opera: {}", archive); File extractFolder = archive.getParentFile() .listFiles(getFolderFilter())[0]; if (!extractFolder.isFile()) { lo...
#vulnerable code @Override protected File postDownload(File archive) { log.trace("Post processing for Opera: {}", archive); File extractFolder = archive.getParentFile() .listFiles(getFolderFilter())[0]; if (!extractFolder.isFile()) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (isUnkn...
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected List<URL> getCandidateUrls(String driverVersion) throws IOException { List<URL> urls = getDrivers(); List<URL> candidateUrls; log.trace("All URLs: {}", urls); boolean getLatest = isUnknown(driverVersion); Architect...
#vulnerable code protected List<URL> getCandidateUrls(String driverVersion) throws IOException { List<URL> urls = getDrivers(); List<URL> candidateUrls; log.trace("All URLs: {}", urls); boolean getLatest = isUnknown(driverVersion); Arc...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config().getTimeout()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(driverManagerType); urlFilter = new UrlFilter(); ...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config().getTimeout()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(driverManagerType); urlFilter = new UrlFilter...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void exportDriver(String variableValue) { downloadedDriverVersion = driverVersionToDownload; binaryPath = variableValue; Optional<String> exportParameter = getExportParameter(); if (!config.isAvoidExport() && exportParameter.isPresent...
#vulnerable code protected void exportDriver(String variableValue) { downloadedVersion = versionToDownload; binaryPath = variableValue; Optional<String> exportParameter = getExportParameter(); if (!config.isAvoidExport() && exportParameter.isPresent()) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static File unBZip2(File archive, String export) throws IOException { Archiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.TAR, CompressionType.BZIP2); archiver.extract(archive, archive.getParentFile()); log.trace("Unbzip2 {}", archive); File targe...
#vulnerable code public static File unBZip2(File archive, String export) throws IOException { Archiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.TAR, CompressionType.BZIP2); archiver.extract(archive, archive.getParentFile()); log.trace("Unbzip2 {}", archive); File...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected List<String> getBetaVersions() { List<String> betaVersions = new ArrayList<>(); DriverManagerType[] browsersWithBeta = { CHROME }; for (DriverManagerType driverManagerType : browsersWithBeta) { String key = driverManagerType.name(...
#vulnerable code protected List<String> getBetaVersions() { List<String> betaVersions = new ArrayList<>(); DriverManagerType[] browsersWithBeta = { CHROME }; for (DriverManagerType driverManagerType : browsersWithBeta) { String key = driverManagerType...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (isUnkn...
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public synchronized void download(URL url, String version, String export, List<String> driverName) throws IOException { File targetFile = new File(getTarget(version, url)); File binary = null; // Check if binary exists boolean down...
#vulnerable code public synchronized void download(URL url, String version, String export, List<String> driverName) throws IOException { File targetFile = new File(getTarget(version, url)); File binary = null; // Check if binary exists boolea...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void reset() { useBetaVersions = false; mirrorLog = false; isForcingCache = false; isForcingDownload = false; listVersions = null; architecture = null; driverUrl = null; version = null; proxyVal...
#vulnerable code protected void reset() { useBetaVersions = getBoolean("wdm.useBetaVersions"); mirrorLog = false; isForcingCache = false; isForcingDownload = false; listVersions = null; architecture = null; driverUrl = null; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void handleDriver(URL url, String driver, List<URL> out) { if (!config().isUseBetaVersions() && url.getFile().toLowerCase().contains("beta")) { return; } if (url.getFile().contains(driver)) { String cur...
#vulnerable code protected void handleDriver(URL url, String driver, List<URL> out) { if (!useBeta && url.getFile().toLowerCase().contains("beta")) { return; } if (url.getFile().contains(driver)) { String currentVersion = getCurrentVersion...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public BrowserManager useTaobaoMirror() { return useTaobaoMirror("wdm.operaDriverTaobaoUrl"); }
#vulnerable code @Override public BrowserManager useTaobaoMirror() { String taobaoUrl = null; try { taobaoUrl = getString(getString("wdm.operaDriverTaobaoUrl")); driverUrl = new URL(taobaoUrl); } catch (MalformedURLException e) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected Optional<String> handleCache(Architecture arch, String version, String os, boolean getLatest, boolean cache) { Optional<String> driverInCache = empty(); if (cache || !getLatest) { driverInCache = getDriverFromCache(version, ar...
#vulnerable code protected Optional<String> handleCache(Architecture arch, String version, String os, boolean getLatest, boolean cache) { Optional<String> driverInCache = empty(); if (cache || !getLatest) { driverInCache = getDriverFromCache(versi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void reset() { config().reset(); mirrorLog = false; listVersions = null; versionToDownload = null; }
#vulnerable code protected void reset() { config().reset(); mirrorLog = false; listVersions = null; versionToDownload = null; downloadedVersion = null; driverManagerType = null; } #location 6 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void exportDriver(String variableValue) { driverPath = variableValue; Optional<String> exportParameter = getExportParameter(); if (!config.isAvoidExport() && exportParameter.isPresent()) { String variableName = exportParameter.get...
#vulnerable code protected void exportDriver(String variableValue) { binaryPath = variableValue; Optional<String> exportParameter = getExportParameter(); if (!config.isAvoidExport() && exportParameter.isPresent()) { String variableName = exportParamet...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void handleDriver(URL url, String driver, List<URL> out) { if (!useBetaVersions && !getBoolean("wdm.useBetaVersions") && url.getFile().toLowerCase().contains("beta")) { return; } if (url.getFile().contains(driver))...
#vulnerable code protected void handleDriver(URL url, String driver, List<URL> out) { if (!useBetaVersions && url.getFile().toLowerCase().contains("beta")) { return; } if (url.getFile().contains(driver)) { String currentVersion = getCurren...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<URL> getDrivers() throws IOException { URL driverUrl = getDriverUrl(); String driverVersion = versionToDownload; BufferedReader reader = new BufferedReader( new InputStreamReader(openGitHubConnection(driverUrl))); GsonBuilder gsonBuilder = ne...
#vulnerable code @Override public List<URL> getDrivers() throws IOException { URL driverUrl = getDriverUrl(); String driverVersion = versionToDownload; BufferedReader reader = new BufferedReader( new InputStreamReader(openGitHubConnection(driverUrl))); GsonBuilder gsonBuilde...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void handleException(Exception e, Architecture arch, String version) { String errorMessage = String.format( "There was an error managing %s %s (%s)", getDriverName(), version, e.getMessage()); if (!config()...
#vulnerable code protected void handleException(Exception e, Architecture arch, String version) { if (!config().isForcingCache()) { config().setForcingCache(true); log.warn( "There was an error managing {} {} ({}) ... tryin...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected List<URL> getVersion(List<URL> list, String driver, String version) { List<URL> out = new ArrayList<>(); for (URL url : list) { if (url.getFile().contains(driver) && url.getFile().contains(version) ...
#vulnerable code protected List<URL> getVersion(List<URL> list, String driver, String version) { List<URL> out = new ArrayList<>(); if (getDriverName().contains("msedgedriver")) { int i = listVersions.indexOf(version); if (i != -1) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public WebDriverManager useTaobaoMirror(String taobaoUrl) { driverUrl = getUrl(taobaoUrl); return instanceMap.get(driverManagerType); }
#vulnerable code public WebDriverManager useTaobaoMirror(String taobaoUrl) { driverUrl = getUrl(taobaoUrl); return instance; } #location 3 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void handleException(Exception e, Architecture arch, String version) { String versionStr = isNullOrEmpty(version) ? "(latest version)" : version; String errorMessage = String.format( "There was an error man...
#vulnerable code protected void handleException(Exception e, Architecture arch, String version) { String versionStr = isNullOrEmpty(version) ? "(latest version)" : version; String errorMessage = String.format( "There was an err...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected List<URL> getDriversFromGitHub() throws IOException { List<URL> urls; URL driverUrl = getDriverUrl(); log.info("Reading {} to seek {}", driverUrl, getDriverName()); Optional<URL> mirrorUrl = getMirrorUrl(); if (mirrorUrl.isPr...
#vulnerable code protected List<URL> getDriversFromGitHub() throws IOException { List<URL> urls; URL driverUrl = getDriverUrl(); log.info("Reading {} to seek {}", driverUrl, getDriverName()); Optional<URL> mirrorUrl = getMirrorUrl(); if (mirrorUr...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public BrowserManager useTaobaoMirror() { return useTaobaoMirror("wdm.phantomjsDriverTaobaoUrl"); }
#vulnerable code @Override public BrowserManager useTaobaoMirror() { String taobaoUrl = null; try { taobaoUrl = getString(getString("wdm.phantomjsDriverTaobaoUrl")); driverUrl = new URL(taobaoUrl); } catch (MalformedURLException e) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected File postDownload(File archive) { log.trace("Post processing for Opera: {}", archive); final String operaDriverName = getDriverName().get(0); FilenameFilter filter = new FilenameFilter() { @Override publ...
#vulnerable code @Override protected File postDownload(File archive) { log.trace("Post processing for Opera: {}", archive); File extractFolder = archive.getParentFile().listFiles()[0]; if (!extractFolder.isFile()) { log.trace("Opera extract folde...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public WebDriverManager browserPath(String browserPath) { config().setBinaryPath(browserPath); return instanceMap.get(driverManagerType); }
#vulnerable code public WebDriverManager browserPath(String browserPath) { browserBinaryPath = browserPath; return instanceMap.get(driverManagerType); } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected String resolveDriverVersion(String driverVersion) { String preferenceKey = getKeyForPreferences(); Optional<String> browserVersion = empty(); browserVersion = getValueFromPreferences(preferenceKey, browserVersion); if (!browserVersion...
#vulnerable code protected String resolveDriverVersion(String driverVersion) { preferenceKey = getKeyForPreferences(); Optional<String> browserVersion = empty(); browserVersion = getValueFromPreferences(browserVersion); if (!browserVersion.isPresent()) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); if (isUnknown(driverVersion)) { dri...
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); if (isUnknown(driverVersion)) { dri...
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); if (isUnknown(driverVersion)) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void handleException(Exception e, Architecture arch, String version) { String versionStr = isNullOrEmpty(version) ? "(latest version)" : version; String errorMessage = String.format( "There was an error man...
#vulnerable code protected void handleException(Exception e, Architecture arch, String version) { String versionStr = isNullOrEmpty(version) ? "(latest version)" : version; String errorMessage = String.format( "There was an err...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected List<URL> filterCandidateUrls(Architecture arch, String version, boolean getLatest) throws IOException { List<URL> urls = getDrivers(); List<URL> candidateUrls; log.trace("All URLs: {}", urls); boolean continueSearchingVe...
#vulnerable code protected List<URL> filterCandidateUrls(Architecture arch, String version, boolean getLatest) throws IOException { List<URL> urls = getDrivers(); List<URL> candidateUrls; log.trace("All URLs: {}", urls); boolean continueSearc...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected Optional<String> getDriverVersionFromProperties(String key) { // Chromium values are the same than Chrome if (key.contains("chromium")) { key = key.replace("chromium", "chrome"); } boolean online = config().getVersionsPro...
#vulnerable code protected Optional<String> getDriverVersionFromProperties(String key) { boolean online = config().getVersionsPropertiesOnlineFirst(); String onlineMessage = online ? ONLINE : LOCAL; log.debug("Getting driver version for {} from {} versions.proper...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void handleDriver(URL url, String driver, List<URL> out) { if (!useBetaVersions && !getBoolean("wdm.useBetaVersions") && url.getFile().toLowerCase().contains("beta")) { return; } if (url.getFile().contains(driver))...
#vulnerable code protected void handleDriver(URL url, String driver, List<URL> out) { if (!useBetaVersions && url.getFile().toLowerCase().contains("beta")) { return; } if (url.getFile().contains(driver)) { String currentVersion = getCurren...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCache() throws Exception { BrowserManager browserManager = WebDriverManager .getInstance(driverClass); browserManager.architecture(architecture).version(driverVersion) .setup(); Downloader downloader = new Downloader(browserManager); Metho...
#vulnerable code @Test public void testCache() throws Exception { BrowserManager browserManager = null; if (browserManagerClass.equals(ChromeDriverManager.class)) { browserManager = ChromeDriverManager.getInstance(); } else if (browserManagerClass.equals(OperaDriverManager.class)...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected List<URL> getCandidateUrls(String driverVersion) throws IOException { List<URL> urls = getDrivers(); List<URL> candidateUrls; log.trace("All URLs: {}", urls); boolean getLatest = isUnknown(driverVersion); Architect...
#vulnerable code protected List<URL> getCandidateUrls(String driverVersion) throws IOException { List<URL> urls = getDrivers(); List<URL> candidateUrls; log.trace("All URLs: {}", urls); boolean getLatest = isUnknown(driverVersion); Arc...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (isUnkn...
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected File postDownload(File archive) { log.trace("PhatomJS package name: {}", archive); File extractFolder = archive.getParentFile() .listFiles(getFolderFilter())[0]; log.trace("PhatomJS extract folder (to be deleted...
#vulnerable code @Override protected File postDownload(File archive) { log.trace("PhatomJS package name: {}", archive); File extractFolder = archive.getParentFile().listFiles()[0]; log.trace("PhatomJS extract folder (to be deleted): {}", extractFolder); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected Optional<String> getLatestVersion() { String url = config().getChromeDriverUrl() + "LATEST_RELEASE"; Optional<String> version = Optional.empty(); try { InputStream response = httpClient .execute(h...
#vulnerable code @Override protected Optional<String> getLatestVersion() { String url = config().getChromeDriverUrl() + "LATEST_RELEASE"; HttpGet request = new HttpGet(url); request.addHeader("User-Agent", USER_AGENT); HttpResponse response; O...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void reset() { config().reset(); mirrorLog = false; listVersions = null; versionToDownload = null; }
#vulnerable code protected void reset() { config().reset(); mirrorLog = false; listVersions = null; versionToDownload = null; downloadedVersion = null; driverManagerType = null; } #location 7 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config().getTimeout()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(driverManagerType); urlFilter = new UrlFilter(); ...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config().getTimeout()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(driverManagerType); urlFilter = new UrlFilter...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<URL> getDrivers() throws IOException { URL driverUrl = getDriverUrl(); String driverVersion = versionToDownload; BufferedReader reader = new BufferedReader( new InputStreamReader(openGitHubConnection(driverUrl))); GsonBuilder gsonBuilder = ne...
#vulnerable code @Override public List<URL> getDrivers() throws IOException { URL driverUrl = getDriverUrl(); String driverVersion = versionToDownload; BufferedReader reader = new BufferedReader( new InputStreamReader(openGitHubConnection(driverUrl))); GsonBuilder gsonBuilde...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(proxyValue, proxyUser, proxyPass); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(this, wdmHttpClient); urlFilter = new Ur...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new WdmHttpClient.Builder().proxy(proxyValue) .proxyUser(proxyUser).proxyPass(proxyPass).build(); try (WdmHttpClient wdmHttpClient = httpClient) { downloa...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private List<URL> filterCandidateUrls(Architecture arch, String version, boolean getLatest) throws IOException { List<URL> urls = getDrivers(); List<URL> candidateUrls; log.trace("All URLs: {}", urls); boolean continueSearchingVers...
#vulnerable code private List<URL> filterCandidateUrls(Architecture arch, String version, boolean getLatest) throws IOException { List<URL> urls = getDrivers(); List<URL> candidateUrls; log.trace("All URLs: {}", urls); boolean continueSearchi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); if (isUnknown(driverVersion)) { dri...
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); if (isUnknown(driverVersion)) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static final synchronized void download(URL url, String version, String export, List<String> driverName) throws IOException { File targetFile = new File(getTarget(version, url)); File binary = null; // Check if binary exists boolean download = !targetFile.getP...
#vulnerable code public static final synchronized void download(URL url, String version, String export, List<String> driverName) throws IOException { File targetFile = new File(getTarget(version, url)); File binary = null; // Check if binary exists boolean download = !targetFil...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config().getTimeout()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlF...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected String resolveDriverVersion(String driverVersion) { String preferenceKey = getKeyForPreferences(); Optional<String> browserVersion = empty(); browserVersion = getValueFromPreferences(preferenceKey, browserVersion); if (!browserVersion...
#vulnerable code protected String resolveDriverVersion(String driverVersion) { preferenceKey = getKeyForPreferences(); Optional<String> browserVersion = empty(); browserVersion = getValueFromPreferences(browserVersion); if (!browserVersion.isPresent()) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void reset() { config().reset(); mirrorLog = false; versionToDownload = null; forcedArch = false; forcedOs = false; retryCount = 0; isSnap = false; }
#vulnerable code protected void reset() { config().reset(); mirrorLog = false; versionToDownload = null; forcedArch = false; forcedOs = false; retryCount = 0; isLatest = true; isSnap = false; } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void reset() { config().reset(); mirrorLog = false; listVersions = null; versionToDownload = null; forcedArch = false; forcedOs = false; retryCount = 0; isLatest = true; }
#vulnerable code protected void reset() { config().reset(); mirrorLog = false; listVersions = null; versionToDownload = null; forcedArch = false; forcedOs = false; retry = true; isLatest = true; } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected String download(String driverVersion) throws IOException { List<URL> candidateUrls = getCandidateUrls(driverVersion); if (candidateUrls.isEmpty()) { Architecture arch = config().getArchitecture(); String os = config().getOs();...
#vulnerable code protected String download(String driverVersion) throws IOException { List<URL> candidateUrls = getCandidateUrls(driverVersion); if (candidateUrls.isEmpty()) { Architecture arch = config().getArchitecture(); String os = config().ge...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void reset() { config().reset(); mirrorLog = false; listVersions = null; versionToDownload = null; forcedArch = false; }
#vulnerable code protected void reset() { config().reset(); mirrorLog = false; listVersions = null; versionToDownload = null; forcedArch = false; useBeta = config().isUseBetaVersions(); } #location 7 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected Optional<String> getDefaultBrowserVersion(String programFilesEnv, String winBrowserName, String linuxBrowserName, String macBrowserName, String versionFlag, String browserNameInOutput) { String browserBinaryPath = config()...
#vulnerable code protected Optional<String> getDefaultBrowserVersion(String programFilesEnv, String winBrowserName, String linuxBrowserName, String macBrowserName, String versionFlag, String browserNameInOutput) { if (IS_OS_WINDOWS) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void storeVersionToDownload(String driverVersion) { if (!isUnknown(driverVersion)) { if (driverVersion.startsWith(".")) { driverVersion = driverVersion.substring(1); } driverVersionToDownload = driverVersio...
#vulnerable code protected void storeVersionToDownload(String driverVersion) { if (!isUnknown(driverVersion)) { if (driverVersion.startsWith(".")) { driverVersion = driverVersion.substring(1); } versionToDownload = driverVersio...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void reset() { useBetaVersions = false; mirrorLog = false; isForcingCache = false; isForcingDownload = false; listVersions = null; architecture = null; driverUrl = null; version = null; proxyVal...
#vulnerable code protected void reset() { useBetaVersions = getBoolean("wdm.useBetaVersions"); mirrorLog = false; isForcingCache = false; isForcingDownload = false; listVersions = null; architecture = null; driverUrl = null; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config().getProxyValue(), config().getProxyUser(), config().getProxyPass()); httpClient.setTimeout(config().getTimeout()); try (HttpClient wdmHttpCli...
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config().getProxyValue(), config().getProxyUser(), config().getProxyPass()); httpClient.setTimeout(config().getTimeout()); try (HttpClient wdmH...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void manage(Architecture arch, String version) { try { boolean getLatest = version == null || version.isEmpty() || version.equalsIgnoreCase(DriverVersion.LATEST.name()) || version.equalsIgnoreCase( DriverVersion.NOT_SPECIFIED.name()); String driv...
#vulnerable code public void manage(Architecture arch, String version) { try { boolean getLatest = version == null || version.isEmpty() || version.equalsIgnoreCase(DriverVersion.LATEST.name()) || version.equalsIgnoreCase( DriverVersion.NOT_SPECIFIED.name()); Strin...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void exportDriver(String variableValue) { downloadedDriverPath = variableValue; Optional<String> exportParameter = getExportParameter(); if (!config.isAvoidExport() && exportParameter.isPresent()) { String variableName = exportPar...
#vulnerable code protected void exportDriver(String variableValue) { driverPath = variableValue; Optional<String> exportParameter = getExportParameter(); if (!config.isAvoidExport() && exportParameter.isPresent()) { String variableName = exportParamet...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected String getTargetPath() { String path = null; Object resolved = resolveConfigKey("wdm.targetPath", targetPath); if (resolved != null) { path = (String) resolved; if (path.contains(HOME)) { path = path.re...
#vulnerable code protected String getTargetPath() { String path = (String) resolveConfigKey("wdm.targetPath", targetPath); if (path.contains(HOME)) { path = path.replace(HOME, System.getProperty("user.home")); } return path; } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testServer() throws IOException { String serverUrl = String.format("http://localhost:%s/%s", serverPort, path); OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder().url(serverUrl).build...
#vulnerable code @Test public void testServer() throws IOException { String serverUrl = String.format("http://localhost:%s/%s", serverPort, path); OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder().url(serverUrl)...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void downloadAndExport(String driverVersion) throws IOException { Optional<String> driverInCache = searchDriverInCache(driverVersion); String versionStr = isUnknown(driverVersion) ? "(latest version)" : driverVersion; if (dri...
#vulnerable code protected void downloadAndExport(String driverVersion) throws IOException { Optional<String> driverInCache = searchDriverInCache(driverVersion); String versionStr = isUnknown(driverVersion) ? "(latest version)" : driverVersion; i...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(final String[] args) throws Throwable { toInfinityAndBeyond(); logger.info("Starting ..."); final ScheduledExecutorService downloadExecutor = Executors .newSingleThreadScheduledExecutor(new NameThreadFactory("...
#vulnerable code public static void main(final String[] args) throws Throwable { toInfinityAndBeyond(); logger.info("Starting ..."); final ScheduledExecutorService downloadExecutor = Executors .newSingleThreadScheduledExecutor(new NameThreadFac...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(final String... args) throws Throwable { toInfinityAndBeyond(); final Options opts = new Options(); opts.addOption( builder("n") .longOpt("basename") .hasArg().a...
#vulnerable code public static void main(final String... args) throws Throwable { toInfinityAndBeyond(); final Options opts = new Options(); opts.addOption("n", "basename", true, "The base name of the simulator instance"); opts.addOption(null, "name-fac...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ConsoleSetting settings = ConsoleSetting.getInstance(); String authCode = req.getParameter("code"); String uri...
#vulnerable code @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String authCode = req.getParameter("code"); String uri = "http://localhost:9090/auth/realms/master/protocol/openid-conne...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(final String[] args) throws Throwable { toInfinityAndBeyond(); logger.info("Starting ..."); final ScheduledExecutorService downloadExecutor = Executors .newSingleThreadScheduledExecutor(new NameThreadFactory("...
#vulnerable code public static void main(final String[] args) throws Throwable { toInfinityAndBeyond(); logger.info("Starting ..."); final ScheduledExecutorService downloadExecutor = Executors .newSingleThreadScheduledExecutor(new NameThreadFac...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @SuppressWarnings("Duplicates") private void checkIconResource(KapuaTicon icon) { ConsoleSetting config = ConsoleSetting.getInstance(); String iconResource = icon.getResource(); // // Check if the resource is an HTTP URL or not if...
#vulnerable code @SuppressWarnings("Duplicates") private void checkIconResource(KapuaTicon icon) { ConsoleSetting config = ConsoleSetting.getInstance(); String iconResource = icon.getResource(); // // Check if the resource is an HTTP URL or not ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @SuppressWarnings("Duplicates") private void checkIconResource(KapuaTicon icon) { ConsoleSetting config = ConsoleSetting.getInstance(); String iconResource = icon.getResource(); // // Check if the resource is an HTTP URL or not if...
#vulnerable code @SuppressWarnings("Duplicates") private void checkIconResource(KapuaTicon icon) { ConsoleSetting config = ConsoleSetting.getInstance(); String iconResource = icon.getResource(); // // Check if the resource is an HTTP URL or not ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @SuppressWarnings("Duplicates") private void checkIconResource(KapuaTicon icon) { ConsoleSetting config = ConsoleSetting.getInstance(); String iconResource = icon.getResource(); // // Check if the resource is an HTTP URL or not if...
#vulnerable code @SuppressWarnings("Duplicates") private void checkIconResource(KapuaTicon icon) { ConsoleSetting config = ConsoleSetting.getInstance(); String iconResource = icon.getResource(); // // Check if the resource is an HTTP URL or not ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ConsoleSetting settings = ConsoleSetting.getInstance(); String authCode = req.getParameter("code"); String uri...
#vulnerable code @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String authCode = req.getParameter("code"); String uri = "http://localhost:9090/auth/realms/master/protocol/openid-conne...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void commitAndRelease(boolean modifiesInedges, boolean modifiesOutedges) throws IOException { int nblocks = blockIds.length; if (modifiesInedges) { int startStreamBlock = rangeStartEdgePtr / blocksize; for(int i=0; i < nblocks; i++) { String blockFilename =...
#vulnerable code public void commitAndRelease(boolean modifiesInedges, boolean modifiesOutedges) throws IOException { byte[] data = dataBlockManager.getRawBlock(blockId); if (modifiesInedges) { FileOutputStream fos = new FileOutputStream(new File(edgeDataFil...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void loadVertices(int windowStart, int windowEnd, ChiVertex[] vertices) throws FileNotFoundException, IOException { if (adjData == null) { blocksize = ChiFilenames.getBlocksize(converter.sizeOf()); loadAdj(); loadEdata(); } System.out.println("Load memo...
#vulnerable code public void loadVertices(int windowStart, int windowEnd, ChiVertex[] vertices) throws FileNotFoundException, IOException { if (adjData == null) { loadAdj(); edataFilesize = (int) new File(edgeDataFilename).length(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void loadVertices(int windowStart, int windowEnd, ChiVertex[] vertices) throws FileNotFoundException, IOException { if (adjData == null) { blocksize = ChiFilenames.getBlocksize(converter.sizeOf()); loadAdj(); loadEdata(); } System.out.println("Load memo...
#vulnerable code public void loadVertices(int windowStart, int windowEnd, ChiVertex[] vertices) throws FileNotFoundException, IOException { if (adjData == null) { loadAdj(); edataFilesize = (int) new File(edgeDataFilename).length(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void commitAndRelease(boolean modifiesInedges, boolean modifiesOutedges) throws IOException { byte[] data = dataBlockManager.getRawBlock(blockId); if (modifiesInedges) { FileOutputStream fos = new FileOutputStream(new File(edgeDataFilename)...
#vulnerable code public void commitAndRelease(boolean modifiesInedges, boolean modifiesOutedges) throws IOException { byte[] data = dataBlockManager.getRawBlock(blockId); if (modifiesInedges) { FileOutputStream fos = new FileOutputStream(new File(edgeDataFil...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void commitAndRelease(boolean modifiesInedges, boolean modifiesOutedges) throws IOException { byte[] data = dataBlockManager.getRawBlock(blockId); if (modifiesInedges) { FileOutputStream fos = new FileOutputStream(new File(edgeDataFilename)...
#vulnerable code public void commitAndRelease(boolean modifiesInedges, boolean modifiesOutedges) throws IOException { byte[] data = dataBlockManager.getRawBlock(blockId); if (modifiesInedges) { FileOutputStream fos = new FileOutputStream(new File(edgeDataFil...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void commitAndRelease(boolean modifiesInedges, boolean modifiesOutedges) throws IOException { int nblocks = blockIds.length; if (modifiesInedges) { int startStreamBlock = rangeStartEdgePtr / blocksize; for(int i=0; i < nblocks; i++) { String blockFilename =...
#vulnerable code public void commitAndRelease(boolean modifiesInedges, boolean modifiesOutedges) throws IOException { byte[] data = dataBlockManager.getRawBlock(blockId); if (modifiesInedges) { FileOutputStream fos = new FileOutputStream(new File(edgeDataFil...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void send() throws Exception { if ((message == null) || (endpoint == null)) { logger.debug("event=send_http_request error_code=MissingParameters endpoint=" + endpoint + "\" message=\"" + message + "\""); throw new Exception("Message and Endpoint must b...
#vulnerable code @Override public void send() throws Exception { logger.debug("event=send_sync_http_request endpoint=" + endpoint + "\" message=\"" + message + "\""); if ((message == null) || (endpoint == null)) { logger.debug("event=send_http_request error_code=MissingParameters...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (redirectUnauthenticatedUser(request, response)) { return; } CMBControllerServlet.valueAccumulator.initializeAllCounters(); response....
#vulnerable code @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (redirectUnauthenticatedUser(request, response)) { return; } CMBControllerServlet.valueAccumulator.initializeAllCounters(); res...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (redirectUnauthenticatedUser(request, response)) { return; } CMBControllerServlet.valueAccumulator.initializeAllCounters(); response.se...
#vulnerable code @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (redirectUnauthenticatedUser(request, response)) { return; } CMBControllerServlet.valueAccumulator.initializeAllCounters(); respo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean await(long timeout, TimeUnit unit) throws InterruptedException { long timeoutMillis = unit.toMillis(timeout); long endTime = System.currentTimeMillis() + timeoutMillis; synchronized (this) { if (done) return done; if (tim...
#vulnerable code @Override public boolean await(long timeout, TimeUnit unit) throws InterruptedException { long timeoutMillis = unit.toMillis(timeout); long endTime = System.currentTimeMillis() + timeoutMillis; synchronized (this) { if (ready) return ready; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static String readFileAsString(String filePath) throws IOException { byte[] buffer = new byte[(int) getFile(filePath).length()]; BufferedInputStream bis = null; try { bis = new BufferedInputStream(new FileInputStream(getFile(filePath))); bis.read(buffer); } ...
#vulnerable code public static String readFileAsString(String filePath) throws IOException { byte[] buffer = new byte[(int) getFile(filePath).length()]; BufferedInputStream inputStream = null; try { inputStream = new BufferedInputStream(new FileInputStream(getFile(filePath))); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void state4ENTITY() throws ProtocolException { boolean done = skip(CR, LF); if (!done) { return; } // content length if (httpMessage.getFirstHeader(HttpHeaderType.CONTENT_LENGTH.getName()) != null) { entity = new HttpEntity(); entity.setContentT...
#vulnerable code protected void state4ENTITY() throws ProtocolException { boolean done = skip(CR, LF); if (!done) { return; } // content length if (httpMessage.getFirstHeader(HttpHeaders.CONTENT_LENGTH.getName()) != null) { entity = new HttpEntity(); entity.setChars...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @BeforeClass public static void startElasticsearchRestClient() throws IOException { testClusterPort = Integer.parseInt(System.getProperty("tests.cluster.port", DEFAULT_TEST_CLUSTER_PORT.toString())); testClusterHost = System.getProperty("tests.cluster.host...
#vulnerable code @BeforeClass public static void startElasticsearchRestClient() throws IOException { testClusterPort = Integer.parseInt(System.getProperty("tests.cluster.port", DEFAULT_TEST_CLUSTER_PORT.toString())); testClusterHost = System.getProperty("tests.cluste...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Collection<FileAbstractModel> getFiles(String dir) { logger.debug("Listing local files from {}", dir); File[] files = new File(dir).listFiles(); Collection<FileAbstractModel> result; if (files != null) { result...
#vulnerable code @Override public Collection<FileAbstractModel> getFiles(String dir) { if (logger.isDebugEnabled()) logger.debug("Listing local files from {}", dir); File[] files = new File(dir).listFiles(); Collection<FileAbstractModel> result = new ArrayLi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void start() throws Exception { logger.info("Starting FS crawler"); if (loop < 0) { logger.info("FS crawler started in watch mode. It will run unless you stop it with CTRL+C."); } if (loop == 0 && !rest) { closed...
#vulnerable code public void start() throws Exception { logger.info("Starting FS crawler"); if (loop < 0) { logger.info("FS crawler started in watch mode. It will run unless you stop it with CTRL+C."); } if (loop == 0 && !rest) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected SuggestRefreshResponse newResponse(SuggestRefreshRequest request, AtomicReferenceArray shardsResponses, ClusterState clusterState) { int successfulShards = 0; int failedShards = 0; List<ShardOperationFailedException> shardFailur...
#vulnerable code @Override protected SuggestRefreshResponse newResponse(SuggestRefreshRequest request, AtomicReferenceArray shardsResponses, ClusterState clusterState) { int successfulShards = 0; int failedShards = 0; List<ShardOperationFailedException> shard...
Below is the vulnerable code, please generate the patch based on the following information.