output
stringlengths
64
73.2k
input
stringlengths
208
73.3k
instruction
stringclasses
1 value
#fixed code public static void main(String[] args) { log.info("Starting DragonProxy..."); // Check the java version if (Float.parseFloat(System.getProperty("java.class.version")) < 52.0) { log.error("DragonProxy requires Java 8! Current version: " + S...
#vulnerable code public static void main(String[] args) { log.info("Starting DragonProxy..."); // Check the java version if (Float.parseFloat(System.getProperty("java.class.version")) < 52.0) { log.error("DragonProxy requires Java 8! Current version:...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void initialize() throws Exception { if(!RELEASE) { logger.warn("This is a development build. It may contain bugs. Do not use in production."); } // Create injector, provide elements from the environment and register providers ...
#vulnerable code private void initialize() throws Exception { if(!RELEASE) { logger.warn("This is a development build. It may contain bugs. Do not use in production."); } // Create injector, provide elements from the environment and register provider...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String... args) throws InterruptedException { // Manually grok the command argument in order to conditionally apply different options. if (args.length < 1) { System.err.println("Missing command argument."); prin...
#vulnerable code public static void main(String... args) throws InterruptedException { Config config = getConfig(args); Dispatcher dispatcher; switch (config.getCommand()) { case INSERT: dispatcher = new InsertDispatcher(config); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Row<Measurement> next() { if (!hasNext()) throw new NoSuchElementException(); Row<Measurement> output = new Row<>(m_timestamps.next(), m_resource); while (m_current != null) { accumulate(m_current, output.getTimestam...
#vulnerable code @Override public Row<Measurement> next() { if (!hasNext()) throw new NoSuchElementException(); Row<Measurement> output = new Row<>(m_timestamps.next(), m_resource); while (m_current != null) { accumulate(m_current, output.getTi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private int go(String[] args) { m_parser.setUsageWidth(80); try { m_parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); printUsage(System.err); return ...
#vulnerable code private int go(String[] args) { m_parser.setUsageWidth(80); try { m_parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); printUsage(System.err); r...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Object doGenerate(final Class<?> type) { PojoClass pojoClass = PojoClassFactory.getPojoClass(type); Enum<?>[] values = getValues(pojoClass); if (values == null) { throw RandomGeneratorException.getInstance(MessageFormatter.format("F...
#vulnerable code public Object doGenerate(final Class<?> type) { PojoClass pojoClass = PojoClassFactory.getPojoClass(type); PojoMethod valuesPojoMethod = null; for (PojoMethod pojoMethod : pojoClass.getPojoMethods()) { if (pojoMethod.getName().equals...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Object doGenerate(Parameterizable parameterizedType) { return CollectionHelper.buildCollections((Collection) doGenerate(parameterizedType.getType()), parameterizedType.getParameterTypes() .get(0)); }
#vulnerable code public Object doGenerate(Parameterizable parameterizedType) { List returnedList = (List) RandomFactory.getRandomValue(parameterizedType.getType()); returnedList.clear(); CollectionHelper.buildCollections(returnedList, parameterizedType.getParamet...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<PojoPackage> getPojoSubPackages() { List<PojoPackage> pojoPackageSubPackages = new LinkedList<PojoPackage>(); List<File> paths = PackageHelper.getPackageDirectories(packageName); for (File path : paths) { for (File entry : path...
#vulnerable code public List<PojoPackage> getPojoSubPackages() { List<PojoPackage> pojoPackageSubPackages = new LinkedList<PojoPackage>(); File directory = PackageHelper.getPackageAsDirectory(packageName); for (File entry : directory.listFiles()) { i...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(expected = ReflectionException.class) public void shouldFailSetter() { PojoField pojoField = getPrivateStringField(); assert pojoField != null; pojoField.invokeSetter(null, RandomFactory.getRandomValue(pojoField.getType())); }
#vulnerable code @Test(expected = ReflectionException.class) public void shouldFailSetter() { PojoField pojoField = getPrivateStringField(); pojoField.invokeSetter(null, RandomFactory.getRandomValue(pojoField.getType())); } #location 4 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Object doGenerate(Parameterizable parameterizedType) { Queue returnedQueue = (Queue) RandomFactory.getRandomValue(parameterizedType.getType()); CollectionHelper.buildCollections(returnedQueue, parameterizedType.getParameterTypes().get(0)); retur...
#vulnerable code public Object doGenerate(Parameterizable parameterizedType) { Queue returnedQueue = (Queue) RandomFactory.getRandomValue(parameterizedType.getType()); returnedQueue.clear(); CollectionHelper.buildCollections(returnedQueue, parameterizedType.getPa...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void run(final PojoClass pojoClass) { Object instance1 = ValidationHelper.getMostCompleteInstance(pojoClass); Object instance2 = ValidationHelper.getMostCompleteInstance(pojoClass); IdentityHandlerStub identityHandlerStub = new IdentityHandlerStub(instance1,...
#vulnerable code public void run(final PojoClass pojoClass) { IdentityFactory.registerIdentityHandler(identityHandlerStub); firstPojoClassInstance = ValidationHelper.getMostCompleteInstance(pojoClass); secondPojoClassInstance = ValidationHelper.getMostCompleteInstance(pojoCla...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Object doGenerate(final Class<?> type) { if (type == boolean.class || type == Boolean.class) { return RANDOM.nextBoolean(); } if (type == int.class || type == Integer.class) { return RANDOM.nextInt(); } ...
#vulnerable code public Object doGenerate(final Class<?> type) { if (type == boolean.class || type == Boolean.class) { return RANDOM.nextBoolean(); } if (type == int.class || type == Integer.class) { return RANDOM.nextInt(); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(expected = ReflectionException.class) public void shouldFailSet() { PojoField pojoField = getPrivateStringField(); assert pojoField != null; pojoField.set(null, RandomFactory.getRandomValue(pojoField.getType())); }
#vulnerable code @Test(expected = ReflectionException.class) public void shouldFailSet() { PojoField pojoField = getPrivateStringField(); pojoField.set(null, RandomFactory.getRandomValue(pojoField.getType())); } #location 4 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Object doGenerate(final Class<?> type) { if (type == boolean.class || type == Boolean.class) { return RANDOM.nextBoolean(); } if (type == int.class || type == Integer.class) { return RANDOM.nextInt(); } ...
#vulnerable code public Object doGenerate(final Class<?> type) { if (type == boolean.class || type == Boolean.class) { return RANDOM.nextBoolean(); } if (type == int.class || type == Integer.class) { return RANDOM.nextInt(); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void defaultRandomGeneratorServicePrePopulated() { reportDifferences(); Affirm.affirmEquals("Types added / removed?", expectedTypes, randomGeneratorService.getRegisteredTypes().size()); }
#vulnerable code @Test public void defaultRandomGeneratorServicePrePopulated() { // JDK 5 only supports 42 of the 44 possible types. (java.util.ArrayDeque does not exist in JDK5). String javaVersion = System.getProperty("java.version"); if (javaVersion.starts...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static List<Class<?>> getClasses(final String packageName) { List<Class<?>> classes = new LinkedList<Class<?>>(); List<File> paths = getPackageDirectories(packageName); for (File path : paths) { for (File entry : path.listFiles()) ...
#vulnerable code public static List<Class<?>> getClasses(final String packageName) { List<Class<?>> classes = new LinkedList<Class<?>>(); File directory = getPackageAsDirectory(packageName); for (File entry : directory.listFiles()) { if (isClass(ent...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public int find(int[] numbers, int position) { validateInput(numbers, position); Integer result = null; Map<Integer, Integer> counter = new LinkedHashMap<Integer, Integer>(); for (int i : numbers) { if (counter.get(i) == null) { counter.put(i, 1); ...
#vulnerable code public int find(int[] numbers, int position) { validateInput(numbers, position); Integer result = null; Map<Integer, Integer> counter = new HashMap<Integer, Integer>(); for (int i : numbers) { if (counter.get(i) == null) { counter.put(i, 1); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @SuppressWarnings("unchecked") public static void parse(String content, Object data) { Class<?> clazz = data.getClass(); ClassInfo classInfo = ClassInfo.of(clazz); GenericData genericData = GenericData.class.isAssignableFrom(clazz) ? (GenericData) data : null; ...
#vulnerable code @SuppressWarnings("unchecked") public static void parse(String content, Object data) { Class<?> clazz = data.getClass(); ClassInfo classInfo = ClassInfo.of(clazz); GenericData genericData = GenericData.class.isAssignableFrom(clazz) ? (GenericData) data : nul...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void parse(String content, Object data) { if (content == null) { return; } Class<?> clazz = data.getClass(); ClassInfo classInfo = ClassInfo.of(clazz); GenericData genericData = GenericData.class.isAssignableFrom(clazz) ? (GenericData) da...
#vulnerable code public static void parse(String content, Object data) { if (content == null) { return; } Class<?> clazz = data.getClass(); ClassInfo classInfo = ClassInfo.of(clazz); GenericData genericData = GenericData.class.isAssignableFrom(clazz) ? (GenericDa...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static byte[] loadBytes(String filename) { InputStream input = null; try { input = classLoader().getResourceAsStream(filename); if (input == null) { File file = new File(filename); if (file.exists()) { try { input = new FileInputStream(filen...
#vulnerable code public static byte[] loadBytes(String filename) { InputStream input = classLoader().getResourceAsStream(filename); if (input == null) { File file = new File(filename); if (file.exists()) { try { input = new FileInputStream(filename); } catch (FileN...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Object handle(HttpExchange x) throws Exception { String code = x.param("code"); String state = x.param("state"); U.debug("Received OAuth code", "code", code, "state", state); if (code != null && state != null) { U.must(stateCheck.isValidState(state...
#vulnerable code @Override public Object handle(HttpExchange x) throws Exception { String code = x.param("code"); String state = x.param("state"); U.debug("Received OAuth code", "code", code, "state", state); if (code != null && state != null) { U.must(stateCheck.isValidState...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ScanParams that = (ScanParams) o; if (!Arrays.equals(packages, that.packages)) return false; if (matching != null ? !matching.equals(th...
#vulnerable code @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ScanParams that = (ScanParams) o; if (!Arrays.equals(packages, that.packages)) return false; if (matching != null ? !matching.equ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void reset() { super.reset(); isGet.value = false; isKeepAlive.value = false; verb.reset(); uri.reset(); path.reset(); query.reset(); protocol.reset(); body.reset(); multipartBoundary.reset(); params.reset(); headersKV.reset(); head...
#vulnerable code @Override public void reset() { super.reset(); isGet.value = false; isKeepAlive.value = false; verb.reset(); uri.reset(); path.reset(); query.reset(); protocol.reset(); body.reset(); multipartBoundary.reset(); params.reset(); headersKV.reset(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Object getParamValue(Req req, Class<?> paramType, String paramName, Map<String, Object> properties) throws Exception { return Customization.of(req).objectMapper().convertValue(properties, paramType); }
#vulnerable code @Override public Object getParamValue(Req req, Class<?> paramType, String paramName, Map<String, Object> properties) throws Exception { return Customization.of(req).jackson().convertValue(properties, paramType); } #location 3 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void reset() { super.reset(); isGet.value = false; isKeepAlive.value = false; verb.reset(); uri.reset(); path.reset(); query.reset(); protocol.reset(); body.reset(); multipartBoundary.reset(); params.reset(); headersKV.reset(); head...
#vulnerable code @Override public void reset() { super.reset(); isGet.value = false; isKeepAlive.value = false; verb.reset(); uri.reset(); path.reset(); query.reset(); protocol.reset(); body.reset(); multipartBoundary.reset(); params.reset(); headersKV.reset(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static Db db() { assert U.must(db != null, "Database not initialized!"); return db; }
#vulnerable code public static Db db() { assert U.must(defaultDb != null, "Database not initialized!"); return defaultDb; } #location 3 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Set<String> userRoles(Req req, String username) { if (username != null) { try { return Customization.of(req).rolesProvider().getRolesForUser(req, username); } catch (Exception e) { throw U.rte(e); } } else { return Collections.emptySet(); } }
#vulnerable code private Set<String> userRoles(Req req, String username) { if (username != null) { try { return req.routes().custom().rolesProvider().getRolesForUser(req, username); } catch (Exception e) { throw U.rte(e); } } else { return Collections.emptySet(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public int hashCode() { int result = Arrays.hashCode(packages); result = 31 * result + (matching != null ? matching.hashCode() : 0); result = 31 * result + Arrays.hashCode(annotated); result = 31 * result + (classLoader != null ? classLoader.hashCode() : 0); ...
#vulnerable code @Override public int hashCode() { int result = Arrays.hashCode(packages); result = 31 * result + (matching != null ? matching.hashCode() : 0); result = 31 * result + Arrays.hashCode(annotated); result = 31 * result + (classLoader != null ? classLoader.hashCode() :...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void renderJson(Req req, Object value, OutputStream out) throws Exception { Customization.of(req).jackson().writeValue(out, value); }
#vulnerable code @Override public void renderJson(Req req, Object value, OutputStream out) throws Exception { req.custom().jackson().writeValue(out, value); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(timeout = 30000) public void testJDBCWithTextConfig() { Conf.JDBC.set("driver", "org.h2.Driver"); Conf.JDBC.set("url", "jdbc:h2:mem:mydb"); Conf.JDBC.set("username", "sa"); Conf.C3P0.set("maxPoolSize", "123"); JdbcClient jdbc = JDBC.defaultApi(); eq(jdbc.dri...
#vulnerable code @Test(timeout = 30000) public void testJDBCWithTextConfig() { Conf.JDBC.set("driver", "org.h2.Driver"); Conf.JDBC.set("url", "jdbc:h2:mem:mydb"); Conf.JDBC.set("username", "sa"); Conf.C3P0.set("maxPoolSize", "123"); JDBC.defaultApi().pooled(); JdbcClient jd...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void complete(Channel ctx, boolean isKeepAlive, Req req, Object result) { if (result == null) { http.notFound(ctx, isKeepAlive, this, req); return; // not found } if (result instanceof HttpStatus) { complete(ctx, isKeepAlive, req, U.rte("HttpStatus result...
#vulnerable code public void complete(Channel ctx, boolean isKeepAlive, Req req, Object result) { if (result == null) { http.notFound(ctx, isKeepAlive, this, req); return; // not found } if (result instanceof HttpStatus) { complete(ctx, isKeepAlive, req, U.rte("HttpStatus ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void reset() { super.reset(); isGet.value = false; isKeepAlive.value = false; verb.reset(); uri.reset(); path.reset(); query.reset(); protocol.reset(); body.reset(); multipartBoundary.reset(); params.reset(); headersKV.reset(); head...
#vulnerable code @Override public void reset() { super.reset(); isGet.value = false; isKeepAlive.value = false; verb.reset(); uri.reset(); path.reset(); query.reset(); protocol.reset(); body.reset(); multipartBoundary.reset(); params.reset(); headersKV.reset(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ScanParams that = (ScanParams) o; if (!Arrays.equals(packages, that.packages)) return false; if (matching != null ? !matching.equals(th...
#vulnerable code @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ScanParams that = (ScanParams) o; if (!Arrays.equals(packages, that.packages)) return false; if (matching != null ? !matching.equ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static Object emit(HttpExchange x) { int event = U.num(x.data("event")); TagContext ctx = x.session(SESSION_CTX, null); // if the context has been lost, reload the page if (ctx == null) { return changes(x, PAGE_RELOAD); } Cmd cmd = ctx.getEventCmd(event)...
#vulnerable code public static Object emit(HttpExchange x) { int event = U.num(x.data("event")); TagContext ctx = x.session(SESSION_CTX, null); // if the context has been lost, reload the page if (ctx == null) { return changes(x, PAGE_RELOAD); } Cmd cmd = ctx.getEventCmd(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public String get() { return count > 0 ? String.format("%s:[%s..%s..%s]#%s", sum, min, sum / count, max, count) : "" + ticks; }
#vulnerable code @Override public String get() { return count > 0 ? String.format("[%s..%s..%s]/%s", min, sum / count, max, count) : null; } #location 3 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void complete(Channel ctx, boolean isKeepAlive, Req req, Object result) { if (result == null) { http.notFound(ctx, isKeepAlive, this, req); return; // not found } if (result instanceof HttpStatus) { complete(ctx, isKeepAlive, req, U.rte("HttpStatus result...
#vulnerable code public void complete(Channel ctx, boolean isKeepAlive, Req req, Object result) { if (result == null) { http.notFound(ctx, isKeepAlive, this, req); return; // not found } if (result instanceof HttpStatus) { complete(ctx, isKeepAlive, req, U.rte("HttpStatus ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public HttpExchangeBody goBack(int steps) { String dest = "/"; List<String> stack = session(SESSION_PAGE_STACK, null); if (stack != null) { if (!stack.isEmpty()) { dest = stack.get(stack.size() - 1); } for (int i = 0; i < steps; i++) { if (!st...
#vulnerable code @Override public HttpExchangeBody goBack(int steps) { List<String> stack = session(SESSION_PAGE_STACK, null); String dest = !stack.isEmpty() ? stack.get(stack.size() - 1) : "/"; for (int i = 0; i < steps; i++) { if (stack != null && !stack.isEmpty()) { stac...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private byte[] responseToBytes() { try { return response.renderToBytes(); } catch (Throwable e) { HttpIO.error(this, e); try { return response.renderToBytes(); } catch (Exception e1) { Log.error("Internal rendering error!", e1); return HttpUtils.ge...
#vulnerable code private byte[] responseToBytes() { try { return response.renderToBytes(); } catch (Throwable e) { HttpIO.error(this, e, Customization.of(this).errorHandler()); try { return response.renderToBytes(); } catch (Exception e1) { Log.error("Internal re...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Future<byte[]> get(String uri, Callback<byte[]> callback) { return request("GET", uri, null, null, null, null, null, callback); }
#vulnerable code public Future<byte[]> get(String uri, Callback<byte[]> callback) { HttpGet req = new HttpGet(uri); Log.debug("Starting HTTP GET request", "request", req.getRequestLine()); return execute(client, req, callback); } #location 6 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void process(Channel ctx) { if (ctx.isInitial()) { return; } Buf buf = ctx.input(); RapidoidHelper helper = ctx.helper(); Range[] ranges = helper.ranges1.ranges; Ranges hdrs = helper.ranges2; BoolWrap isGet = helper.booleans[0]; BoolWrap isKeepAlive ...
#vulnerable code public void process(Channel ctx) { if (ctx.isInitial()) { return; } Buf buf = ctx.input(); RapidoidHelper helper = ctx.helper(); Range[] ranges = helper.ranges1.ranges; Ranges hdrs = helper.ranges2; BoolWrap isGet = helper.booleans[0]; BoolWrap isKeep...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void addInfo(List<Object> info, final GroupOf<?> group, List<? extends Manageable> items, List<String> columns) { columns.add("(Actions)"); final String groupName = group.name(); final String kind = group.kind(); info.add(breadcrumb(kind, groupName)); Grid gr...
#vulnerable code private void addInfo(List<Object> info, final GroupOf<?> group, List<? extends Manageable> items, List<String> columns) { columns.add("(Actions)"); final String groupName = group.name(); String type = U.first(items).getManageableType(); info.add(breadcrumb(type, g...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ScanParams that = (ScanParams) o; if (!Arrays.equals(packages, that.packages)) return false; if (matching != null ? !matching.equals(th...
#vulnerable code @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ScanParams that = (ScanParams) o; if (!Arrays.equals(packages, that.packages)) return false; if (matching != null ? !matching.equ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static List<Class<?>> getClassesFromJAR(String jarName, List<Class<?>> classes, String pkg, Pattern regex, Predicate<Class<?>> filter, Class<? extends Annotation> annotated, ClassLoader classLoader) { ZipInputStream zip = null; try { String pkgPath = pkgToPath...
#vulnerable code private static List<Class<?>> getClassesFromJAR(String jarName, List<Class<?>> classes, String pkg, Pattern regex, Predicate<Class<?>> filter, Class<? extends Annotation> annotated, ClassLoader classLoader) { try { String pkgPath = pkgToPath(pkg); ZipInputStrea...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @SuppressWarnings("unchecked") public static WebApp bootstrap(WebApp app, String[] args, Object... config) { Log.info("Starting Rapidoid...", "version", RapidoidInfo.version()); ConfigHelp.processHelp(args); // FIXME make optional // print internal state // LoggerCo...
#vulnerable code @SuppressWarnings("unchecked") public static WebApp bootstrap(WebApp app, String[] args, Object... config) { Log.info("Starting Rapidoid...", "version", RapidoidInfo.version()); ConfigHelp.processHelp(args); // FIXME make optional // print internal state // Lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Object call() throws Exception { List<Object> info = U.list(); Collection<? extends GroupOf<?>> targetGroups = groups != null ? groups : Groups.all(); for (GroupOf<?> group : targetGroups) { List<? extends Manageable> items = group.items(); List<...
#vulnerable code @Override public Object call() throws Exception { List<Object> info = U.list(); for (GroupOf<?> group : Groups.all()) { List<? extends Manageable> items = group.items(); if (U.notEmpty(items)) { List<String> columns = U.first(items).getManageableProperties...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void shouldParseRequest1() { RapidoidHelper req = parse(REQ1); BufGroup bufs = new BufGroup(2); Buf reqbuf = bufs.from(REQ1, "r2"); eq(REQ1, req.verb, "GET"); eq(REQ1, req.path, "/foo/bar"); eqs(REQ1, req.params, "a", "5", "b", "", "n", "%20"); eq(r...
#vulnerable code @Test public void shouldParseRequest1() { ReqData req = parse(REQ1); BufGroup bufs = new BufGroup(2); Buf reqbuf = bufs.from(REQ1, "r2"); eq(REQ1, req.rVerb, "GET"); eq(REQ1, req.rPath, "/foo/bar"); eqs(REQ1, req.params, "a", "5", "b", "", "n", "%20"); eq(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static void generateIndex(String path) { System.out.println(); System.out.println(); System.out.println("*************** " + path); System.out.println(); System.out.println(); List<Map<String, ?>> examplesl = U.list(); IntWrap nl = new IntWrap(); List<St...
#vulnerable code private static void generateIndex(String path) { System.out.println(); System.out.println(); System.out.println("*************** " + path); System.out.println(); System.out.println(); List<Map<String, ?>> examples = U.list(); IntWrap nn = new IntWrap(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public int hashCode() { int result = Arrays.hashCode(packages); result = 31 * result + (matching != null ? matching.hashCode() : 0); result = 31 * result + Arrays.hashCode(annotated); result = 31 * result + (classLoader != null ? classLoader.hashCode() : 0); ...
#vulnerable code @Override public int hashCode() { int result = Arrays.hashCode(packages); result = 31 * result + (matching != null ? matching.hashCode() : 0); result = 31 * result + Arrays.hashCode(annotated); result = 31 * result + (classLoader != null ? classLoader.hashCode() :...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void render(Req req, Object value, OutputStream out) throws Exception { Customization.of(req).xmlMapper().writeValue(out, value); }
#vulnerable code @Override public void render(Req req, Object value, OutputStream out) throws Exception { Customization.of(req).jacksonXml().writeValue(out, value); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void doProcessing() { long now = U.time(); int connectingN = connecting.size(); for (int i = 0; i < connectingN; i++) { ConnectionTarget target = connecting.poll(); assert target != null; if (target.retryAfter < now) { Log.debug("connec...
#vulnerable code @Override protected void doProcessing() { long now = U.time(); int connectingN = connecting.size(); for (int i = 0; i < connectingN; i++) { ConnectionTarget target = connecting.poll(); assert target != null; if (target.retryAfter < now) { Log.debug("...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void verifyCase(String info, String actual, String testCaseName) { String s = File.separator; String resname = "results" + s + testName() + s + getTestMethodName() + s + testCaseName; String filename = "src" + s + "test" + s + "resources" + s + resname; if (AD...
#vulnerable code protected void verifyCase(String info, String actual, String testCaseName) { String s = File.separator; String resname = "results" + s + testName() + s + getTestMethodName() + s + testCaseName; String filename = "src" + s + "test" + s + "resources" + s + resname; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private boolean handleError(Channel channel, boolean isKeepAlive, ReqImpl req, MediaType contentType, Throwable e) { if (req != null) { if (!req.isStopped()) { try { HttpIO.errorAndDone(req, e); } catch (Exception e1) { Log.error("HTTP error handler error!...
#vulnerable code private boolean handleError(Channel channel, boolean isKeepAlive, ReqImpl req, MediaType contentType, Throwable e) { if (req != null) { if (!req.isStopped()) { HttpIO.errorAndDone(req, e); } return true; } else { Log.error("Low-level HTTP handler error...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public int hashCode() { int result = Arrays.hashCode(packages); result = 31 * result + (matching != null ? matching.hashCode() : 0); result = 31 * result + Arrays.hashCode(annotated); result = 31 * result + (classLoader != null ? classLoader.hashCode() : 0); ...
#vulnerable code @Override public int hashCode() { int result = Arrays.hashCode(packages); result = 31 * result + (matching != null ? matching.hashCode() : 0); result = 31 * result + Arrays.hashCode(annotated); result = 31 * result + (classLoader != null ? classLoader.hashCode() :...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(timeout = 30000) public void testHikariPool() { Conf.HIKARI.set("maximumPoolSize", 234); JdbcClient jdbc = JDBC.api(); jdbc.h2("hikari-test"); jdbc.dataSource(HikariFactory.createDataSourceFor(jdbc)); jdbc.execute("create table abc (id int, name varchar)"); ...
#vulnerable code @Test(timeout = 30000) public void testHikariPool() { JdbcClient jdbc = JDBC.api(); jdbc.h2("hikari-test"); jdbc.pool(new HikariConnectionPool(jdbc)); jdbc.execute("create table abc (id int, name varchar)"); jdbc.execute("insert into abc values (?, ?)", 123, "...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static <T> void invokePostConstruct(T target) { List<Method> methods = Cls.getMethodsAnnotated(target.getClass(), Init.class); for (Method method : methods) { Cls.invoke(method, target); } }
#vulnerable code private static <T> void invokePostConstruct(T target) { List<Method> methods = Cls.getMethodsAnnotated(target.getClass(), Init.class); for (Method method : methods) { Cls.invoke(null, method, target); } } #location 5 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Object handle(HttpExchange x) throws Exception { return Pages.emit(x); }
#vulnerable code @Override public Object handle(HttpExchange x) throws Exception { int event = U.num(x.data("event")); TagContext ctx = Pages.ctx(x); Map<Integer, Object> inp = Pages.inputs(x); ctx.emit(inp, event); Object page = U.newInstance(currentPage(x)); ctx = Tags....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Object getParamValue(Req req, Class<?> paramType, String paramName, Map<String, Object> properties) throws Exception { return Customization.of(req).jackson().convertValue(properties, paramType); }
#vulnerable code @Override public Object getParamValue(Req req, Class<?> paramType, String paramName, Map<String, Object> properties) throws Exception { return req.custom().jackson().convertValue(properties, paramType); } #location 3 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ScanParams that = (ScanParams) o; if (!Arrays.equals(packages, that.packages)) return false; if (matching != null ? !matching.equals(th...
#vulnerable code @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ScanParams that = (ScanParams) o; if (!Arrays.equals(packages, that.packages)) return false; if (matching != null ? !matching.equ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @SuppressWarnings("unchecked") public static WebApp bootstrap(WebApp app, String[] args, Object... config) { Log.info("Starting Rapidoid...", "version", RapidoidInfo.version()); ConfigHelp.processHelp(args); // FIXME make optional // print internal state // LoggerCo...
#vulnerable code @SuppressWarnings("unchecked") public static WebApp bootstrap(WebApp app, String[] args, Object... config) { Log.info("Starting Rapidoid...", "version", RapidoidInfo.version()); ConfigHelp.processHelp(args); // FIXME make optional // print internal state // Lo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private boolean handleError(Channel channel, boolean isKeepAlive, ReqImpl req, MediaType contentType, Throwable e) { if (req != null) { if (!req.isStopped()) { HttpIO.errorAndDone(req, e); } return true; } else { Log.error("Low-level HTTP handler error!", e)...
#vulnerable code private boolean handleError(Channel channel, boolean isKeepAlive, ReqImpl req, MediaType contentType, Throwable e) { if (req != null) { if (!req.isStopped()) { HttpIO.errorAndDone(req, e, customization.errorHandler()); } return true; } else { Log.error...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void reset() { super.reset(); isGet.value = false; isKeepAlive.value = false; verb.reset(); uri.reset(); path.reset(); query.reset(); protocol.reset(); body.reset(); multipartBoundary.reset(); params.reset(); headersKV.reset(); head...
#vulnerable code @Override public void reset() { super.reset(); isGet.value = false; isKeepAlive.value = false; verb.reset(); uri.reset(); path.reset(); query.reset(); protocol.reset(); body.reset(); multipartBoundary.reset(); params.reset(); headersKV.reset(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void setRootPath(String rootPath) { Log.info("Setting 'root' application path", "path", rootPath); Conf.rootPath = cleanPath(rootPath); setStaticPath(Conf.rootPath + "/static"); setDynamicPath(Conf.rootPath + "/dynamic"); setConfigPath(Conf.rootPath); }
#vulnerable code public static void setRootPath(String rootPath) { Log.info("Setting 'root' application path", "path", rootPath); Conf.rootPath = cleanPath(rootPath); setStaticPath(Conf.rootPath + "/static"); setDynamicPath(Conf.rootPath + "/dynamic"); setConfigPath(Conf.rootPath...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static List<Class<?>> getClassesFromJAR(String jarName, List<Class<?>> classes, String pkg, Pattern regex, Predicate<Class<?>> filter, Class<? extends Annotation> annotated, ClassLoader classLoader) { ZipInputStream zip = null; try { String pkgPath = pkgToPath...
#vulnerable code private static List<Class<?>> getClassesFromJAR(String jarName, List<Class<?>> classes, String pkg, Pattern regex, Predicate<Class<?>> filter, Class<? extends Annotation> annotated, ClassLoader classLoader) { try { String pkgPath = pkgToPath(pkg); ZipInputStrea...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static DivTag field(FormLayout layout, String name, String desc, FieldType type, Object[] options, Object value) { desc = U.or(desc, name); String inputId = "_" + name; // FIXME Object inp = input_(inputId, name, desc, type, options, value); LabelTag label; ...
#vulnerable code public static DivTag field(FormLayout layout, String name, String desc, FieldType type, Object[] options, Object value) { desc = U.or(desc, name); String inputId = "_" + name; // FIXME Object inp = input_(inputId, name, desc, type, options, value); LabelTag la...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static String loadResourceAsString(String filename) { byte[] bytes = loadBytes(filename); return bytes != null ? new String(bytes) : null; }
#vulnerable code public static String loadResourceAsString(String filename) { return new String(loadBytes(filename)); } #location 2 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static char[] readPassword(String msg) { Console console = System.console(); if (console != null) { return console.readPassword(msg); } else { U.print(msg); return readLine().toCharArray(); } }
#vulnerable code private static char[] readPassword(String msg) { Console console = System.console(); if (console != null) { return console.readPassword(msg); } else { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); U.print(msg); try { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEncryptWithCustomPassword() { CryptoKey key = CryptoKey.from("pass".toCharArray()); for (int i = 0; i < 10000; i++) { String msg1 = "" + i; byte[] enc = Crypto.encrypt(msg1.getBytes(), key); byte[] dec = Crypto.decrypt(enc, key); String ...
#vulnerable code @Test public void testEncryptWithCustomPassword() { byte[] key = Crypto.pbkdf2("pass".toCharArray()); for (int i = 0; i < 10000; i++) { String msg1 = "" + i; byte[] enc = Crypto.encrypt(msg1.getBytes(), key); byte[] dec = Crypto.decrypt(enc, key); Strin...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public int hashCode() { int result = Arrays.hashCode(packages); result = 31 * result + (matching != null ? matching.hashCode() : 0); result = 31 * result + Arrays.hashCode(annotated); result = 31 * result + (classLoader != null ? classLoader.hashCode() : 0); ...
#vulnerable code @Override public int hashCode() { int result = Arrays.hashCode(packages); result = 31 * result + (matching != null ? matching.hashCode() : 0); result = 31 * result + Arrays.hashCode(annotated); result = 31 * result + (classLoader != null ? classLoader.hashCode() :...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(timeout = 30000) public void testJDBCPoolC3P0() { JDBC.h2("test1"); C3P0ConnectionPool pool = (C3P0ConnectionPool) JDBC.defaultApi().init().pool(); ComboPooledDataSource c3p0 = pool.pool(); // validate default config eq(c3p0.getMinPoolSize(), 5); eq(c3p0.ge...
#vulnerable code @Test(timeout = 30000) public void testJDBCPoolC3P0() { JDBC.h2("test1").pooled(); C3P0ConnectionPool pool = (C3P0ConnectionPool) JDBC.defaultApi().pool(); ComboPooledDataSource c3p0 = pool.pool(); // validate default config eq(c3p0.getMinPoolSize(), 5); eq...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private byte[] responseToBytes() { try { return response.renderToBytes(); } catch (Throwable e) { HttpIO.error(this, e, Customization.of(this).errorHandler()); try { return response.renderToBytes(); } catch (Exception e1) { Log.error("Internal renderin...
#vulnerable code private byte[] responseToBytes() { try { return response.renderToBytes(); } catch (Throwable e) { HttpIO.error(this, e, custom().errorHandler()); try { return response.renderToBytes(); } catch (Exception e1) { Log.error("Internal rendering error!...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) { final HttpParser parser = new HttpParser(); final Buf[] reqs = {r(REQ1), r(REQ2), r(REQ3), r(REQ4)}; final RapidoidHelper helper = new RapidoidHelper(null); for (int i = 0; i < 100; i++) { Msc.benchmark("parse", 3000000, new ...
#vulnerable code public static void main(String[] args) { final HttpParser parser = new HttpParser(); final Buf[] reqs = {r(REQ1), r(REQ2), r(REQ3), r(REQ4)}; final RapidoidHelper helper = new RapidoidHelper(null); BufRange[] ranges = helper.ranges1.ranges; final BufRanges head...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void render(Req req, Object value, OutputStream out) throws Exception { Customization.of(req).objectMapper().writeValue(out, value); }
#vulnerable code @Override public void render(Req req, Object value, OutputStream out) throws Exception { Customization.of(req).jackson().writeValue(out, value); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static void getClassesFromDir(Collection<Class<?>> classes, File root, File dir, String pkg, Pattern regex, Predicate<Class<?>> filter, Class<? extends Annotation> annotated, ClassLoader classLoader) { U.must(dir.isDirectory()); Log.debug("Traversing directory", "...
#vulnerable code private static void getClassesFromDir(Collection<Class<?>> classes, File root, File dir, String pkg, Pattern regex, Predicate<Class<?>> filter, Class<? extends Annotation> annotated, ClassLoader classLoader) { U.must(dir.isDirectory()); Log.debug("Traversing directo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Future<byte[]> post(String uri, Map<String, String> headers, Map<String, String> data, Map<String, String> files, Callback<byte[]> callback) { return request("POST", uri, headers, data, files, null, null, callback); }
#vulnerable code public Future<byte[]> post(String uri, Map<String, String> headers, Map<String, String> data, Map<String, String> files, Callback<byte[]> callback) { headers = U.safe(headers); data = U.safe(data); files = U.safe(files); HttpPost req = new HttpPost(uri); Mu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void completeResponse() { U.must(responseCode >= 100); long wrote = output().size() - bodyPos; U.must(wrote <= Integer.MAX_VALUE, "Response too big!"); int pos = startingPos + getResp(responseCode).contentLengthPos + 10; output().putNumAsText(pos, wrote, false)...
#vulnerable code public void completeResponse() { long wrote = output().size() - bodyPos; U.must(wrote <= Integer.MAX_VALUE, "Response too big!"); int pos = startingPos + getResp(responseCode).contentLengthPos + 10; output().putNumAsText(pos, wrote, false); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected byte[] loadRes(String filename) { InputStream input = TestCommons.class.getClassLoader().getResourceAsStream(filename); return input != null ? readBytes(input) : null; }
#vulnerable code protected byte[] loadRes(String filename) { try { URL res = resource(filename); return res != null ? readBytes(new FileInputStream(new File(res.getFile()))) : null; } catch (FileNotFoundException e) { throw new RuntimeException(e); } } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static byte[] render(ReqImpl req, Resp resp) { Object result = resp.result(); if (result != null) { result = wrapGuiContent(result); resp.model().put("result", result); resp.result(result); } ViewRenderer viewRenderer = Customization.of(req).viewRender...
#vulnerable code public static byte[] render(ReqImpl req, Resp resp) { Object result = resp.result(); if (result != null) { result = wrapGuiContent(result); resp.model().put("result", result); resp.result(result); } ViewRenderer viewRenderer = req.routes().custom().view...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void initDbConnectServer() throws Exception{ dbRpcConnnectManngeer.initManager(); dbRpcConnnectManngeer.initServers(rpcConfig.getSdDbServers()); }
#vulnerable code public void initDbConnectServer() throws Exception{ dbRpcConnnectManngeer.initManager(); dbRpcConnnectManngeer.initServers(sdDbServers); } #location 3 #vulnerability type THREAD_SAFETY_VIOLATI...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void initWorldConnectedServer() throws Exception { worldRpcConnectManager.initManager(); worldRpcConnectManager.initServers(rpcConfig.getSdWorldServers()); }
#vulnerable code public void initWorldConnectedServer() throws Exception { worldRpcConnectManager.initManager(); worldRpcConnectManager.initServers(sdWorldServers); } #location 3 #vulnerability type THREAD_SAF...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) throws Exception{ final String data = "博主邮箱:zou90512@126.com"; byte[] bytes = data.getBytes(Charset.forName("UTF-8")); InetSocketAddress targetHost = new InetSocketAddress("127.0.0.1", 9999); // 发送udp内容 ...
#vulnerable code public static void main(String[] args) throws Exception{ final String data = "博主邮箱:zou90512@126.com"; byte[] bytes = data.getBytes(Charset.forName("UTF-8")); InetSocketAddress targetHost = new InetSocketAddress("127.0.0.1", 9999); // 发送...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void initDbConnectServer() throws Exception{ dbRpcConnnectManngeer.initManager(); dbRpcConnnectManngeer.initServers(rpcConfig.getSdDbServers()); }
#vulnerable code public void initDbConnectServer() throws Exception{ dbRpcConnnectManngeer.initManager(); dbRpcConnnectManngeer.initServers(sdDbServers); } #location 3 #vulnerability type THREAD_SAFETY_VIOLATI...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void initWorldConnectedServer() throws Exception { worldRpcConnectManager.initManager(); worldRpcConnectManager.initServers(rpcConfig.getSdWorldServers()); }
#vulnerable code public void initWorldConnectedServer() throws Exception { worldRpcConnectManager.initManager(); worldRpcConnectManager.initServers(sdWorldServers); } #location 2 #vulnerability type THREAD_SAF...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void initDbConnectServer() throws Exception{ dbRpcConnnectManngeer.initManager(); dbRpcConnnectManngeer.initServers(rpcConfig.getSdDbServers()); }
#vulnerable code public void initDbConnectServer() throws Exception{ dbRpcConnnectManngeer.initManager(); dbRpcConnnectManngeer.initServers(sdDbServers); } #location 2 #vulnerability type THREAD_SAFETY_VIOLATI...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @SuppressWarnings("unchecked") public void init() throws Exception { initWorldConnectedServer(); initGameConnectedServer(); initDbConnectServer(); }
#vulnerable code @SuppressWarnings("unchecked") public void init() throws Exception { Element rootElement = JdomUtils.getRootElemet(FileUtil.getConfigURL(GlobalConstants.ConfigFile.RPC_SERVER_CONFIG).getFile()); Map<Integer, SdServer> serverMap = new HashMap<>(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void loadPackage(String namespace, String ext) throws Exception { if(fileNames == null){ fileNames = messageScanner.scannerPackage(namespace, ext); } // 加载class,获取协议命令 DefaultClassLoader defaultClassLoader = Local...
#vulnerable code public void loadPackage(String namespace, String ext) throws Exception { if(fileNames == null){ fileNames = messageScanner.scannerPackage(namespace, ext); } // 加载class,获取协议命令 DefaultClassLoader defaultClassLoader =...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void initGameConnectedServer() throws Exception { gameRpcConnecetMananger.initManager(); gameRpcConnecetMananger.initServers(rpcConfig.getSdGameServers()); }
#vulnerable code public void initGameConnectedServer() throws Exception { gameRpcConnecetMananger.initManager(); gameRpcConnecetMananger.initServers(sdGameServers); } #location 2 #vulnerability type THREAD_SAF...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @SuppressWarnings("unchecked") public void init() throws Exception { initWorldConnectedServer(); initGameConnectedServer(); initDbConnectServer(); }
#vulnerable code @SuppressWarnings("unchecked") public void init() throws Exception { Element rootElement = JdomUtils.getRootElemet(FileUtil.getConfigURL(GlobalConstants.ConfigFile.RPC_SERVER_CONFIG).getFile()); Map<Integer, SdServer> serverMap = new HashMap<>(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void loadPackage(String namespace, String ext) throws Exception { if(fileNames == null){ fileNames = messageScanner.scannerPackage(namespace, ext); } // 加载class,获取协议命令 DefaultClassLoader defaultClassLoader = Local...
#vulnerable code public void loadPackage(String namespace, String ext) throws Exception { if(fileNames == null){ fileNames = messageScanner.scannerPackage(namespace, ext); } // 加载class,获取协议命令 DefaultClassLoader defaultClassLoader =...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void initGameConnectedServer() throws Exception { gameRpcConnecetMananger.initManager(); gameRpcConnecetMananger.initServers(rpcConfig.getSdGameServers()); }
#vulnerable code public void initGameConnectedServer() throws Exception { gameRpcConnecetMananger.initManager(); gameRpcConnecetMananger.initServers(sdGameServers); } #location 3 #vulnerability type THREAD_SAF...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void initWorldConnectedServer() throws Exception { worldRpcConnectManager.initManager(); worldRpcConnectManager.initServers(rpcConfig.getSdWorldServers()); }
#vulnerable code public void initWorldConnectedServer() throws Exception { worldRpcConnectManager.initManager(); worldRpcConnectManager.initServers(sdWorldServers); } #location 3 #vulnerability type THREAD_SAF...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @SuppressWarnings("unchecked") public void init() throws Exception { initWorldConnectedServer(); initGameConnectedServer(); initDbConnectServer(); }
#vulnerable code @SuppressWarnings("unchecked") public void init() throws Exception { Element rootElement = JdomUtils.getRootElemet(FileUtil.getConfigURL(GlobalConstants.ConfigFile.RPC_SERVER_CONFIG).getFile()); Map<Integer, SdServer> serverMap = new HashMap<>(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void initGameConnectedServer() throws Exception { gameRpcConnecetMananger.initManager(); gameRpcConnecetMananger.initServers(rpcConfig.getSdGameServers()); }
#vulnerable code public void initGameConnectedServer() throws Exception { gameRpcConnecetMananger.initManager(); gameRpcConnecetMananger.initServers(sdGameServers); } #location 3 #vulnerability type THREAD_SAF...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void initGameConnectedServer() throws Exception { gameRpcConnecetMananger.initManager(); gameRpcConnecetMananger.initServers(sdGameServers); }
#vulnerable code public void initGameConnectedServer() throws Exception { worldRpcConnectManager.initManager(); gameRpcConnecetMananger.initServers(sdGameServers); } #location 2 #vulnerability type THREAD_SAFE...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code Object fromDb(DBObject dbObject, final Object entity, EntityCache cache) { // check the history key (a key is the namespace + id) if (dbObject.containsField(ID_KEY) && getMappedClass(entity).getIdField() != null && getMappedClass(entity).getEntityAnnotation() != null)...
#vulnerable code Object fromDb(DBObject dbObject, final Object entity, EntityCache cache) { // check the history key (a key is the namespace + id) if (dbObject.containsField(ID_KEY) && getMappedClass(entity).getIdField() != null && getMappedClass(entity).getEntityAnnotation() !=...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected Object getId(Object entity) { entity = ProxyHelper.unwrap(entity); // String keyClassName = entity.getClass().getName(); MappedClass mc = mapr.getMappedClass(entity.getClass()); // // if (mapr.getMappedClasses().containsKey(keyClassName)) // mc = mapr.getMapp...
#vulnerable code protected Object getId(Object entity) { entity = ProxyHelper.unwrap(entity); MappedClass mc; String keyClassName = entity.getClass().getName(); if (mapr.getMappedClasses().containsKey(keyClassName)) mc = mapr.getMappedClasses().get(keyClassName); else mc = ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public <T> Key<T> save(String kind, T entity) { entity = ProxyHelper.unwrap(entity); DBCollection dbColl = getDB().getCollection(kind); return save(dbColl, entity, getWriteConcern(entity)); }
#vulnerable code public <T> Key<T> save(String kind, T entity) { entity = ProxyHelper.unwrap(entity); DBCollection dbColl = getDB().getCollection(kind); return save(dbColl, entity, defConcern); } #location 4 #vulnerability ty...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private <T> Iterable<Key<T>> insert(final DBCollection dbColl, final Iterable<T> entities, final WriteConcern wc) { // return save(entities, wc); final List<DBObject> list = entities instanceof List ? new ArrayList<DB...
#vulnerable code private <T> Iterable<Key<T>> insert(final DBCollection dbColl, final Iterable<T> entities, final WriteConcern wc) { final List<DBObject> list = entities instanceof List ? new ArrayList<DBObject>(((List<T>) entities).size()) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code Object fromDb(DBObject dbObject, final Object entity, EntityCache cache) { //hack to bypass things and just read the value. if (entity instanceof MappedField) { readMappedField(dbObject, (MappedField) entity, entity, cache); return entity; } // check the history...
#vulnerable code Object fromDb(DBObject dbObject, final Object entity, EntityCache cache) { // check the history key (a key is the namespace + id) if (dbObject.containsField(ID_KEY) && getMappedClass(entity).getIdField() != null && getMappedClass(entity).getEntityAnnotation() !=...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Object toMongoObject(final MappedField mf, final MappedClass mc, final Object value) { Object mappedValue = value; //convert the value to Key (DBRef) if the field is @Reference or type is Key/DBRef, or if the destination class is an @Entity if ...
#vulnerable code public Object toMongoObject(final MappedField mf, final MappedClass mc, final Object value) { Object mappedValue = value; //convert the value to Key (DBRef) if the field is @Reference or type is Key/DBRef, or if the destination class is an @Entity ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public <T> UpdateResults<T> update(T ent, UpdateOperations<T> ops) { if (ent instanceof Query) return update((Query<T>)ent, ops); MappedClass mc = mapr.getMappedClass(ent); Query<T> q = (Query<T>) createQuery(mc.getClazz()); q.disableValidation().filter(Mapper.ID_K...
#vulnerable code public <T> UpdateResults<T> update(T ent, UpdateOperations<T> ops) { MappedClass mc = mapr.getMappedClass(ent); Query<T> q = (Query<T>) createQuery(mc.getClazz()); q.disableValidation().filter(Mapper.ID_KEY, getId(ent)); if (mc.getFieldsAnnotatedWith(Version.cla...
Below is the vulnerable code, please generate the patch based on the following information.