output
stringlengths
79
30.1k
instruction
stringclasses
1 value
input
stringlengths
216
28.9k
#fixed code @EventHandler public void onStructureGrow(StructureGrowEvent event) { Location location = event.getLocation(); GWorld world = gw.getTableManager().getWorldTable().getWorld(location.getWorld().getName()); TreeTable treeTable = gw.getTableManager().getTreeTable(); GPlayer...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @EventHandler public void onStructureGrow(StructureGrowEvent event) { Location location = event.getLocation(); GWorld world = gw.getTableManager().getWorldTable().getWorld(location.getWorld().getName()); TreeTable treeTable = gw.getTableManager().getTreeTable(); ...
#fixed code @Test public void verifyValidateClusterStartupWarnsIfNoServersInCluster() { WlsClusterConfig wlsClusterConfig = new WlsClusterConfig("cluster1"); wlsClusterConfig.validateCluster(1, null); assertThat(logRecords, containsWarning(NO_WLS_SERVER_IN_CLUSTER, "cluster...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void verifyValidateClusterStartupWarnsIfNoServersInCluster() { WlsClusterConfig wlsClusterConfig = new WlsClusterConfig("cluster1"); ClusterStartup cs = new ClusterStartup().withClusterName("cluster1").withReplicas(1); wlsClusterConfig.validateC...
#fixed code @Test public void whenDesiredStateIsAdmin_serverStartupCreatesJavaOptionsEnvironment() { configureServer("wls1").withDesiredState(ADMIN_STATE); addWlsServer("wls1"); invokeStep(); assertThat( getServerStartupInfo("wls1").getEnvironment(), has...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void whenDesiredStateIsAdmin_serverStartupCreatesJavaOptionsEnvironment() { configureServer("ms1").withDesiredState(ADMIN_STATE); addWlsServer("ms1"); invokeStep(); assertThat( getServerStartupInfo("ms1").getEnvironment(), ...
#fixed code public Schema encodeSchema(SparkMLEncoder encoder){ T model = getTransformer(); Label label = null; if(model instanceof HasLabelCol){ HasLabelCol hasLabelCol = (HasLabelCol)model; String labelCol = hasLabelCol.getLabelCol(); Feature feature = encoder.getOnlyFe...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Schema encodeSchema(SparkMLEncoder encoder){ T model = getTransformer(); Label label = null; if(model instanceof HasLabelCol){ HasLabelCol hasLabelCol = (HasLabelCol)model; String labelCol = hasLabelCol.getLabelCol(); Feature feature = encoder.get...
#fixed code public static void compile(String projectPath) throws IOException, TimeoutException, InterruptedException { Runtime runtime = Runtime.getRuntime(); Process exec = runtime.exec("mvn clean package -f " + projectPath); Worker worker = new Worker(exec); worker.star...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static void compile(String projectPath) throws IOException { Runtime runtime = Runtime.getRuntime(); Process exec = runtime.exec("mvn clean package -f " + projectPath); try { exec.waitFor(); } catch (InterruptedException e) { e.printStac...
#fixed code @Override public String get(String key) { return Jboot.getCache().get(cache_name, key); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public String get(String key) { return Jboot.getJbootCache().get(cache_name, key); } #location 3 #vulnerability type NULL_DEREFERENCE
#fixed code @Override protected <T> T doGet(Class<T> targetClass, int injectDepth) throws ReflectiveOperationException { return doGet(targetClass); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected <T> T doGet(Class<T> targetClass, int injectDepth) throws ReflectiveOperationException { // Aop.get(obj.getClass()) 可以用 Aop.inject(obj),所以注掉下一行代码 // targetClass = (Class<T>)getUsefulClass(targetClass); targetClass = (Clas...
#fixed code private static void copyStreamToResponse(HttpURLConnection connection, HttpServletResponse response) throws IOException { InputStream inStream = null; InputStreamReader reader = null; try { if (!response.isCommitted()) { Pri...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private static void copyStreamToResponse(HttpURLConnection connection, HttpServletResponse response) throws IOException { InputStream inStream = null; try { if (!response.isCommitted()) { PrintWriter writer = response.getWrite...
#fixed code @Override protected <T> T doGet(Class<T> targetClass, int injectDepth) throws ReflectiveOperationException { return doGet(targetClass); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected <T> T doGet(Class<T> targetClass, int injectDepth) throws ReflectiveOperationException { // Aop.get(obj.getClass()) 可以用 Aop.inject(obj),所以注掉下一行代码 // targetClass = (Class<T>)getUsefulClass(targetClass); targetClass = (Clas...
#fixed code public void doGenerate(String excludeTables) { System.out.println("start generate..."); List<TableMeta> tableMetaList = CodeGenHelpler.createMetaBuilder().build(); CodeGenHelpler.excludeTables(tableMetaList, excludeTables); generate(tableMeta...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void doGenerate(String excludeTables) { System.out.println("start generate..."); DataSource dataSource = CodeGenHelpler.getDatasource(); List<TableMeta> tableMetaList = new MetaBuilder(dataSource).build(); CodeGenHelpler.excludeTa...
#fixed code public void index() { renderText("hello " + serviceTest.getName("aaa")); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void index() { List<Record> records = Db.find("select * from `user`"); System.out.println("index .... "); LogKit.error("xxxxxxx"); Jboot.getCache().put("test","test","valueeeeeeeeee"); String value = Jboot.getCache()....
#fixed code static void doCacheEvict(Object[] arguments, Class targetClass, Method method, CacheEvict evict) { String unless = AnnotationUtil.get(evict.unless()); if (Utils.isUnless(unless, method, arguments)) { return; } String cacheName = An...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code static void doCacheEvict(Object[] arguments, Class targetClass, Method method, CacheEvict evict) { String unless = AnnotationUtil.get(evict.unless()); if (Utils.isUnless(unless, method, arguments)) { return; } String cacheNam...
#fixed code @Override public Object getAttribute(String name) { return Jboot.getCache().get(SESSION_CACHE_NAME, buildKey(name)); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public Object getAttribute(String name) { return Jboot.getJbootCache().get(SESSION_CACHE_NAME, buildKey(name)); } #location 3 #vulnerability type NULL_DEREFERENCE
#fixed code @RequiresPermissions("adminSystemVariable") @RequestMapping(value="variableSave${url.suffix}", method = RequestMethod.POST) @ResponseBody public BaseVO variableSave(System sys, Model model, HttpServletRequest request){ System system = sqlService.findAloneByProperty(System.c...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @RequiresPermissions("adminSystemVariable") @RequestMapping(value="variableSave${url.suffix}", method = RequestMethod.POST) @ResponseBody public BaseVO variableSave(System sys, Model model, HttpServletRequest request){ System system; if(Global.system.get(sys.getN...
#fixed code @SuppressWarnings( "unchecked" ) private static List<Principal> getPrincipals(HttpServletRequest request) { List<Principal> principals = null; Session session = (Session) ThreadContext.get( ThreadContext.SESSION_KEY ); if( session != null ) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @SuppressWarnings( "unchecked" ) private static List<Principal> getPrincipals(HttpServletRequest request) { List<Principal> principals = null; Session session = ThreadLocalSecurityContext.current().getSession( false ); if( session != null ) ...
#fixed code public void testXvideosRipper() throws IOException { if (!DOWNLOAD_CONTENT) { return; } List<URL> contentURLs = new ArrayList<URL>(); contentURLs.add(new URL("http://www.xvideos.com/video1428195/stephanie_first_time_anal")); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testXvideosRipper() throws IOException { if (false && !DOWNLOAD_CONTENT) { return; } List<URL> contentURLs = new ArrayList<URL>(); contentURLs.add(new URL("http://www.xvideos.com/video1428195/stephanie_first_time_a...
#fixed code public void downloadCompleted(URL url, File saveAs) { if (observer == null) { return; } try { String path = Utils.removeCWD(saveAs); RipStatusMessage msg = new RipStatusMessage(STATUS.DOWNLOAD_COMPLETE, path); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void downloadCompleted(URL url, File saveAs) { if (observer == null) { return; } try { String path = Utils.removeCWD(saveAs); RipStatusMessage msg = new RipStatusMessage(STATUS.DOWNLOAD_COMPLETE, path); ...
#fixed code public void setFactory(KeyedPoolableObjectFactory factory) throws IllegalStateException { Map toDestroy = new HashMap(); final KeyedPoolableObjectFactory oldFactory = _factory; synchronized (this) { assertOpen(); if (0 < getNumA...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void setFactory(KeyedPoolableObjectFactory factory) throws IllegalStateException { Map toDestroy = new HashMap(); synchronized (this) { assertOpen(); if (0 < getNumActive()) { throw new IllegalStateException...
#fixed code public T borrowObject(K key, long borrowMaxWait) throws Exception { assertOpen(); PooledObject<T> p = null; // Get local copy of current config so it is consistent for entire // method execution boolean blockWhenExhausted = getBlockW...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public T borrowObject(K key, long borrowMaxWait) throws Exception { assertOpen(); PooledObject<T> p = null; // Get local copy of current config so it is consistent for entire // method execution boolean blockWhenExhausted = get...
#fixed code @Override public void printStackTrace(PrintWriter writer) { Exception borrowedBy = this.borrowedBy; if (borrowedBy != null) { borrowedBy.printStackTrace(writer); } Exception usedBy = this.usedBy; if (usedBy != null) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void printStackTrace(PrintWriter writer) { if (borrowedBy != null) { borrowedBy.printStackTrace(writer); } if (usedBy != null) { usedBy.printStackTrace(writer); } } ...
#fixed code @Test public void testMissingSlotMillis() throws IOException { final String JOB_HISTORY_FILE_NAME = "src/test/resources/job_1329348432999_0003-1329348443227-user-Sleep+job-1329348468601-10-1-SUCCEEDED-default.jhist"; File jobHistoryfile = new File(JOB_HISTORY...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testMissingSlotMillis() throws IOException { final String JOB_HISTORY_FILE_NAME = "src/test/resources/job_1329348432999_0003-1329348443227-user-Sleep+job-1329348468601-10-1-SUCCEEDED-default.jhist"; File jobHistoryfile = new File(JOB_H...
#fixed code public int getQSize() { int res = 0; final Actor actors[] = this.actors; for (int i = 0; i < actors.length; i++) { Actor a = actors[i]; res+=a.__mailbox.size(); res+=a.__cbQueue.size(); } return res; ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public int getQSize() { int res = 0; for (int i = 0; i < queues.length; i++) { Queue queue = queues[i]; res+=queue.size(); } for (int i = 0; i < queues.length; i++) { Queue queue = cbQueues[i]; ...
#fixed code public boolean isEmpty() { for (int i = 0; i < actors.length; i++) { Actor act = actors[i]; if ( ! act.__mailbox.isEmpty() || ! act.__cbQueue.isEmpty() ) return false; } return true; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean isEmpty() { for (int i = 0; i < queues.length; i++) { Queue queue = queues[i]; if ( ! queue.isEmpty() ) return false; } for (int i = 0; i < cbQueues.length; i++) { Queue queue = c...
#fixed code public boolean pollQs() { CallEntry poll = pollQueues(actors); // first callback actors if (poll != null) { try { Actor.sender.set(poll.getTargetActor()); Object invoke = null; profileCounter++; ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean pollQs() { CallEntry poll = pollQueues(cbQueues, queues); // first callback queues if (poll != null) { try { Actor.sender.set(poll.getTargetActor()); Object invoke = null; profile...
#fixed code @Override public boolean compareAndSwapValue(long expected, long value) { BytesStore bytes = this.bytes; return bytes != null && bytes.compareAndSwapLong(offset, expected, value); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public boolean compareAndSwapValue(long expected, long value) { if (value == LONG_NOT_COMPLETE && binaryLongReferences != null) binaryLongReferences.add(new WeakReference<>(this)); return bytes.compareAndSwapLong(offset, expecte...
#fixed code @Test public void shouldBeReadOnly() throws Exception { final File tempFile = File.createTempFile("mapped", "bytes"); tempFile.deleteOnExit(); try (RandomAccessFile raf = new RandomAccessFile(tempFile, "rw")) { raf.setLength(4096); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void shouldBeReadOnly() throws Exception { final File tempFile = File.createTempFile("mapped", "bytes"); final RandomAccessFile raf = new RandomAccessFile(tempFile, "rw"); raf.setLength(4096); assertTrue(tempFile.setWrita...
#fixed code protected void handleConnect(IoSession session, ConnectMessage msg) { LOG.info("handleConnect invoked"); m_messaging.connect(session, msg); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void handleConnect(IoSession session, ConnectMessage msg) { LOG.info("handleConnect invoked"); if (msg.getProcotolVersion() != 0x03) { ConnAckMessage badProto = new ConnAckMessage(); badProto.setReturnCode(ConnAckMessage...
#fixed code public static GitRepositoryState getGitRepositoryState() throws IOException { Properties properties = new Properties(); try { InputStream inputStream = new FileInputStream("config/git.properties"); BufferedReader bf = new BufferedReader...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static GitRepositoryState getGitRepositoryState() throws IOException { Properties properties = new Properties(); try { properties.load(new FileInputStream("config/git.properties")); } catch (IOException e) { ...
#fixed code @Test public void testNewAuthorization() throws AcmeException { Authorization auth = new Authorization(); auth.setDomain("example.org"); Connection connection = new DummyConnection() { @Override public int sendSignedRequest...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testNewAuthorization() throws AcmeException { Authorization auth = new Authorization(); auth.setDomain("example.org"); Connection connection = new DummyConnection() { @Override public int sendSignedR...
#fixed code @Test public void testUpdateRetryAfter() throws Exception { final Instant retryAfter = Instant.now().plus(Duration.ofSeconds(30)); TestableConnectionProvider provider = new TestableConnectionProvider() { @Override public void sendR...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testUpdateRetryAfter() throws Exception { final Instant retryAfter = Instant.now().plus(Duration.ofSeconds(30)); TestableConnectionProvider provider = new TestableConnectionProvider() { @Override public void...
#fixed code @Test public void testGet() { assertEquals(100, genericTrie.get("杨尚川").intValue()); assertEquals(99, genericTrie.get("杨尚喜").intValue()); assertEquals(98, genericTrie.get("杨尚丽").intValue()); assertEquals(1, genericTrie.get("中华人民共和国").intValu...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testGet() { Assert.assertEquals(100, trie.get("杨尚川"), 0); Assert.assertEquals(99, trie.get("杨尚喜"), 0); Assert.assertEquals(98, trie.get("杨尚丽"), 0); Assert.assertEquals(1, trie.get("中华人民共和国"), 0); Assert.asser...
#fixed code @Override public final boolean incrementToken() throws IOException { String token = getToken(); if (token != null) { charTermAttribute.setEmpty().append(token); return true; } return false; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public final boolean incrementToken() throws IOException { Word word = getWord(); if (word != null) { int positionIncrement = 1; //忽略停用词 while(StopWord.is(word.getText())){ positionIncreme...
#fixed code public void clear() { if (staticResourceHandlers != null) { staticResourceHandlers.clear(); staticResourceHandlers = null; } staticResourcesSet = false; externalStaticResourcesSet = false; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void clear() { if (staticResourceHandlers != null) { staticResourceHandlers.clear(); staticResourceHandlers = null; } if (jarResourceHandlers != null) { jarResourceHandlers.clear(); jarReso...
#fixed code @Override public void messageReceived(ChannelHandlerContext ctx, MessageEvent me){ if(!(me.getMessage() instanceof CoapMessage)){ ctx.sendUpstream(me); return; } CoapMessage coapMessage = (CoapMessage) me.getMessage(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void messageReceived(ChannelHandlerContext ctx, MessageEvent me){ if(!(me.getMessage() instanceof CoapMessage)){ ctx.sendUpstream(me); return; } if(me.getMessage() instanceof CoapResponse){ ...
#fixed code @Override public void receiveEmptyACK(){ if(!emptyAckNotificationTimes.add(System.currentTimeMillis())){ log.error("Could not add notification time for empty ACK."); } }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void receiveEmptyACK(){ if(receiveEnabled && !emptyAckNotificationTimes.add(System.currentTimeMillis())){ log.error("Could not add notification time for empty ACK."); } } #location 3 ...
#fixed code public void stopRecording() throws IOException { Integer processId = androidScreenRecordProcess.get(Thread.currentThread().getId()); stopRunningProcess(processId); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void stopRecording() throws IOException { Integer processId = androidScreenRecordProcess.get(Thread.currentThread().getId()); if (processId != -1) { String process = "pgrep -P " + processId; System.out.println(process); ...
#fixed code public String getAppiumServerPath(String host) throws Exception { return appiumServerProp(host, "appiumServerPath"); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public String getAppiumServerPath(String host) throws Exception { JSONArray hostMachineObject = CapabilityManager.getInstance().getHostMachineObject(); List<Object> objects = hostMachineObject.toList(); Object o = objects.stream().filter(object -...
#fixed code public AppiumServiceBuilder getAppiumServiceBuilder(String methodName) throws Exception { String webKitPort = iosDevice.startIOSWebKit(device_udid); return appiumMan.appiumServerForIOS(device_udid, methodName, webKitPort); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public AppiumServiceBuilder getAppiumServiceBuilder(String methodName) throws Exception { if (iosDevice.checkiOSDevice(device_udid)) { String webKitPort = iosDevice.startIOSWebKit(device_udid); return appiumMan.appiumServerForIOS(device_u...
#fixed code @Override public void startAppiumServer(String host) throws Exception { System.out.println( "**************************************************************************\n"); System.out.println("Starting Appium Server on host " + host); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void startAppiumServer(String host) throws Exception { System.out.println( "**************************************************************************\n"); System.out.println("Starting Appium Server on host " + host);...
#fixed code public XmlSuite constructXmlSuiteForDistribution(String pack, List<String> tests, Map<String, List<Method>> methods, int deviceCount) { include(listeners, "LISTENERS"); include(groupsInclude, "INCLUDE_GROUPS"); XmlSuite suite = new XmlSuite(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public XmlSuite constructXmlSuiteForDistribution(String pack, List<String> tests, Map<String, List<Method>> methods, int deviceCount) { try { prop.load(new FileInputStream("config.properties")); } catch (IOException e) { e...
#fixed code public void captureScreenShot(String screenShotName) throws IOException, InterruptedException { File framePath = new File(System.getProperty("user.dir")+"/src/main/resources/"); File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void captureScreenShot(String screenShotName) throws IOException, InterruptedException { File framePath = new File(System.getProperty("user.dir")+"/src/main/resources/"); File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); ...
#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 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 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 @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 @Override public Environment setUpEnvironment(@SuppressWarnings("rawtypes") AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, Run.RunnerAbortedException { GhprbTrigger trigger = Ghprb.extractTrigger(bui...
#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(GHIssueComment comment) { if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring comment"); return; } synchronized (this) { try { checkComment...
#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 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 @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 @Override public void makeBuildVariables(@SuppressWarnings("rawtypes") AbstractBuild build, Map<String,String> variables){ variables.put("ghprbUpstreamStatus", "true"); variables.put("ghprbCommitStatusContext", commitStatusContext); variables...
#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 @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 @Override public BrowserManager useTaobaoMirror() { return useTaobaoMirror("wdm.chromeDriverTaobaoUrl"); }
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 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 exportDriver(String variableValue) { downloadedVersion = versionToDownload; binaryPath = variableValue; Optional<String> exportParameter = getExportParameter(); if (!config.isAvoidExport() && exportParameter.isPresent()) { ...
#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 public BrowserManager useTaobaoMirror() { String taobaoUrl = null; try { taobaoUrl = getString(getString("wdm.phantomjsDriverTaobaoUrl")); driverUrl = new URL(taobaoUrl); } catch (MalformedURLException e) { ...
#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 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 @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 @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 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(String driverVersion) { httpClient = new HttpClient(config()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); if (...
#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 manage(Architecture arch, String version) { httpClient = new HttpClient(config().getTimeout()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(driverManagerType); urlFilter = new UrlFilter...
#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 String resolveDriverVersion(String driverVersion) { preferenceKey = getKeyForPreferences(); Optional<String> browserVersion = empty(); browserVersion = getValueFromPreferences(browserVersion); if (!browserVersion.isPresent()) { ...
#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()); try (HttpClient wdmHttpClient = httpClient) { downloader = new Downloader(getDriverManagerType()); urlFilter = new UrlFilter(); ...
#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 reset() { useBetaVersions = getBoolean("wdm.useBetaVersions"); mirrorLog = false; isForcingCache = false; isForcingDownload = false; listVersions = null; architecture = null; driverUrl = null; ...
#fixed code protected void reset() { config().reset(); mirrorLog = false; driverVersionToDownload = null; forcedArch = false; forcedOs = false; retryCount = 0; isSnap = false; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void reset() { config().reset(); mirrorLog = false; versionToDownload = null; forcedArch = false; forcedOs = false; retryCount = 0; isSnap = false; } #location 4 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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 =...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 =...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#fixed code @Test public void testConfigure2() throws Exception { double epsilon = 0.000000000000001 ; Settings smsemoaSettings = new SMSEMOASettings("Fonseca"); SMSEMOA algorithm = (SMSEMOA) smsemoaSettings.configure(configuration) ; Problem problem = new Fonseca("Real")...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testConfigure2() throws Exception { double epsilon = 0.000000000000001 ; Settings smsemoaSettings = new SMSEMOASettings("Fonseca"); Algorithm algorithm = smsemoaSettings.configure(configuration_) ; Problem problem = new Fonseca("Real") ...
#fixed code @Override public int compare(Solution o1, Solution o2) { if (o1 == null) { return 1; } else if (o2 == null) { return -1; } int flagComparatorRank = RANK_COMPARATOR.compare(o1, o2); if (flagComparatorRank != 0) { return flagComparatorRank...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public int compare(Solution o1, Solution o2) { if (o1 == null) { return 1; } else if (o2 == null) { return -1; } int flagComparatorRank = RANK_COMPARATOR.compare(o1, o2); if (flagComparatorRank != 0) { return flagComparat...
#fixed code @Test public void test2() throws JMException { double epsilon = 0.000000000000001; Settings GDE3Settings = new GDE3_Settings("Fonseca"); GDE3 algorithm = (GDE3) GDE3Settings.configure(configuration_); DifferentialEvolutionCrossover crossover = (Differen...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void test2() throws JMException { double epsilon = 0.000000000000001; Settings GDE3Settings = new GDE3_Settings("Fonseca"); Algorithm algorithm = GDE3Settings.configure(configuration_); //Problem problem = new Fonseca("Real"); Different...
#fixed code @Override public long getSwapUsed() { PdhFmtCounterValue phPagefileCounterValue = new PdhFmtCounterValue(); int ret = Pdh.INSTANCE.PdhGetFormattedCounterValue(pPagefile.getValue(), Pdh.PDH_FMT_LARGE | Pdh.PDH_FMT_1000, null, phPagefileCount...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public long getSwapUsed() { long total; long available; if (!Kernel32.INSTANCE.GlobalMemoryStatusEx(this._memory)) { LOG.error("Failed to Initialize MemoryStatusEx. Error code: {}", Kernel32.INSTANCE.GetLastErro...
#fixed code @Override public HWDiskStore[] getDisks() { List<HWDiskStore> result; result = new ArrayList<>(); readMap.clear(); writeMap.clear(); populateReadWriteMaps(); Map<String, List<Object>> vals = WmiUtil.selectObjectsFrom(null, ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public HWDiskStore[] getDisks() { List<HWDiskStore> result; result = new ArrayList<>(); Map<String, List<String>> vals = WmiUtil.selectStringsFrom(null, "Win32_DiskDrive", "Name,Manufacturer,Model,SerialNumber,Size"...
#fixed code public OSFileStore[] getFileStores() { // Use getfsstat to map filesystem paths to types Map<String, String> fstype = new HashMap<>(); // Query with null to get total # required int numfs = SystemB.INSTANCE.getfsstat64(null, 0, 0); if (...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public OSFileStore[] getFileStores() { // Use getfsstat to map filesystem paths to types Map<String, String> fstype = new HashMap<>(); // Query with null to get total # required int numfs = SystemB.INSTANCE.getfsstat64(null, 0, 0); ...
#fixed code public static Memory sysctl(String name) { IntByReference size = new IntByReference(); if (0 != FreeBsdLibc.INSTANCE.sysctlbyname(name, null, size, null, 0)) { LOG.error(SYSCTL_FAIL, name, Native.getLastError()); return null; } ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static Memory sysctl(String name) { IntByReference size = new IntByReference(); if (0 != SystemB.INSTANCE.sysctlbyname(name, null, size, null, 0)) { LOG.error(SYSCTL_FAIL, name, Native.getLastError()); return null; ...
#fixed code @Override public HWDiskStore[] getDisks() { List<HWDiskStore> result; result = new ArrayList<>(); readMap.clear(); writeMap.clear(); populateReadWriteMaps(); Map<String, List<Object>> vals = WmiUtil.selectObjectsFrom(null, ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public HWDiskStore[] getDisks() { List<HWDiskStore> result; result = new ArrayList<>(); Map<String, List<String>> vals = WmiUtil.selectStringsFrom(null, "Win32_DiskDrive", "Name,Manufacturer,Model,SerialNumber,Size"...
#fixed code private static void enumerateProperties(Map<String, List<Object>> values, EnumWbemClassObject enumerator, String[] properties, ValueType[] propertyTypes) { if (propertyTypes.length > 1 && properties.length != propertyTypes.length) { throw new I...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private static void enumerateProperties(Map<String, List<Object>> values, EnumWbemClassObject enumerator, String[] properties, ValueType[] propertyTypes) { if (propertyTypes.length > 1 && properties.length != propertyTypes.length) { throw...
#fixed code @Test public void testBatchUpdatePersistentVertices() { Vertex v1 = this.sqlgGraph.addVertex(T.label, "Person", "name", "a"); Vertex v2 = this.sqlgGraph.addVertex(T.label, "Person", "surname", "b"); this.sqlgGraph.tx().commit(); assertEqual...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testBatchUpdatePersistentVertices() { Vertex v1 = this.sqlgGraph.addVertex(T.label, "Person", "name", "a"); Vertex v2 = this.sqlgGraph.addVertex(T.label, "Person", "surname", "b"); this.sqlgGraph.tx().commit(); asser...
#fixed code @Test public void testLoadVertexProperties() { Vertex marko = this.sqlgGraph.addVertex(T.label, "Person", "name", "marko"); this.sqlgGraph.tx().commit(); marko = this.sqlgGraph.traversal().V(marko.id()).next(); Assert.assertEquals("marko", ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testLoadVertexProperties() { Vertex marko = this.sqlgGraph.addVertex(T.label, "Person", "name", "marko"); this.sqlgGraph.tx().commit(); marko = this.sqlgGraph.v(marko.id()); Assert.assertEquals("marko", marko.propert...
#fixed code @Test public void testPropertiesNotBeingCachedOnVertexOut() { Vertex v1 = this.sqlgGraph.addVertex(T.label, "Person"); Vertex v2 = this.sqlgGraph.addVertex(T.label, "Car", "name", "a"); Vertex v3 = this.sqlgGraph.addVertex(T.label, "Car", "name", ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testPropertiesNotBeingCachedOnVertexOut() { Vertex v1 = this.sqlgGraph.addVertex(T.label, "Person"); Vertex v2 = this.sqlgGraph.addVertex(T.label, "Car", "name", "a"); Vertex v3 = this.sqlgGraph.addVertex(T.label, "Car", "n...
#fixed code @Test public void testIdNotLoadedAsProperty() throws Exception { Vertex v = this.sqlgGraph.addVertex(T.label, "Person", "name", "a"); this.sqlgGraph.tx().commit(); this.sqlgGraph.close(); try (SqlgGraph sqlgGraph1 = SqlgGraph.open(configura...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testIdNotLoadedAsProperty() throws Exception { Vertex v = this.sqlgGraph.addVertex(T.label, "Person", "name", "a"); this.sqlgGraph.tx().commit(); this.sqlgGraph.close(); try (SqlgGraph sqlgGraph1 = SqlgGraph.open(con...
#fixed code @Test public void testAddingVmargsInBeforeContainerCreated() throws IOException, InterruptedException { // Given final String vmargs = "-Dhttp.proxyPort=8080"; final DockerComputerJNLPConnector connector = new DockerComputerJNLPConnector(new JNLPLa...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testAddingVmargsInBeforeContainerCreated() throws IOException, InterruptedException { String vmargs = "-Dhttp.proxyPort=8080"; DockerComputerJNLPConnector connector = new DockerComputerJNLPConnector(new JNLPLauncher(null, vmargs));...
#fixed code @Override public synchronized Collection<NodeProvisioner.PlannedNode> provision(Label label, int excessWorkload) { try { LOGGER.log(Level.INFO, "Asked to provision {0} slave(s) for: {1}", new Object[]{excessWorkload,label}); List<NodeProvi...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public synchronized Collection<NodeProvisioner.PlannedNode> provision(Label label, int excessWorkload) { try { LOGGER.log(Level.INFO, "Asked to provision {0} slave(s) for: {1}", new Object[]{excessWorkload,label}); List<No...
#fixed code @Override public void close() throws SQLException { if (closed) { return; } synchronized (this) { if (closed) { return; } closed = true; SQLException sqlE = null; ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void close() throws SQLException { SQLException sqlE = null; try { // Attempt to return any unused sequences. returnAllSequences(this.sequenceMap); } catch (SQLException e) { sqlE = e; ...
#fixed code @Override public void modifyTable(byte[] tableName, HTableDescriptor newDesc) throws IOException, InterruptedException, TimeoutException { try (HBaseAdmin admin = new HBaseAdmin(config)) { if (!allowOnlineTableSchemaUpdate()) { admin.disableTable(tab...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void modifyTable(byte[] tableName, HTableDescriptor newDesc) throws IOException, InterruptedException, TimeoutException { HBaseAdmin admin = new HBaseAdmin(config); if (!allowOnlineTableSchemaUpdate()) { admin.di...
#fixed code protected static void setupTxManager() throws SQLException, IOException { TransactionFactory.getTransactionProvider().getTransactionContext().setupTxManager(config, getUrl()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected static void setupTxManager() throws SQLException, IOException { TransactionFactory.getTransactionFactory().getTransactionContext().setupTxManager(config, getUrl()); } #location 2 #vulnerabil...
#fixed code @Test public void writeMetrics() throws Exception { Connection conn = getConnectionWithoutTracing(); latch = new CountDownLatch(1); testTraceWriter.start(); // create a simple metrics record long traceid = 987654; String d...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void writeMetrics() throws Exception { Connection conn = getConnectionWithoutTracing(); String tableName = generateUniqueName(); TraceSpanReceiver traceSpanReceiver = new TraceSpanReceiver(); latch = new CountDownLatch(1...
#fixed code @Test public void testSelectUpsertWithOldClient() throws Exception { // Insert data with new client and read with old client executeQueriesWithCurrentVersion(CREATE_ADD); executeQueryWithClientVersion(compatibleClientVersion, QUERY); assert...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSelectUpsertWithOldClient() throws Exception { checkForPreConditions(); // Insert data with new client and read with old client executeQueriesWithCurrentVersion(CREATE_ADD); executeQueryWithClientVersion(compatib...
#fixed code @Override protected RegionScanner doPostScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c, final Scan scan, final RegionScanner s) throws IOException, SQLException { RegionCoprocessorEnvironment env = c.getEnvironment(); Region region = env...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected RegionScanner doPostScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c, final Scan scan, final RegionScanner s) throws IOException, SQLException { RegionCoprocessorEnvironment env = c.getEnvironment(); Region region...
#fixed code public void run(ClassGroup one, ClassGroup two) { eone = new Execution(one); eone.populateInitialMethods(); List<Method> initial1 = eone.getInitialMethods().stream().sorted((m1, m2) -> m1.getName().compareTo(m2.getName())).collect(Collectors.toList()); eone.run(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void run(ClassGroup one, ClassGroup two) { eone = new Execution(one); eone.populateInitialMethods(); eone.run(); etwo = new Execution(two); etwo.populateInitialMethods(); etwo.run(); process( one.findClass("client").findMethod("init"), two...
#fixed code @Override public List<net.runelite.deob.Method> getMethods() { return myMethods != null ? myMethods : Arrays.asList(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public List<net.runelite.deob.Method> getMethods() { ClassGroup group = this.getInstructions().getCode().getAttributes().getClassFile().getGroup(); ClassFile otherClass = group.findClass(method.getClassEntry().getName()); if (otherClass == null) ret...
#fixed code private ParallelExecutorMapping mapMethods(ClassGroup one, ClassGroup two) { MethodSignatureMapper msm = new MethodSignatureMapper(); msm.map(one, two); List<ParallelExecutorMapping> pmes = new ArrayList<>(); for (Method m : msm.getMap().keySet()) { Collection<Me...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private ParallelExecutorMapping mapMethods(ClassGroup one, ClassGroup two) { MethodSignatureMapper msm = new MethodSignatureMapper(); msm.map(one, two); List<ParallelExecutorMapping> pmes = new ArrayList<>(); for (Method m : msm.getMap().keySet()) { Collect...
#fixed code @Test public void test1() throws IOException { File file = folder.newFile(); Store store = new Store(folder.getRoot()); DataFile df = new DataFile(store, file); DataFileWriteResult res = df.write(42, 3, ByteBuffer.wrap("test".getBytes()), 0, 0); DataFileReadResult re...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void test1() throws IOException { File file = folder.newFile(); Store store = new Store(folder.getRoot()); DataFile df = new DataFile(store, file); int sector = df.write(42, 3, ByteBuffer.wrap("test".getBytes())); byte[] buf = df.read(42, 3, sector...
#fixed code @Override public void run() { logger.info("Start proxy server at port:{}", bindPort); while (!stop) { try { Socket socket = serverSocket.accept(); socket = processSocketBeforeUse(socket); socket.setSoTimeout(timeout); Session sess...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { logger.info("Start proxy server at port:{}", bindPort); while (!stop) { try { Socket socket = serverSocket.accept(); socket = processSocketBeforeUse(socket); socket.setSoTimeout(timeout); Sessio...
#fixed code @Test public void testObjectIdSaved() { ObjectIdId object = new ObjectIdId(); org.bson.types.ObjectId id = new org.bson.types.ObjectId(); object._id = id; JacksonDBCollection<ObjectIdId, org.bson.types.ObjectId> coll = getCollection(Object...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testObjectIdSaved() { ObjectIdId object = new ObjectIdId(); org.bson.types.ObjectId id = new org.bson.types.ObjectId(); object._id = id; JacksonDBCollection<ObjectIdId, org.bson.types.ObjectId> coll = getCollection(...
#fixed code @Test public void testCreatorGetterObjectIdAnnotated() throws Exception { CreatorGetterObjectIdAnnotated o = new CreatorGetterObjectIdAnnotated(new org.bson.types.ObjectId().toString()); JacksonDBCollection<CreatorGetterObjectIdAnnotated, String> coll = cr...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testCreatorGetterObjectIdAnnotated() throws Exception { CreatorGetterObjectIdAnnotated o = new CreatorGetterObjectIdAnnotated(null); JacksonDBCollection<CreatorGetterObjectIdAnnotated, String> coll = createCollFor(o, String.class); ...
#fixed code @Benchmark public void jsoniter() throws IOException { Jsoniter jsoniter = Jsoniter.parseBytes(JsoniterBenchmarkState.inputBytes); byte[] val = new byte[3]; jsoniter.Read(val); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Benchmark public void jsoniter() throws IOException { Jsoniter iter = Jsoniter.parseBytes(JsoniterBenchmarkState.inputBytes); while (iter.ReadArray()) { iter.ReadUnsignedInt(); } } #location 6 ...
#fixed code public void readFromFile(String path) throws IOException { readCoreFromFile(path); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void readFromFile(String path) throws IOException { FileInputStream fis = new FileInputStream(path); DataInputStream is = new DataInputStream(fis); readFromStream(is); } #location 4 #vulnerabil...
#fixed code protected List<IptcBlock> parseAllBlocks(byte bytes[], boolean verbose, boolean strict) throws ImageReadException, IOException { List<IptcBlock> blocks = new ArrayList<IptcBlock>(); BinaryInputStream bis = null; try { bis = new...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected List<IptcBlock> parseAllBlocks(byte bytes[], boolean verbose, boolean strict) throws ImageReadException, IOException { List<IptcBlock> blocks = new ArrayList<IptcBlock>(); BinaryInputStream bis = new BinaryInputStream(bytes, APP13_...
#fixed code @Test public void testRemove() throws Exception { final ByteSource byteSource = new ByteSourceFile(imageFile); final Map<String, Object> params = new HashMap<String, Object>(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testRemove() throws Exception { final ByteSource byteSource = new ByteSourceFile(imageFile); final Map<String, Object> params = new HashMap<String, Object>(); final boolean ignoreImageData = isPhilHarveyTestImage(imageFile)...
#fixed code @Override public void performAction() { AbstractFile targetFile = mainFrame.getActiveTable().getSelectedFile(); if (targetFile == null) { targetFile = mainFrame.getActiveTable().getFileTableModel().getFileAt(0).getParent(); } Ab...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void performAction() { AbstractFile targetFile = mainFrame.getActiveTable().getSelectedFile(); if (targetFile == null) { targetFile = mainFrame.getInactiveTable().getFileTableModel().getFileAt(0).getParent(); } ...
#fixed code protected LookupResult extractNode(List<LexicalPatternElement> nextElements, TokenDistributor distributor) { int skip = 0; for (LexicalPatternElement nextElement : nextElements) { if (!nextElement.isWildcard()) { break; ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected LookupResult extractNode(List<LexicalPatternElement> nextElements, TokenDistributor distributor) { int skip = 0; for (LexicalPatternElement nextElement : nextElements) { if (!nextElement.isWildcard()) { break; ...
#fixed code @Override public void parse(TokenizedSource source, ParserInfo info) { PandaScript script = info.getComponent(Components.SCRIPT); TokenReader reader = new PandaTokenReader(source); Extractor extractor = PATTERN.extractor(); List<TokenizedS...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void parse(TokenizedSource source, ParserInfo info) { PandaScript script = info.getComponent(Components.SCRIPT); TokenReader reader = new PandaTokenReader(source); Extractor extractor = PATTERN.extractor(); List<Toke...
#fixed code @Autowired public void parse(ParserData data, LocalData localData) { localData.allocateInstance(data.getComponent(PandaComponents.CONTAINER).reserveCell()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Autowired public void parse(ParserData data, LocalData localData) { if (localData == null || data.getComponent(PandaComponents.CONTAINER) == null) { System.out.println("xxx"); } localData.allocateInstance(data.getComponent(Panda...
#fixed code public ClassPrototype generate(Class<?> type) { Module module = ModuleRegistry.getDefault().getOrCreate(type.getPackage().getName()); ClassPrototype prototype = module.get(type.getSimpleName()); if (prototype != null) { return prototype; ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public ClassPrototype generate(Class<?> type) { Module module = ModuleRegistry.getDefault().getOrCreate(type.getPackage().getName()); ClassPrototype prototype = new ClassPrototype(module, type.getSimpleName()); prototype.getAssociated().add(type...