input
stringlengths
205
73.3k
output
stringlengths
64
73.2k
instruction
stringclasses
1 value
#vulnerable code @Test public static void testApp() throws Exception { ParallelThread parallelThread = new ParallelThread(); List<String> tests = new ArrayList<>(); //tests.add("HomePageTest1"); //tests.add("HomePageTest2"); boolean hasFailur...
#fixed code @Test public static void testApp() throws Exception { ParallelThread parallelThread = new ParallelThread(); List<String> tests = new ArrayList<>(); tests.add("HomePageTest3"); tests.add("HomePageTest2"); boolean hasFailures = paral...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Map<String, String> getDevices() throws Exception { startADB(); // start adb service String output = cmd.runCommand("adb devices"); String[] lines = output.split("\n"); if (lines.length <= 1) { System.out.println("No ...
#fixed code public Map<String, String> getDevices() throws Exception { startADB(); // start adb service String output = cmd.runCommand("adb devices"); String[] lines = output.split("\n"); if (lines.length <= 1) { System.out.println("No Androi...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void destroyAppiumNode(String host) throws IOException { new Api().getResponse("http://" + host + ":4567" + "/appium/stop").body().string(); } #location 4 #vulner...
#fixed code @Override public void destroyAppiumNode(String host) throws Exception { new Api().getResponse("http://" + host + ":" + getRemoteAppiumManagerPort(host) + "/appium/stop").body().string(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public synchronized AppiumServiceBuilder startAppiumServer(String methodName) throws Exception { device_udid = getNextAvailableDeviceId(); if (device_udid == null) { System.out.println("No devices are free to run test or Failed to run test");...
#fixed code public synchronized AppiumServiceBuilder startAppiumServer(String methodName) throws Exception { device_udid = getNextAvailableDeviceId(); if (device_udid == null) { System.out.println("No devices are free to run test or Failed to run test"); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void startingServerInstance() throws Exception { if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) { driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidWeb()); } else { if (System.getProperty("os.name").t...
#fixed code public void startingServerInstance() throws Exception { startingServerInstance(null, null); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static void main(String[] args) { // TODO Auto-generated method stub // List<Class> testCases = new ArrayList<Class>(); // testCases.add(HomePageTest1.class); // testCases.add(HomePageTest2.class); // testCases.add(HomePageTest3.class); // testCases.add(Ho...
#fixed code public static void main(String[] args) throws IOException { String logo = "http://sauceio.com/wp-content/uploads/2014/04/appium_logo_final.png"; StringBuilder sb = new StringBuilder(); String a = "testcasepassed"; sb.append("<html>"); sb.append("<head>"); sb.append(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void startingServerInstance() throws Exception { if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) { driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidWeb()); } else { if (System.getProperty("os.name").t...
#fixed code public void startingServerInstance() throws Exception { startingServerInstance(null, null); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public static void testApp() throws Exception { ParallelThread parallelThread = new ParallelThread(); List<String> tests = new ArrayList<>(); //tests.add("HomePageTest1"); //tests.add("HomePageTest2"); boolean hasFailur...
#fixed code @Test public static void testApp() throws Exception { ParallelThread parallelThread = new ParallelThread(); List<String> tests = new ArrayList<>(); tests.add("HomePageTest3"); tests.add("HomePageTest2"); boolean hasFailures = paral...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void processIsInJarAndlastModified() { try { URLConnection conn = url.openConnection(); if ("jar".equals(url.getProtocol()) || conn instanceof JarURLConnection) { isInJar = true; lastModified = -1; } else { isInJar = false; lastModified...
#fixed code protected void processIsInJarAndlastModified() { if ("file".equalsIgnoreCase(url.getProtocol())) { isInJar = false; lastModified = new File(url.getFile()).lastModified(); } else { isInJar = true; lastModified = -1; } }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected long getLastModified() { try { URLConnection conn = url.openConnection(); return conn.getLastModified(); } catch (IOException e) { throw new RuntimeException(e); } } #location 4 #vulnerabil...
#fixed code protected long getLastModified() { return new File(url.getFile()).lastModified(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void processIsInJarAndlastModified() { try { URLConnection conn = url.openConnection(); if ("jar".equals(url.getProtocol()) || conn instanceof JarURLConnection) { isInJar = true; lastModified = -1; } else { isInJar = false; lastModified...
#fixed code protected void processIsInJarAndlastModified() { if ("file".equalsIgnoreCase(url.getProtocol())) { isInJar = false; lastModified = new File(url.getFile()).lastModified(); } else { isInJar = true; lastModified = -1; } }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void processIsInJarAndlastModified() { try { URLConnection conn = url.openConnection(); if ("jar".equals(url.getProtocol()) || conn instanceof JarURLConnection) { isInJar = true; lastModified = -1; } else { isInJar = false; lastModified...
#fixed code protected void processIsInJarAndlastModified() { if ("file".equalsIgnoreCase(url.getProtocol())) { isInJar = false; lastModified = new File(url.getFile()).lastModified(); } else { isInJar = true; lastModified = -1; } }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected long getLastModified() { try { URLConnection conn = url.openConnection(); return conn.getLastModified(); } catch (IOException e) { throw new RuntimeException(e); } } #location 4 #vulnerabil...
#fixed code protected long getLastModified() { return new File(url.getFile()).lastModified(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void processIsInJarAndlastModified() { try { URLConnection conn = url.openConnection(); if ("jar".equals(url.getProtocol()) || conn instanceof JarURLConnection) { isInJar = true; lastModified = -1; } else { isInJar = false; lastModified...
#fixed code protected void processIsInJarAndlastModified() { if ("file".equalsIgnoreCase(url.getProtocol())) { isInJar = false; lastModified = new File(url.getFile()).lastModified(); } else { isInJar = true; lastModified = -1; } }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private boolean hookExist() throws IOException { GHRepository ghRepository = getGitHubRepo(); for (GHHook h : ghRepository.getHooks()) { if (!"web".equals(h.getName())) { continue; } if (!getHookUrl().e...
#fixed code private boolean hookExist() throws IOException { GHRepository ghRepository = getGitHubRepo(); if (ghRepository == null) { throw new IOException("Unable to get repo [ " + reponame + " ]"); } for (GHHook h : ghRepository.getHooks()) {...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public Environment setUpEnvironment(@SuppressWarnings("rawtypes") AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, Run.RunnerAbortedException { GhprbTrigger trigger = Ghprb.extractTrigger(bui...
#fixed code @Override public Environment setUpEnvironment(@SuppressWarnings("rawtypes") AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, Run.RunnerAbortedException { GhprbTrigger trigger = Ghprb.extractTrigger(build); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void check(Map<Integer,GhprbPullRequest> pulls){ if(repo == null) try { repo = gh.getRepository(reponame); if(repo == null){ Logger.getLogger(GhprbRepo.class.getName()).log(Level.SEVERE, "Could not retrieve repo named {0} (Do you have properly set 'Gi...
#fixed code public void check(Map<Integer,GhprbPullRequest> pulls){ if(repo == null) try { repo = gh.getRepository(reponame); if(repo == null){ Logger.getLogger(GhprbRepo.class.getName()).log(Level.SEVERE, "Could not retrieve repo named {0} (Do you have properly set 'GitHub p...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, final BuildListener listener) throws InterruptedException, IOException { AbstractProject<?, ?> project = build.getProject(); if (build.getResult().isWorseThan(Result.SUCCESS)) { logger.l...
#fixed code @Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, final BuildListener listener) throws InterruptedException, IOException { AbstractProject<?, ?> project = build.getProject(); if (build.getResult().isWorseThan(Result.SUCCESS)) { logger.log(Lev...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean cancelBuild(int id) { if(queuedBuilds.containsKey(id)){ try { Run<?,?> build = (Run) queuedBuilds.get(id).waitForStart(); if(build.getExecutor() == null) return false; build.getExecutor().interrupt(); queuedBuilds.remove(id); return ...
#fixed code public boolean cancelBuild(int id) { Iterator<GhprbBuild> it = builds.iterator(); while(it.hasNext()){ GhprbBuild build = it.next(); if (build.getPullID() == id) { if (build.cancel()) { it.remove(); return true; } } } return false; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void onCompleted(AbstractBuild<?, ?> build, TaskListener listener) { GhprbTrigger trigger = Ghprb.extractTrigger(build); if (trigger != null) { trigger.getBuilds().onCompleted(build, listener); } } ...
#fixed code @Override public void onCompleted(AbstractBuild<?, ?> build, TaskListener listener) { GhprbTrigger trigger = Ghprb.extractTrigger(build); if (trigger != null && trigger.getBuilds() != null) { trigger.getBuilds().onCompleted(build, listener); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void check(Map<Integer,GhprbPullRequest> pulls){ if(repo == null) try { repo = gh.getRepository(reponame); //TODO: potential NPE if(repo == null){ Logger.getLogger(GhprbRepo.class.getName()).log(Level.SEVERE, "Could not retrieve repo named {0} (Do you...
#fixed code public void check(Map<Integer,GhprbPullRequest> pulls){ if(repo == null) try { repo = gh.getRepository(reponame); //TODO: potential NPE if(repo == null){ Logger.getLogger(GhprbRepo.class.getName()).log(Level.SEVERE, "Could not retrieve repo named {0} (Do you have ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void onStarted(AbstractBuild<?, ?> build, TaskListener listener) { GhprbTrigger trigger = Ghprb.extractTrigger(build); if (trigger != null) { trigger.getBuilds().onStarted(build, listener); } } ...
#fixed code @Override public void onStarted(AbstractBuild<?, ?> build, TaskListener listener) { GhprbTrigger trigger = Ghprb.extractTrigger(build); if (trigger != null && trigger.getBuilds() != null) { trigger.getBuilds().onStarted(build, listener); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void check(GHIssueComment comment) { if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring comment"); return; } synchronized (this) { try { checkComment...
#fixed code public void check(GHIssueComment comment) { if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring comment"); return; } synchronized (this) { try { checkComment(comme...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void check(GHPullRequest ghpr) { setPullRequest(ghpr); if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring pull request"); return; } try { getPullRequest(fals...
#fixed code public void check(GHPullRequest ghpr) { setPullRequest(ghpr); if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring pull request"); return; } try { getPullRequest(false); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void check(GHPullRequest ghpr) { setPullRequest(ghpr); if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring pull request"); return; } try { getPullRequest(fals...
#fixed code public void check(GHPullRequest ghpr) { setPullRequest(ghpr); if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring pull request"); return; } try { getPullRequest(false); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private boolean initGhRepository() { GitHub gitHub = null; try { GhprbGitHub repo = helper.getGitHub(); if (repo == null) { return false; } gitHub = repo.get(); if (gitHub.getRat...
#fixed code private boolean initGhRepository() { GitHub gitHub = null; try { GhprbGitHub repo = helper.getGitHub(); if (repo == null) { return false; } gitHub = repo.get(); if (gitHub == null) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public QueueTaskFuture<?> startJob(GhprbCause cause, GhprbRepository repo) { ArrayList<ParameterValue> values = getDefaultParameters(); final String commitSha = cause.isMerged() ? "origin/pr/" + cause.getPullID() + "/merge" : cause.getCommit(); v...
#fixed code public QueueTaskFuture<?> startJob(GhprbCause cause, GhprbRepository repo) { for (GhprbExtension ext : Ghprb.getJobExtensions(this, GhprbBuildStep.class)) { if (ext instanceof GhprbBuildStep) { ((GhprbBuildStep)ext).onStartBuild(s...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void check(GHPullRequest ghpr) { setPullRequest(ghpr); if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring pull request"); return; } try { getPullRequest(fals...
#fixed code public void check(GHPullRequest ghpr) { setPullRequest(ghpr); if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring pull request"); return; } try { getPullRequest(false); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void check(GHPullRequest ghpr) { setPullRequest(ghpr); if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring pull request"); return; } try { getPullRequest(fals...
#fixed code public void check(GHPullRequest ghpr) { setPullRequest(ghpr); if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring pull request"); return; } try { getPullRequest(false); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void makeBuildVariables(@SuppressWarnings("rawtypes") AbstractBuild build, Map<String,String> variables){ variables.put("ghprbUpstreamStatus", "true"); variables.put("ghprbCommitStatusContext", commitStatusContext); variables...
#fixed code @Override public void makeBuildVariables(@SuppressWarnings("rawtypes") AbstractBuild build, Map<String,String> variables){ variables.put("ghprbUpstreamStatus", "true"); variables.put("ghprbCommitStatusContext", commitStatusContext); variables.put("...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void onStarted(AbstractBuild<?, ?> build, TaskListener listener) { PrintStream logger = listener.getLogger(); GhprbCause c = Ghprb.getCause(build); if (c == null) { return; } GhprbTrigger trigger = Ghprb.extrac...
#fixed code public void onStarted(AbstractBuild<?, ?> build, TaskListener listener) { PrintStream logger = listener.getLogger(); GhprbCause c = Ghprb.getCause(build); if (c == null) { return; } GhprbTrigger trigger = Ghprb.extractTrigg...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void check(GHIssueComment comment) { if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring comment"); return; } synchronized (this) { try { checkComment...
#fixed code public void check(GHIssueComment comment) { if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring comment"); return; } synchronized (this) { try { checkComment(comme...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void check(GHPullRequest ghpr) { setPullRequest(ghpr); if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring pull request"); return; } try { getPullRequest(fals...
#fixed code public void check(GHPullRequest ghpr) { setPullRequest(ghpr); if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring pull request"); return; } try { getPullRequest(false); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void handleWebHook(String event, String payload, String body, String signature) { if (!checkSignature(body, signature, trigger.getGitHubApiAuth().getSecret())){ return; } GhprbRepository repo = trigger.getRepository(); ...
#fixed code public void handleWebHook(String event, String payload, String body, String signature) { GhprbRepository repo = trigger.getRepository(); String repoName = repo.getName(); logger.log(Level.INFO, "Got payload event: {0}", event); try { ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void check(GHIssueComment comment) { if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring comment"); return; } synchronized (this) { try { checkComment...
#fixed code public void check(GHIssueComment comment) { if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring comment"); return; } synchronized (this) { try { checkComment(comme...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean cancelBuild(int id) { if(queuedBuilds.containsKey(id)){ try { Run<?,?> build = (Run) queuedBuilds.get(id).waitForStart(); if(build.getExecutor() == null) return false; build.getExecutor().interrupt(); queuedBuilds.remove(id); return ...
#fixed code public boolean cancelBuild(int id) { Iterator<GhprbBuild> it = builds.iterator(); while(it.hasNext()){ GhprbBuild build = it.next(); if (build.getPullID() == id) { if (build.cancel()) { it.remove(); return true; } } } return false; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void findByIdTest() { TestEntity result = this.datastoreTemplate.findById(this.key1, TestEntity.class); assertThat(result).isEqualTo(this.ob1); assertThat(result.childEntities).contains(this.childEntity1); assertThat(this.childEntity1).isEqualTo(resul...
#fixed code @Test public void findByIdTest() { verifyBeforeAndAfterEvents(null, new AfterFindByKeyEvent(Arrays.asList(this.ob1), Collections.singleton(this.key1)), () -> { TestEntity result = this.datastoreTemplate.findById(this.key1, TestEntity.class); assertThat(resul...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void findAllByIdReferenceConsistencyTest() { when(this.objectToKeyFactory.getKeyFromObject(eq(this.childEntity1), any())).thenReturn(this.childEntity1.id); when(this.datastore.fetch(eq(this.key1))) .thenReturn(Arrays.asList(this.e1)); TestEntity p...
#fixed code @Test public void findAllByIdReferenceConsistencyTest() { when(this.objectToKeyFactory.getKeyFromObject(eq(this.childEntity1), any())).thenReturn(this.childEntity1.id); when(this.datastore.fetch(eq(this.key1))) .thenReturn(Arrays.asList(this.e1)); verifyBeforeAndAft...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @SuppressWarnings("unchecked") private static Map<Class<?>, BiConsumer<ValueBinder<?>, Iterable>> createIterableTypeMapping() { // Java 8 has compile errors when using the builder extension methods // @formatter:off ImmutableMap.Builder<Class<?>, BiConsumer<ValueBin...
#fixed code @SuppressWarnings("unchecked") private static Map<Class<?>, BiConsumer<ValueBinder<?>, Iterable>> createIterableTypeMapping() { Map<Class<?>, BiConsumer<ValueBinder<?>, Iterable>> map = new LinkedHashMap<>(); map.put(com.google.cloud.Date.class, ValueBinder::toDateArray); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void findAllByIdReferenceConsistencyTest() { when(this.objectToKeyFactory.getKeyFromObject(eq(this.childEntity1), any())).thenReturn(this.childEntity1.id); when(this.datastore.fetch(eq(this.key1))) .thenReturn(Arrays.asList(this.e1)); TestEntity p...
#fixed code @Test public void findAllByIdReferenceConsistencyTest() { when(this.objectToKeyFactory.getKeyFromObject(eq(this.childEntity1), any())).thenReturn(this.childEntity1.id); when(this.datastore.fetch(eq(this.key1))) .thenReturn(Arrays.asList(this.e1)); verifyBeforeAndAft...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private <T> String buildResourceName(T entity) { FirestorePersistentEntity<?> persistentEntity = this.mappingContext.getPersistentEntity(entity.getClass()); FirestorePersistentProperty idProperty = persistentEntity.getIdPropertyOrFail(); Object idVal = persistent...
#fixed code private <T> String buildResourceName(T entity) { FirestorePersistentEntity<?> persistentEntity = this.mappingContext.getPersistentEntity(entity.getClass()); FirestorePersistentProperty idProperty = persistentEntity.getIdPropertyOrFail(); Object idVal = persistentEntity...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private boolean isDiscriminationFieldMatch(DatastorePersistentEntity entity, EntityPropertyValueProvider propertyValueProvider) { return propertyValueProvider.getPropertyValue(entity.getDiscriminationFieldName(), EmbeddedType.NOT_EMBEDDED, ClassTypeInformation.fro...
#fixed code private boolean isDiscriminationFieldMatch(DatastorePersistentEntity entity, EntityPropertyValueProvider propertyValueProvider) { return ((String[]) propertyValueProvider.getPropertyValue(entity.getDiscriminationFieldName(), EmbeddedType.NOT_EMBEDDED, ClassTypeInfor...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public BrowserManager useTaobaoMirror() { String taobaoUrl = null; try { taobaoUrl = WdmConfig .getString(WdmConfig.getString("wdm.geckoDriverTaobaoUrl")); driverUrl = new URL(taobaoUrl); ...
#fixed code @Override public BrowserManager useTaobaoMirror() { return useTaobaoMirror("wdm.geckoDriverTaobaoUrl"); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (...
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (isUnkn...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#fixed 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.
#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...
#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); }...
Below is the vulnerable code, please generate the patch based on the following information.
#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", ""); ...
#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", ""); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void reset() { config().reset(); mirrorLog = false; listVersions = null; versionToDownload = null; forcedArch = false; forcedOs = false; retryCount = 0; isLatest = true; isSnap = false; ...
#fixed 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.
#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")) { ...
#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....
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public BrowserManager useTaobaoMirror() { String taobaoUrl = null; try { taobaoUrl = WdmConfig.getString( WdmConfig.getString("wdm.chromeDriverTaobaoUrl")); driverUrl = new URL(taobaoUrl); ...
#fixed code @Override public BrowserManager useTaobaoMirror() { return useTaobaoMirror("wdm.chromeDriverTaobaoUrl"); }
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#fixed 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.
#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()) { ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (...
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (isUnkn...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#fixed 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.
#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...
#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(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void exportDriver(String variableValue) { downloadedVersion = versionToDownload; binaryPath = variableValue; Optional<String> exportParameter = getExportParameter(); if (!config.isAvoidExport() && exportParameter.isPresent()) { ...
#fixed code protected void exportDriver(String variableValue) { downloadedDriverVersion = driverVersionToDownload; 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.
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#fixed 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.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected List<String> getBetaVersions() { List<String> betaVersions = new ArrayList<>(); DriverManagerType[] browsersWithBeta = { CHROME }; for (DriverManagerType driverManagerType : browsersWithBeta) { String key = driverManagerType...
#fixed code protected List<String> getBetaVersions() { List<String> betaVersions = new ArrayList<>(); DriverManagerType[] browsersWithBeta = { CHROME }; for (DriverManagerType driverManagerType : browsersWithBeta) { String key = driverManagerType.name(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (...
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (isUnkn...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void reset() { useBetaVersions = getBoolean("wdm.useBetaVersions"); mirrorLog = false; isForcingCache = false; isForcingDownload = false; listVersions = null; architecture = null; driverUrl = null; ...
#fixed code protected void reset() { useBetaVersions = false; mirrorLog = false; isForcingCache = false; isForcingDownload = false; listVersions = null; architecture = null; driverUrl = null; version = null; proxyVal...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public BrowserManager useTaobaoMirror() { String taobaoUrl = null; try { taobaoUrl = getString(getString("wdm.operaDriverTaobaoUrl")); driverUrl = new URL(taobaoUrl); } catch (MalformedURLException e) { ...
#fixed code @Override public BrowserManager useTaobaoMirror() { return useTaobaoMirror("wdm.operaDriverTaobaoUrl"); }
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void reset() { config().reset(); mirrorLog = false; listVersions = null; versionToDownload = null; downloadedVersion = null; driverManagerType = null; } #location 6 ...
#fixed code protected void reset() { config().reset(); mirrorLog = false; listVersions = null; versionToDownload = null; }
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void exportDriver(String variableValue) { binaryPath = variableValue; Optional<String> exportParameter = getExportParameter(); if (!config.isAvoidExport() && exportParameter.isPresent()) { String variableName = exportParamet...
#fixed code protected void exportDriver(String variableValue) { driverPath = variableValue; Optional<String> exportParameter = getExportParameter(); if (!config.isAvoidExport() && exportParameter.isPresent()) { String variableName = exportParameter.get...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (...
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (isUnkn...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#fixed 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.
#vulnerable code protected List<URL> checkLatest(List<URL> list, String driver) { log.trace("Checking the lastest version of {} with URL list {}", driver, list); List<URL> out = new ArrayList<>(); List<URL> copyOfList = new ArrayList<>(list); ...
#fixed code protected List<URL> checkLatest(List<URL> list, String driver) { log.trace("Checking the lastest version of {} with URL list {}", driver, list); List<URL> out = new ArrayList<>(); List<URL> copyOfList = new ArrayList<>(list); f...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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))...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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()...
Below is the vulnerable code, please generate the patch based on the following information.
#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) { ...
#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) ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void reset() { config().reset(); mirrorLog = false; listVersions = null; versionToDownload = null; forcedArch = false; retry = true; isLatest = true; browserBinaryPath = null; } ...
#fixed code protected void reset() { config().reset(); mirrorLog = false; listVersions = null; versionToDownload = null; forcedArch = false; retry = true; isLatest = true; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public WebDriverManager useTaobaoMirror(String taobaoUrl) { driverUrl = getUrl(taobaoUrl); return instance; } #location 3 #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code public WebDriverManager useTaobaoMirror(String taobaoUrl) { driverUrl = getUrl(taobaoUrl); return instanceMap.get(driverManagerType); }
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void manage(Architecture arch, String version) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#fixed 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.
#vulnerable code @Override public BrowserManager useTaobaoMirror() { String taobaoUrl = null; try { taobaoUrl = getString(getString("wdm.phantomjsDriverTaobaoUrl")); driverUrl = new URL(taobaoUrl); } catch (MalformedURLException e) { ...
#fixed code @Override public BrowserManager useTaobaoMirror() { return useTaobaoMirror("wdm.phantomjsDriverTaobaoUrl"); }
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public WebDriverManager browserPath(String browserPath) { browserBinaryPath = browserPath; return instanceMap.get(driverManagerType); } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code public WebDriverManager browserPath(String browserPath) { config().setBinaryPath(browserPath); return instanceMap.get(driverManagerType); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected String resolveDriverVersion(String driverVersion) { preferenceKey = getKeyForPreferences(); Optional<String> browserVersion = empty(); browserVersion = getValueFromPreferences(browserVersion); if (!browserVersion.isPresent()) { ...
#fixed code protected String resolveDriverVersion(String driverVersion) { String preferenceKey = getKeyForPreferences(); Optional<String> browserVersion = empty(); browserVersion = getValueFromPreferences(preferenceKey, browserVersion); if (!browserVersion...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (...
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); if (isUnknown(driverVersion)) { dri...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); if (isUnknown(driverVersion)) { ...
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); if (isUnknown(driverVersion)) { dri...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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))...
Below is the vulnerable code, please generate the patch based on the following information.
#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)...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (...
#fixed code protected void manage(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (isUnkn...
Below is the vulnerable code, please generate the patch based on the following information.
#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); ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#fixed code @Override protected Optional<String> getLatestVersion() { String url = config().getChromeDriverUrl() + "LATEST_RELEASE"; Optional<String> version = Optional.empty(); try { InputStream response = httpClient .execute(h...
Below is the vulnerable code, please generate the patch based on the following information.