output
stringlengths
64
73.2k
input
stringlengths
208
73.3k
instruction
stringclasses
1 value
#fixed code public static void copy(File source, File dest) throws IOException { FileInputStream fis = null; FileOutputStream fos = null; try { fis = new FileInputStream(source); fos = new FileOutputStream(dest); copy(fis, fos); ...
#vulnerable code public static void copy(File source, File dest) throws IOException { FileInputStream fis = new FileInputStream(source); FileOutputStream fos = new FileOutputStream(dest); copy(fis, fos); fis.close(); fos.close(); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static HashSet loadSet(String setname, String filename) { HashSet set = new HashSet(); BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(new FileInputStream(filename))); String line; while ((line = br.readLine(...
#vulnerable code private static HashSet loadSet(String setname, String filename) { HashSet set = new HashSet(); try { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename))); String line; while ((line = br.readLine()) != null) { li...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean job() throws Exception { // prepare for new connection // idleThreadCheck(); this.switchboard.handleBusyState(this.theSessionPool.getNumActive() /*activeThreads.size() */); log.logDebug( "* waiting for connections, " + t...
#vulnerable code public boolean job() throws Exception { // prepare for new connection // idleThreadCheck(); this.switchboard.handleBusyState(this.theSessionPool.getNumActive() /*activeThreads.size() */); log.logDebug( "* waiting for connections,...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public int size() { return java.lang.Math.max(assortmentCluster.sizeTotal(), java.lang.Math.max(backend.size(), cache.size())); }
#vulnerable code public int size() { return java.lang.Math.max(singletons.size(), java.lang.Math.max(backend.size(), cache.size())); } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public int addEntryToIndexMem(String wordHash, plasmaWordIndexEntry entry) throws IOException { // make space for new words int flushc = 0; //serverLog.logDebug("PLASMA INDEXING", "addEntryToIndexMem: cache.size=" + cache.size() + "; hashScore.size=" + hashScore.size()); ...
#vulnerable code public int addEntryToIndexMem(String wordHash, plasmaWordIndexEntry entry) throws IOException { // make space for new words int flushc = 0; //serverLog.logDebug("PLASMA INDEXING", "addEntryToIndexMem: cache.size=" + cache.size() + "; hashScore.size=" + hashScore.size...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public serverObjects searchFromRemote(Set hashes, int count, boolean global, long duetime) { if (hashes == null) hashes = new HashSet(); serverObjects prop = new serverObjects(); try { log.logInfo("INIT HASH SEARCH: " + hashes + " ...
#vulnerable code public serverObjects searchFromRemote(Set hashes, int count, boolean global, long duetime) { if (hashes == null) hashes = new HashSet(); serverObjects prop = new serverObjects(); try { log.logInfo("INIT HASH SEARCH: " + hashe...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public String readLine() throws IOException { // with these functions, we consider a line as always terminated by CRLF byte[] bb = new byte[80]; int bbsize = 0; int c; while (true) { c = read(); if (c < 0) { ...
#vulnerable code public String readLine() throws IOException { // with these functions, we consider a line as always terminated by CRLF serverByteBuffer sb = new serverByteBuffer(); int c; while (true) { c = read(); if (c < 0) { if (sb.length() == 0) return null; else re...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void initDataComposer(IDataComposer dataComposer, HttpServletRequest request) { String paramName = (String) request.getSession().getAttribute(Constants.MODIFY_STATE_HDIV_PARAMETER); String preState = paramName != null ? request.getParameter(paramName) : null; if...
#vulnerable code protected void initDataComposer(IDataComposer dataComposer, HttpServletRequest request) { String paramName = (String) request.getSession().getAttribute(Constants.MODIFY_STATE_HDIV_PARAMETER); String preState = paramName != null ? request.getParameter(paramName) : null...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public StatusEnum process(String optType, String optId, StatusEnum initStatus, long expireMs) { if (Dew.cluster.cache.setnx(CACHE_KEY + optType + ":" + optId, initStatus.toString(), expireMs / 1000)) { // 设置成功,表示之前不存在 return Statu...
#vulnerable code @Override public StatusEnum process(String optType, String optId, StatusEnum initStatus, long expireMs) { if (Dew.cluster.cache.setnx(CACHE_KEY + optType + ":" + optId, initStatus.toString(), expireMs / 1000)) { // 设置成功,表示之前不存在 return...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void register(final DynamicConfig config) { BrokerRole role = BrokerConfig.getBrokerRole(); if(role != BrokerRole.BACKUP) throw new RuntimeException("Only support backup"); final SlaveSyncClient slaveSyncClient = new SlaveSyncClient(config); ...
#vulnerable code private void register(final DynamicConfig config) { final SlaveSyncClient slaveSyncClient = new SlaveSyncClient(config); final MasterSlaveSyncManager masterSlaveSyncManager = new MasterSlaveSyncManager(slaveSyncClient); StorageConfig storageConf...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void recover() { if (segments.isEmpty()) { return; } LOG.info("Recovering logs."); final List<Long> baseOffsets = new ArrayList<>(segments.navigableKeySet()); final int offsetCount = baseOffsets.size(); long...
#vulnerable code private void recover() { if (segments.isEmpty()) { return; } LOG.info("Recovering logs."); final List<Long> baseOffsets = new ArrayList<>(segments.navigableKeySet()); final int offsetCount = baseOffsets.size(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void register(final DynamicConfig config) { BrokerRole role = BrokerConfig.getBrokerRole(); if(role != BrokerRole.BACKUP) throw new RuntimeException("Only support backup"); final SlaveSyncClient slaveSyncClient = new SlaveSyncClient(config); ...
#vulnerable code private void register(final DynamicConfig config) { final SlaveSyncClient slaveSyncClient = new SlaveSyncClient(config); final MasterSlaveSyncManager masterSlaveSyncManager = new MasterSlaveSyncManager(slaveSyncClient); StorageConfig storageConf...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void initRocksDB() { try { Options options = new Options(); options.setCreateIfMissing(true); rocksDB = RocksDB.open(options, DB_FILE); } catch (RocksDBException e) { e.printStackTrace(); } }
#vulnerable code private void initRocksDB() { try { rocksDB = RocksDB.open(new Options().setCreateIfMissing(true), DB_FILE); } catch (RocksDBException e) { e.printStackTrace(); } } #location 3 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void putLastBlockHash(String tipBlockHash) throws Exception { rocksDB.put(SerializeUtils.serialize(BLOCKS_BUCKET_PREFIX + "l"), SerializeUtils.serialize(tipBlockHash)); }
#vulnerable code public void putLastBlockHash(String tipBlockHash) throws Exception { rocksDB.put((BLOCKS_BUCKET_PREFIX + "l").getBytes(), tipBlockHash.getBytes()); } #location 2 #vulnerability type THREAD_SAFETY_VIOL...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Block getBlock(String blockHash) throws Exception { byte[] key = SerializeUtils.serialize(BLOCKS_BUCKET_PREFIX + blockHash); return (Block) SerializeUtils.deserialize(rocksDB.get(key)); }
#vulnerable code public Block getBlock(String blockHash) throws Exception { return (Block) SerializeUtils.deserialize(rocksDB.get((BLOCKS_BUCKET_PREFIX + blockHash).getBytes())); } #location 2 #vulnerability type THRE...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public String getLastBlockHash() throws Exception { byte[] lastBlockHashBytes = rocksDB.get(SerializeUtils.serialize(BLOCKS_BUCKET_PREFIX + "l")); if (lastBlockHashBytes != null) { return (String) SerializeUtils.deserialize(lastBlockHashBytes); ...
#vulnerable code public String getLastBlockHash() throws Exception { byte[] lastBlockHashBytes = rocksDB.get((BLOCKS_BUCKET_PREFIX + "l").getBytes()); if (lastBlockHashBytes != null) { return new String(lastBlockHashBytes); } return ""; } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadResource(Yaml yaml, InputStream yamlStream, String filename) { Node loadedYaml = yaml.compose(new UnicodeReader(yamlStream)); if (loadedYaml == null) { throw new InvalidParserConfigurationException("The file " + filename + " is em...
#vulnerable code private void loadResource(Yaml yaml, InputStream yamlStream, String filename) { Node loadedYaml = yaml.compose(new UnicodeReader(yamlStream)); if (loadedYaml == null) { LOG.error("The file {} is empty", filename); return; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void informSubstrings(ParserRuleContext ctx, String name, int maxSubStrings) { String text = getSourceText(ctx); if (text==null) { return; } inform(ctx, name, text, false); int startOffsetPrevious = 0; int c...
#vulnerable code private void informSubstrings(ParserRuleContext ctx, String name, int maxSubStrings) { String text = getSourceText(ctx); inform(ctx, name, text, false); int startOffsetPrevious = 0; int count = 1; char[] chars = text.toCharArray(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void informSubVersions(ParserRuleContext ctx, String name, int maxSubStrings) { String text = getSourceText(ctx); if (text==null) { return; } inform(ctx, name, text, false); int startOffsetPrevious = 0; int ...
#vulnerable code private void informSubVersions(ParserRuleContext ctx, String name, int maxSubStrings) { String text = getSourceText(ctx); inform(ctx, name, text, false); int startOffsetPrevious = 0; int count = 1; char[] chars = text.toCharArray...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Health health() { boolean allPassed = true; Health.Builder builder = new Health.Builder(); for (SofaRuntimeManager sofaRuntimeManager : SofaFramework.getRuntimeSet()) { Biz biz = DynamicJvmServiceProxyFinder.getBiz(sofa...
#vulnerable code @Override public Health health() { boolean allPassed = true; Health.Builder builder = new Health.Builder(); for (SofaRuntimeManager sofaRuntimeManager : SofaFramework.getRuntimeSet()) { if (!sofaRuntimeManager.isLivenessHealth()) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReadinessCheckFailedHttpCode() { ResponseEntity<String> response = restTemplate.getForEntity("/health/readiness", String.class); Assert.assertEquals(HttpStatus.SERVICE_UNAVAILABLE, response.getStatusCode()); }
#vulnerable code @Test public void testReadinessCheckFailedHttpCode() throws IOException { HttpURLConnection huc = (HttpURLConnection) (new URL( "http://localhost:8080/health/readiness").openConnection()); huc.setRequestMethod("HEAD"); huc.connect...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Health health() { boolean allPassed = true; Health.Builder builder = new Health.Builder(); for (SofaRuntimeManager sofaRuntimeManager : SofaFramework.getRuntimeSet()) { Biz biz = DynamicJvmServiceProxyFinder.getBiz(sofa...
#vulnerable code @Override public Health health() { boolean allPassed = true; Health.Builder builder = new Health.Builder(); for (SofaRuntimeManager sofaRuntimeManager : SofaFramework.getRuntimeSet()) { if (!sofaRuntimeManager.isLivenessHealth()) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void initialize(ConfigurableApplicationContext applicationContext) { Environment environment = applicationContext.getEnvironment(); if (SOFABootEnvUtils.isSpringCloudBootstrapEnvironment(environment)) { return; } ...
#vulnerable code @Override public void initialize(ConfigurableApplicationContext applicationContext) { Environment environment = applicationContext.getEnvironment(); if (SOFABootEnvUtils.isSpringCloudBootstrapEnvironment(environment)) { return; } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @PostMapping("comment") public Object comment(@LoginUser Integer userId, @RequestBody String body) { if (userId == null) { return ResponseUtil.unlogin(); } Integer orderGoodsId = JacksonUtil.parseInteger(body, "orderGoodsId"); ...
#vulnerable code @PostMapping("comment") public Object comment(@LoginUser Integer userId, @RequestBody String body) { if (userId == null) { return ResponseUtil.unlogin(); } Integer orderGoodsId = JacksonUtil.parseInteger(body, "orderGoodsId"); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void initCollapseAnimations(String state){ collapseAnim = new Timeline(this); switch (state){ case "expand":{ collapseAnim.addPropertyToInterpolate("width",this.getWidth(),MAX_WIDTH); break; } ...
#vulnerable code private void initCollapseAnimations(String state){ collapseAnim = new Timeline(this); switch (state){ case "expand":{ collapseAnim.addPropertyToInterpolate("width",this.getWidth(),250); break; } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadConfigFile(){ JSONParser parser = new JSONParser(); try { JSONObject root = (JSONObject) parser.parse(new FileReader(CONFIG_FILE)); JSONArray buttons = (JSONArray) root.get("buttons"); cachedButtonsConfig =...
#vulnerable code private void loadConfigFile(){ JSONParser parser = new JSONParser(); try { JSONObject root = (JSONObject) parser.parse(new FileReader(CONFIG_FILE)); JSONArray buttons = (JSONArray) root.get("buttons"); cachedButtonsCo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private JPanel getFormattedMessagePanel(String message){ JPanel labelsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); labelsPanel.setBackground(AppThemeColor.TRANSPARENT); String itemName = StringUtils.substringBetween(message, "to buy your ", " ...
#vulnerable code private JPanel getFormattedMessagePanel(String message){ JPanel labelsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); labelsPanel.setBackground(AppThemeColor.TRANSPARENT); String itemName = StringUtils.substringBetween(message, "to buy your...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadConfigFile(){ JSONParser parser = new JSONParser(); try { JSONObject root = (JSONObject) parser.parse(new FileReader(CONFIG_FILE)); JSONArray buttons = (JSONArray) root.get("buttons"); cachedButtonsConfig =...
#vulnerable code private void loadConfigFile(){ JSONParser parser = new JSONParser(); try { JSONObject root = (JSONObject) parser.parse(new FileReader(CONFIG_FILE)); JSONArray buttons = (JSONArray) root.get("buttons"); cachedButtonsCo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void load(){ File configFile = new File(HISTORY_FILE); if (configFile.exists()) { JSONParser parser = new JSONParser(); try { JSONObject root = (JSONObject)parser.parse(new FileReader(HISTORY_FILE)); ...
#vulnerable code public void load(){ File configFile = new File(HISTORY_FILE); if (configFile.exists()) { JSONParser parser = new JSONParser(); try { JSONObject root = (JSONObject)parser.parse(new FileReader(HISTORY_FILE)); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void load() { File configFile = new File(CONFIG_FILE); if (!configFile.exists()) { try { new File(CONFIG_FILE_PATH).mkdir(); FileWriter fileWriter = new FileWriter(CONFIG_FILE); fileWriter.wri...
#vulnerable code private void load() { File configFile = new File(CONFIG_FILE); if (!configFile.exists()) { try { new File(CONFIG_FILE_PATH).mkdir(); FileWriter fileWriter = new FileWriter(CONFIG_FILE); fileWrit...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static byte[] tryDecompress(byte[] raw) throws Exception { if (!isGzipStream(raw)) { return raw; } GZIPInputStream gis = null; ByteArrayOutputStream out = null; try { gis = new GZIPInputStream(new ByteArr...
#vulnerable code public static byte[] tryDecompress(byte[] raw) throws Exception { if (!isGzipStream(raw)) { return raw; } GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(raw)); ByteArrayOutputStream out ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void signalPublish(String key, String value) throws Exception { long start = System.currentTimeMillis(); final Datum datum = new Datum(); datum.key = key; datum.value = value; if (RaftCore.getDatum(key) == null) { ...
#vulnerable code public static void signalPublish(String key, String value) throws Exception { long start = System.currentTimeMillis(); final Datum datum = new Datum(); datum.key = key; datum.value = value; if (RaftCore.getDatum(key) == null) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequestMapping("/updateClusterConf") public JSONObject updateClusterConf(HttpServletRequest request) throws IOException { JSONObject result = new JSONObject(); String ipSpliter = ","; String ips = BaseServlet.optional(request, "ips", ""); ...
#vulnerable code @RequestMapping("/updateClusterConf") public JSONObject updateClusterConf(HttpServletRequest request) throws IOException { JSONObject result = new JSONObject(); String ipSpliter = ","; String ips = BaseServlet.optional(request, "ips", "");...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void refreshSrvIfNeed() { try { if (!CollectionUtils.isEmpty(serverList)) { LogUtils.LOG.debug("server list provided by user: " + serverList); return; } if (System.currentTimeMillis() - last...
#vulnerable code private void refreshSrvIfNeed() { try { if (!CollectionUtils.isEmpty(serverList)) { LogUtils.LOG.debug("server list provided by user: " + serverList); return; } if (System.currentTimeMillis() ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static byte[] tryDecompress(InputStream raw) throws Exception { try { GZIPInputStream gis = new GZIPInputStream(raw); ByteArrayOutputStream out = new ByteArrayOutputStream(); IOUtils....
#vulnerable code public static byte[] tryDecompress(InputStream raw) throws Exception { try { GZIPInputStream gis = new GZIPInputStream(raw); ByteArrayOutputStream out = new ByteArrayOutputStream(); I...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void contextPrepared(ConfigurableApplicationContext context) { }
#vulnerable code @Override public void contextPrepared(ConfigurableApplicationContext context) { System.out.printf("Log files: %s/logs/%n", NACOS_HOME); System.out.printf("Conf files: %s/conf/%n", NACOS_HOME); System.out.printf("Data files: %s/data/%n", NACOS...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequestMapping("/updateClusterConf") public JSONObject updateClusterConf(HttpServletRequest request) throws IOException { JSONObject result = new JSONObject(); String ipSpliter = ","; String ips = BaseServlet.optional(request, "ips", ""); ...
#vulnerable code @RequestMapping("/updateClusterConf") public JSONObject updateClusterConf(HttpServletRequest request) throws IOException { JSONObject result = new JSONObject(); String ipSpliter = ","; String ips = BaseServlet.optional(request, "ips", "");...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void contextPrepared(ConfigurableApplicationContext context) { }
#vulnerable code @Override public void contextPrepared(ConfigurableApplicationContext context) { System.out.printf("Log files: %s/logs/%n", NACOS_HOME); System.out.printf("Conf files: %s/conf/%n", NACOS_HOME); System.out.printf("Data files: %s/data/%n", NACOS...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequestMapping("/onAddIP4Dom") public String onAddIP4Dom(HttpServletRequest request) throws Exception { if (Switch.getDisableAddIP()) { throw new AccessControlException("Adding IP for dom is forbidden now."); } String clientIP = WebUt...
#vulnerable code @RequestMapping("/onAddIP4Dom") public String onAddIP4Dom(HttpServletRequest request) throws Exception { if (Switch.getDisableAddIP()) { throw new AccessControlException("Adding IP for dom is forbidden now."); } String clientIP =...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<Instance> updateIpAddresses(Service service, String action, boolean ephemeral, Instance... ips) throws NacosException { Datum datum = consistencyService.get(KeyBuilder.buildInstanceListKey(service.getNamespaceId(), service.getName(), ephemeral)); ...
#vulnerable code public List<Instance> updateIpAddresses(Service service, String action, boolean ephemeral, Instance... ips) throws NacosException { Datum datum = consistencyService.get(KeyBuilder.buildInstanceListKey(service.getNamespaceId(), service.getName(), ephemeral)); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void registerInstance(String namespaceId, String serviceName, String clusterName, Instance instance) throws Exception { Service service = getService(namespaceId, serviceName); boolean serviceUpdated = false; if (service == null) { s...
#vulnerable code public void registerInstance(String namespaceId, String serviceName, String clusterName, Instance instance) throws Exception { Service service = getService(namespaceId, serviceName); boolean serviceUpdated = false; if (service == null) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequestMapping("/updateClusterConf") public JSONObject updateClusterConf(HttpServletRequest request) throws IOException { JSONObject result = new JSONObject(); String ipSpliter = ","; String ips = BaseServlet.optional(request, "ips", ""); ...
#vulnerable code @RequestMapping("/updateClusterConf") public JSONObject updateClusterConf(HttpServletRequest request) throws IOException { JSONObject result = new JSONObject(); String ipSpliter = ","; String ips = BaseServlet.optional(request, "ips", "");...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<Instance> updateIpAddresses(Service service, String action, boolean ephemeral, Instance... ips) throws NacosException { Datum datum = consistencyService.get(KeyBuilder.buildInstanceListKey(service.getNamespaceId(), service.getName(), ephemeral)); ...
#vulnerable code public List<Instance> updateIpAddresses(Service service, String action, boolean ephemeral, Instance... ips) throws NacosException { Datum datum = consistencyService.get(KeyBuilder.buildInstanceListKey(service.getNamespaceId(), service.getName(), ephemeral)); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static List<String> readClusterConf() throws IOException { List<String> instanceList = new ArrayList<String>(); Reader reader = null; try { reader = new InputStreamReader(new FileInputStream(new File(CLUSTER_CONF_FILE_PATH)), UTF_8)...
#vulnerable code public static List<String> readClusterConf() throws IOException { List<String> instanceList = new ArrayList<String>(); List<String> lines = IoUtils.readLines( new InputStreamReader(new FileInputStream(new File(CLUSTER_CONF_FILE_PATH)), UT...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @NeedAuth @RequestMapping("/remvIP4Dom") public String remvIP4Dom(HttpServletRequest request) throws Exception { String dom = WebUtils.required(request, "dom"); String ipListString = WebUtils.required(request, "ipList"); Map<String, String> pr...
#vulnerable code @NeedAuth @RequestMapping("/remvIP4Dom") public String remvIP4Dom(HttpServletRequest request) throws Exception { String dom = WebUtils.required(request, "dom"); String ipListString = WebUtils.required(request, "ipList"); Loggers.DEBUG_LO...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void checkLocalConfig(CacheData cacheData) { final String dataId = cacheData.dataId; final String group = cacheData.group; final String tenant = cacheData.tenant; File path = LocalConfigInfoProcessor.getFailoverFile(agent.getName(), dat...
#vulnerable code private void checkLocalConfig(CacheData cacheData) { final String dataId = cacheData.dataId; final String group = cacheData.group; final String tenant = cacheData.tenant; File path = LocalConfigInfoProcessor.getFailoverFile(agent.getName(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void registerInstance(String namespaceId, String serviceName, String clusterName, Instance instance) throws Exception { Service service = getService(namespaceId, serviceName); boolean serviceUpdated = false; if (service == null) { s...
#vulnerable code public void registerInstance(String namespaceId, String serviceName, String clusterName, Instance instance) throws Exception { Service service = getService(namespaceId, serviceName); boolean serviceUpdated = false; if (service == null) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void contextPrepared(ConfigurableApplicationContext context) { }
#vulnerable code @Override public void contextPrepared(ConfigurableApplicationContext context) { System.out.printf("Log files: %s/logs/%n", NACOS_HOME); System.out.printf("Conf files: %s/conf/%n", NACOS_HOME); System.out.printf("Data files: %s/data/%n", NACOS...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void checkLocalConfig(CacheData cacheData) { final String dataId = cacheData.dataId; final String group = cacheData.group; final String tenant = cacheData.tenant; File path = LocalConfigInfoProcessor.getFailoverFile(agent.getName(), dat...
#vulnerable code private void checkLocalConfig(CacheData cacheData) { final String dataId = cacheData.dataId; final String group = cacheData.group; final String tenant = cacheData.tenant; File path = LocalConfigInfoProcessor.getFailoverFile(agent.getName(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<Instance> updateIpAddresses(Service service, String action, boolean ephemeral, Instance... ips) throws NacosException { Datum datum = consistencyService.get(KeyBuilder.buildInstanceListKey(service.getNamespaceId(), service.getName(), ephemeral)); ...
#vulnerable code public List<Instance> updateIpAddresses(Service service, String action, boolean ephemeral, Instance... ips) throws NacosException { Datum datum = consistencyService.get(KeyBuilder.buildInstanceListKey(service.getNamespaceId(), service.getName(), ephemeral)); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequestMapping("/updateClusterConf") public JSONObject updateClusterConf(HttpServletRequest request) throws IOException { JSONObject result = new JSONObject(); String ipSpliter = ","; String ips = BaseServlet.optional(request, "ips", ""); ...
#vulnerable code @RequestMapping("/updateClusterConf") public JSONObject updateClusterConf(HttpServletRequest request) throws IOException { JSONObject result = new JSONObject(); String ipSpliter = ","; String ips = BaseServlet.optional(request, "ips", "");...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void update(SwitchDomain newSwitchDomain) { switchDomain.setMasters(newSwitchDomain.getMasters()); switchDomain.setAdWeightMap(newSwitchDomain.getAdWeightMap()); switchDomain.setDefaultPushCacheMillis(newSwitchDomain.getDefaultPushCacheMillis())...
#vulnerable code public void update(SwitchDomain newSwitchDomain) { switchDomain.setMasters(newSwitchDomain.getMasters()); switchDomain.setAdWeightMap(newSwitchDomain.getAdWeightMap()); switchDomain.setDefaultPushCacheMillis(newSwitchDomain.getDefaultPushCacheMil...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @NeedAuth @RequestMapping("/remvIP4Dom") public String remvIP4Dom(HttpServletRequest request) throws Exception { String dom = WebUtils.required(request, "dom"); String ipListString = WebUtils.required(request, "ipList"); Map<String, String> pr...
#vulnerable code @NeedAuth @RequestMapping("/remvIP4Dom") public String remvIP4Dom(HttpServletRequest request) throws Exception { String dom = WebUtils.required(request, "dom"); String ipListString = WebUtils.required(request, "ipList"); Loggers.DEBUG_LO...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequestMapping("/updateClusterConf") public JSONObject updateClusterConf(HttpServletRequest request) throws IOException { JSONObject result = new JSONObject(); String ipSpliter = ","; String ips = BaseServlet.optional(request, "ips", ""); ...
#vulnerable code @RequestMapping("/updateClusterConf") public JSONObject updateClusterConf(HttpServletRequest request) throws IOException { JSONObject result = new JSONObject(); String ipSpliter = ","; String ips = BaseServlet.optional(request, "ips", "");...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Instance selectOneHealthyInstance(String serviceName, String groupName, List<String> clusters, boolean subscribe) throws NacosException { if (subscribe) { return Balancer.RandomByWeight.selectHost( hostReactor.getServi...
#vulnerable code @Override public Instance selectOneHealthyInstance(String serviceName, String groupName, List<String> clusters, boolean subscribe) throws NacosException { if (subscribe) { return Balancer.RandomByWeight.selectHost( hostReactor.ge...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<Instance> updateIpAddresses(Service service, String action, boolean ephemeral, Instance... ips) throws NacosException { Datum datum = consistencyService.get(KeyBuilder.buildInstanceListKey(service.getNamespaceId(), service.getName(), ephemeral)); ...
#vulnerable code public List<Instance> updateIpAddresses(Service service, String action, boolean ephemeral, Instance... ips) throws NacosException { Datum datum = consistencyService.get(KeyBuilder.buildInstanceListKey(service.getNamespaceId(), service.getName(), ephemeral)); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequestMapping("/updateClusterConf") public JSONObject updateClusterConf(HttpServletRequest request) throws IOException { JSONObject result = new JSONObject(); String ipSpliter = ","; String ips = BaseServlet.optional(request, "ips", ""); ...
#vulnerable code @RequestMapping("/updateClusterConf") public JSONObject updateClusterConf(HttpServletRequest request) throws IOException { JSONObject result = new JSONObject(); String ipSpliter = ","; String ips = BaseServlet.optional(request, "ips", "");...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void initNamespace(Properties properties) { namespace = ParamUtil.parseNamespace(properties); properties.put(PropertyKeyConst.NAMESPACE, namespace); }
#vulnerable code private void initNamespace(Properties properties) { String namespaceTmp = null; String isUseCloudNamespaceParsing = properties.getProperty(PropertyKeyConst.IS_USE_CLOUD_NAMESPACE_PARSING, System.getProperty(SystemPropertyKeyC...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void subTypes() throws Exception { VCard vcard = new VCard(); //one sub type AddressType adr = new AddressType(); adr.getSubTypes().put("X-DOORMAN", "true"); vcard.addAddress(adr); //two types adr = new AddressType(); adr.getSubTypes().put("X-DOOR...
#vulnerable code @Test public void subTypes() throws Exception { VCard vcard = new VCard(); //one sub type AddressType adr = new AddressType(); adr.getSubTypes().put("X-DOORMAN", "true"); vcard.addAddress(adr); //two types adr = new AddressType(); adr.getSubTypes().put("...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void evolutionVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_EVOLUTION.vcf")); reader.setCompatibilityMode(CompatibilityMode.EVOLUTION); VCard vcard = reader.readNext(); //VERSION assertEquals(VCa...
#vulnerable code @Test public void evolutionVCard() throws Exception { VCardReader reader = new VCardReader(new InputStreamReader(getClass().getResourceAsStream("John_Doe_EVOLUTION.vcf"))); reader.setCompatibilityMode(CompatibilityMode.EVOLUTION); VCard vcard = reader.readNext(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void subTypes() throws Exception { VCard vcard = new VCard(); //one sub type AddressType adr = new AddressType(); adr.getSubTypes().put("X-DOORMAN", "true"); vcard.addAddress(adr); //two types adr = new AddressType(); adr.getSubTypes().put("X-DOOR...
#vulnerable code @Test public void subTypes() throws Exception { VCard vcard = new VCard(); //one sub type AddressType adr = new AddressType(); adr.getSubTypes().put("X-DOORMAN", "true"); vcard.addAddress(adr); //two types adr = new AddressType(); adr.getSubTypes().put("...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) throws Exception { VCard vcard = new VCard(); StructuredNameType n = new StructuredNameType(); n.setFamily("Angstadt"); n.setGiven("Michael"); n.addPrefix("Mr"); vcard.setStructuredName(n); vcard.setFormattedName(new Formatt...
#vulnerable code public static void main(String[] args) throws Exception { VCard vcard = new VCard(); StructuredNameType n = new StructuredNameType(); n.setFamily("Angstadt"); n.setGiven("Michael"); n.addPrefix("Mr"); vcard.setStructuredName(n); vcard.setFormattedName(new F...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void test() throws Exception { VCard vcard = new VCard(); StructuredNameType n = new StructuredNameType(); n.setGiven("Michael"); n.setFamily("Angstadt"); vcard.setStructuredName(n); FormattedNameType fn = new FormattedNameType("Michael Angstadt"); ...
#vulnerable code @Test public void test() throws Exception { VCard vcard = new VCard(); StructuredNameType n = new StructuredNameType(); n.setGiven("Michael"); n.setFamily("Angstadt"); vcard.setStructuredName(n); FormattedNameType fn = new FormattedNameType("Michael Angstadt...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void msOutlookVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_MS_OUTLOOK.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V2_1, vcard.getVersion()); //N { Structur...
#vulnerable code @Test public void msOutlookVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_MS_OUTLOOK.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V2_1, vcard.getVersion()); //N { St...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public T find(V value) { checkInit(); for (T obj : preDefined) { if (matches(obj, value)) { return obj; } } return null; }
#vulnerable code public T find(V value) { return find(value, false, false); } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void subTypes() throws Exception { VCard vcard = new VCard(); //one sub type AddressType adr = new AddressType(); adr.getSubTypes().put("X-DOORMAN", "true"); vcard.addAddress(adr); //two types adr = new AddressType(); adr.getSubTypes().put("X-DOOR...
#vulnerable code @Test public void subTypes() throws Exception { VCard vcard = new VCard(); //one sub type AddressType adr = new AddressType(); adr.getSubTypes().put("X-DOORMAN", "true"); vcard.addAddress(adr); //two types adr = new AddressType(); adr.getSubTypes().put("...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void doUnmarshalValue(String value, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode) { if (subTypes.getValue() != null) { setUrl(VCardStringUtils.unescape(value)); } else { //instruct the marshaller to look for an e...
#vulnerable code @Override protected void doUnmarshalValue(String value, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode) { value = VCardStringUtils.unescape(value); if (subTypes.getValue() != null) { url = value; } else { VCardReader reader =...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void outlook2007VCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("outlook-2007.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V2_1, vcard.getVersion()); //N { StructuredNam...
#vulnerable code @Test public void outlook2007VCard() throws Exception { VCardReader reader = new VCardReader(new InputStreamReader(getClass().getResourceAsStream("outlook-2007.vcf"))); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V2_1, vcard.getVersion())...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void outlook2007VCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("outlook-2007.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V2_1, vcard.getVersion()); //N { StructuredNam...
#vulnerable code @Test public void outlook2007VCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("outlook-2007.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V2_1, vcard.getVersion()); //N { Structu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void gmailVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_GMAIL.vcf")); reader.setCompatibilityMode(CompatibilityMode.GMAIL); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V3...
#vulnerable code @Test public void gmailVCard() throws Exception { VCardReader reader = new VCardReader(new InputStreamReader(getClass().getResourceAsStream("John_Doe_GMAIL.vcf"))); reader.setCompatibilityMode(CompatibilityMode.GMAIL); VCard vcard = reader.readNext(); //VERSION ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public T get(V value) { T found = find(value); if (found != null) { return found; } synchronized (runtimeDefined) { for (T obj : runtimeDefined) { if (matches(obj, value)) { return obj; } } T created = create(value); runtimeDefined.add(creat...
#vulnerable code public T get(V value) { return find(value, true, true); } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void labels() throws Exception { VCard vcard = new VCard(); //address with label AddressType adr = new AddressType(); adr.setStreetAddress("123 Main St."); adr.setLocality("Austin"); adr.setRegion("TX"); adr.setPostalCode("12345"); adr.setLabel("12...
#vulnerable code @Test public void labels() throws Exception { VCard vcard = new VCard(); //address with label AddressType adr = new AddressType(); adr.setStreetAddress("123 Main St."); adr.setLocality("Austin"); adr.setRegion("TX"); adr.setPostalCode("12345"); adr.setLab...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void subTypes() throws Exception { VCard vcard = new VCard(); //one sub type AddressType adr = new AddressType(); adr.getSubTypes().put("X-DOORMAN", "true"); vcard.addAddress(adr); //two types adr = new AddressType(); adr.getSubTypes().put("X-DOOR...
#vulnerable code @Test public void subTypes() throws Exception { VCard vcard = new VCard(); //one sub type AddressType adr = new AddressType(); adr.getSubTypes().put("X-DOORMAN", "true"); vcard.addAddress(adr); //two types adr = new AddressType(); adr.getSubTypes().put("...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void lotusNotesVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_LOTUS_NOTES.vcf")); reader.setCompatibilityMode(CompatibilityMode.MAC_ADDRESS_BOOK); VCard vcard = reader.readNext(); //VERSION assert...
#vulnerable code @Test public void lotusNotesVCard() throws Exception { VCardReader reader = new VCardReader(new InputStreamReader(getClass().getResourceAsStream("John_Doe_LOTUS_NOTES.vcf"))); reader.setCompatibilityMode(CompatibilityMode.MAC_ADDRESS_BOOK); VCard vcard = reader.read...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) throws Exception { VCard vcard = new VCard(); StructuredNameType n = new StructuredNameType(); n.setFamily("Angstadt"); n.setGiven("Michael"); n.addPrefix("Mr"); vcard.setStructuredName(n); vcard.setFormattedName(new Formatt...
#vulnerable code public static void main(String[] args) throws Exception { VCard vcard = new VCard(); StructuredNameType n = new StructuredNameType(); n.setFamily("Angstadt"); n.setGiven("Michael"); n.addPrefix("Mr"); vcard.setStructuredName(n); vcard.setFormattedName(new F...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void evolutionVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_EVOLUTION.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V3_0, vcard.getVersion()); //URL { Iterato...
#vulnerable code @Test public void evolutionVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_EVOLUTION.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V3_0, vcard.getVersion()); //URL { I...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void thunderbird() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("thunderbird-MoreFunctionsForAddressBook-extension.vcf")); reader.setCompatibilityMode(CompatibilityMode.MAC_ADDRESS_BOOK); VCard vcard = reader.readNext...
#vulnerable code @Test public void thunderbird() throws Exception { VCardReader reader = new VCardReader(new InputStreamReader(getClass().getResourceAsStream("thunderbird-MoreFunctionsForAddressBook-extension.vcf"))); reader.setCompatibilityMode(CompatibilityMode.MAC_ADDRESS_BOOK); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void gmailSingle() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("gmail-single.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V3_0, vcard.getVersion()); //FN { FormattedNameType...
#vulnerable code @Test public void gmailSingle() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("gmail-single.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V3_0, vcard.getVersion()); //FN { FormattedNa...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void doMarshalValue(StringBuilder sb, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode) { if (url != null) { sb.append(url); } else if (vcard != null) { throw new EmbeddedVCardException(vcard); } else { throw ne...
#vulnerable code @Override protected void doMarshalValue(StringBuilder sb, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode) { //VCardWriter handles 2.1 AGENT types that have an embedded vCard. //this method will not be called for these instances if ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void iPhoneVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_IPHONE.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V3_0, vcard.getVersion()); //PRODID { ProdIdType...
#vulnerable code @Test public void iPhoneVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_IPHONE.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V3_0, vcard.getVersion()); //PRODID { Prod...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void labels() throws Exception { VCard vcard = new VCard(); //address with label AddressType adr = new AddressType(); adr.setStreetAddress("123 Main St."); adr.setLocality("Austin"); adr.setRegion("TX"); adr.setPostalCode("12345"); adr.setLabel("12...
#vulnerable code @Test public void labels() throws Exception { VCard vcard = new VCard(); //address with label AddressType adr = new AddressType(); adr.setStreetAddress("123 Main St."); adr.setLocality("Austin"); adr.setRegion("TX"); adr.setPostalCode("12345"); adr.setLab...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void thunderbird() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("thunderbird-MoreFunctionsForAddressBook-extension.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V3_0, vcard.getVersion...
#vulnerable code @Test public void thunderbird() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("thunderbird-MoreFunctionsForAddressBook-extension.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V3_0, vcard.getV...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void doUnmarshalValue(Element element, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode) throws VCardException { String value = XCardUtils.getFirstChildText(element, "text", "uri"); if (value != null) { parseValue(value...
#vulnerable code @Override protected void doUnmarshalValue(Element element, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode) throws VCardException { Element ele = XCardUtils.getFirstElement(element.getChildNodes()); value = ele.getTextContent(); if (...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void outlook2003VCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("outlook-2003.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V2_1, vcard.getVersion()); //N { StructuredNam...
#vulnerable code @Test public void outlook2003VCard() throws Exception { VCardReader reader = new VCardReader(new InputStreamReader(getClass().getResourceAsStream("outlook-2003.vcf"))); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V2_1, vcard.getVersion())...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void iPhoneVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_IPHONE.vcf")); reader.setCompatibilityMode(CompatibilityMode.I_PHONE); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersio...
#vulnerable code @Test public void iPhoneVCard() throws Exception { VCardReader reader = new VCardReader(new InputStreamReader(getClass().getResourceAsStream("John_Doe_IPHONE.vcf"))); reader.setCompatibilityMode(CompatibilityMode.I_PHONE); VCard vcard = reader.readNext(); //VERSI...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void macAddressBookVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_MAC_ADDRESS_BOOK.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V3_0, vcard.getVersion()); //N { ...
#vulnerable code @Test public void macAddressBookVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_MAC_ADDRESS_BOOK.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V3_0, vcard.getVersion()); //...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void macAddressBookVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_MAC_ADDRESS_BOOK.vcf")); reader.setCompatibilityMode(CompatibilityMode.MAC_ADDRESS_BOOK); VCard vcard = reader.readNext(); //VERSION...
#vulnerable code @Test public void macAddressBookVCard() throws Exception { VCardReader reader = new VCardReader(new InputStreamReader(getClass().getResourceAsStream("John_Doe_MAC_ADDRESS_BOOK.vcf"))); reader.setCompatibilityMode(CompatibilityMode.MAC_ADDRESS_BOOK); VCard vcard = re...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void test() throws Exception { VCard vcard = new VCard(); StructuredNameType n = new StructuredNameType(); n.setGiven("Michael"); n.setFamily("Angstadt"); vcard.setStructuredName(n); FormattedNameType fn = new FormattedNameType("Michael Angstadt"); ...
#vulnerable code @Test public void test() throws Exception { VCard vcard = new VCard(); StructuredNameType n = new StructuredNameType(); n.setGiven("Michael"); n.setFamily("Angstadt"); vcard.setStructuredName(n); FormattedNameType fn = new FormattedNameType("Michael Angstadt...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void gmailVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_GMAIL.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V3_0, vcard.getVersion()); //FN { FormattedNameTyp...
#vulnerable code @Test public void gmailVCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("John_Doe_GMAIL.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V3_0, vcard.getVersion()); //FN { FormattedN...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void outlook2003VCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("outlook-2003.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V2_1, vcard.getVersion()); //N { StructuredNam...
#vulnerable code @Test public void outlook2003VCard() throws Exception { VCardReader reader = new VCardReader(getClass().getResourceAsStream("outlook-2003.vcf")); VCard vcard = reader.readNext(); //VERSION assertEquals(VCardVersion.V2_1, vcard.getVersion()); //N { Structu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<String> execute(TsLintExecutorConfig config, List<String> files) { if (config == null) { throw new IllegalArgumentException("config"); } else if (files == null) { throw new IllegalArgumentException("files"); ...
#vulnerable code public List<String> execute(TsLintExecutorConfig config, List<String> files) { if (config == null) { throw new IllegalArgumentException("config"); } if (files == null) { throw new IllegalArgumentException("files")...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private String getCommandOutput(Command thisCommand, StreamConsumer stdOutConsumer, StreamConsumer stdErrConsumer, File tslintOutputFile, Integer timeoutMs) { LOG.debug("Executing TsLint with command: " + thisCommand.toCommandLine()); // Timeout is specified ...
#vulnerable code private String getCommandOutput(Command thisCommand, StreamConsumer stdOutConsumer, StreamConsumer stdErrConsumer, File tslintOutputFile, Integer timeoutMs) { LOG.debug("Executing TsLint with command: " + thisCommand.toCommandLine()); // Timeout is spec...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override @RedisCache(flush = true) public Comment comment(Comment comment) throws ZhydCommentException { if (StringUtils.isEmpty(comment.getNickname())) { throw new ZhydCommentException("必须输入昵称哦~~"); } String content = comment.getC...
#vulnerable code @Override @RedisCache(flush = true) public Comment comment(Comment comment) throws ZhydCommentException { if (StringUtils.isEmpty(comment.getNickname())) { throw new ZhydCommentException("必须输入昵称哦~~"); } String content = commen...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void sendEmails(Set<String> emailTargets, String body) throws IOException, InterruptedException { LOG.info("Sending Monitor email to " + emailTargets.size() + " targets: " + emailTargets + " Email body: " + body); for (String emailTarget : emailTargets) { ...
#vulnerable code private void sendEmails(Set<String> emailTargets, String body) throws IOException { File temporaryEmailBody = File.createTempFile("_tmp_" + getClass().getSimpleName(), null); BufferedWriter writer = new BufferedWriter(new FileWriter(temporaryEmailBody, false)); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void run() throws IOException { LOG.info("Data Deployer Daemon for ring group " + ringGroupName + " starting."); boolean claimedDataDeployer = false; try { ringGroup = coord.getRingGroup(ringGroupName); // attempt to claim the data deployer title...
#vulnerable code public void run() throws IOException { LOG.info("Data Deployer Daemon for ring group " + ringGroupName + " starting."); boolean claimedDataDeployer = false; try { ringGroupConfig = coord.getRingGroup(ringGroupName); // attempt to claim the data de...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void copyToLocalRoot(String remoteSourceRelativePath, String localDestinationRoot) throws IOException { Path source = new Path(getAbsoluteRemotePath(remoteSourceRelativePath)); File destination = new File(localDestinationRoot + "/" + new Path(remoteSo...
#vulnerable code @Override public void copyToLocalRoot(String remoteSourceRelativePath, String localDestinationRoot) throws IOException { Path source = new Path(getAbsoluteRemotePath(remoteSourceRelativePath)); File destination = new File(localDestinationRoot + "/" + new Path(re...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public int decompress(byte[] src, int srcOffset, int srcLength, byte[] dst, int dstOff) { if (srcLength - srcOffset == 0) { return 0; } try { ByteArrayInputStream bytesIn = new ByteArrayInputStream(src, srcOffset, srcLength); GZIPInputS...
#vulnerable code @Override public int decompress(byte[] src, int srcOffset, int srcLength, byte[] dst, int dstOff) { if (srcLength - srcOffset == 0) { return 0; } try { ByteArrayInputStream bytesIn = new ByteArrayInputStream(src, srcOffset, srcLength); GZIP...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void assign(RingGroup ringGroup, int ringNum, Domain domain) throws IOException { ring = ringGroup.getRing(ringNum); domainGroup = ringGroup.getDomainGroup(); domainId = domainGroup.getDomainId(domain.getName()); version = domainGroup.getLates...
#vulnerable code @Override public void assign(RingGroup ringGroup, int ringNum, Domain domain) throws IOException { ring = ringGroup.getRing(ringNum); domainGroup = ringGroup.getDomainGroup(); domainId = domainGroup.getDomainId(domain.getName()); version = domainGroup.ge...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testBlockCompressionSnappy() throws Exception { doTestBlockCompression(BlockCompressionCodec.SNAPPY, EXPECTED_RECORD_FILE_BLOCK_COMPRESSED_SNAPPY); }
#vulnerable code public void testBlockCompressionSnappy() throws Exception { new File(TMP_TEST_CURLY_READER).mkdirs(); OutputStream s = new FileOutputStream(TMP_TEST_CURLY_READER + "/00000.base.curly"); s.write(EXPECTED_RECORD_FILE_BLOCK_COMPRESSED_SNAPPY); s.flush(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) throws IOException { String configPath = args[0]; String log4jprops = args[1]; PropertyConfigurator.configure(log4jprops); UpdateDaemonConfigurator conf = new YamlConfigurator(configPath); new UpdateDaemon(conf, HostU...
#vulnerable code public static void main(String[] args) throws IOException { String configPath = args[0]; String log4jprops = args[1]; PropertyConfigurator.configure(log4jprops); new UpdateDaemon(null, HostUtils.getHostName()).run(); } #loc...
Below is the vulnerable code, please generate the patch based on the following information.