input
stringlengths
205
73.3k
output
stringlengths
64
73.2k
instruction
stringclasses
1 value
#vulnerable code public void bind() { if (bound) throw new IllegalStateException("Already bound to " + assignedThread); bound = true; assignedThread = Thread.currentThread(); AffinitySupport.setAffinity(1L << id); if (LOGGER.isLoggable(Level.INFO)...
#fixed code public void bind() { bind(false); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void bind() { if (bound) throw new IllegalStateException("Already bound to " + assignedThread); bound = true; assignedThread = Thread.currentThread(); AffinitySupport.setAffinity(1L << id); if (LOGGER.isLoggable(Level.INFO)...
#fixed code public void bind() { bind(false); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void bind(boolean wholeCore) { if (bound && assignedThread != null && assignedThread.isAlive()) throw new IllegalStateException("cpu " + id + " already bound to " + assignedThread); if (wholeCore) { int core = coreForId(id...
#fixed code public void bind(boolean wholeCore) { if (bound && assignedThread != null && assignedThread.isAlive()) throw new IllegalStateException("cpu " + id + " already bound to " + assignedThread); if (wholeCore) { int core = coreForId(id); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void bind() { if (bound) throw new IllegalStateException("Already bound to " + assignedThread); bound = true; assignedThread = Thread.currentThread(); AffinitySupport.setAffinity(1L << id); if (LOGGER.isLoggable(Level.INFO)...
#fixed code public void bind() { bind(false); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testAnalyzer() { ExpressionCompiler compiler = new ExpressionCompiler("order.id == 10"); compiler.compile(); for (String input : compiler.getInputs()) { System.out.println("input>" + input); } assertEqual...
#fixed code public void testAnalyzer() { ExpressionCompiler compiler = new ExpressionCompiler("order.id == 10"); compiler.compile(); for (String input : compiler.getParserContextState().getInputs().keySet()) { System.out.println("input>" + input); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Object getCollectionProperty(Object ctx, String prop) throws Exception { if (prop.length() != 0) { ctx = getBeanProperty(ctx, prop); } int start = ++cursor; whiteSpaceSkip(); if (cursor == length) ...
#fixed code private Object getCollectionProperty(Object ctx, String prop) throws Exception { if (prop.length() != 0) { ctx = getBeanProperty(ctx, prop); } int start = ++cursor; whiteSpaceSkip(); if (cursor == length || scanTo(']')) ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expres...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expressions....
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { switch (nodes[0].getToken()) { case PROPERTY_EX: //noi...
#fixed code public Object execute(Object ctx, Map tokens) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { switch (nodes[0].getToken()) { case PROPERTY_EX: //noinspect...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map<String, Object> tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for ...
#fixed code public Object execute(Object ctx, Map<String, Object> tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for proper...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void setExpression(String expression) { if (expression != null && !"".equals(expression)) { if ((this.expr = EX_PRECACHE.get(expression)) == null) { synchronized (EX_PRECACHE) { length = (this.expr = expr...
#fixed code protected void setExpression(String expression) { if (expression != null && !"".equals(expression)) { synchronized (EX_PRECACHE) { if ((this.expr = EX_PRECACHE.get(expression)) == null) { length = (this.expr = expression...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { switch (nodes[0].getToken()) { case PROPERTY_EX: //noi...
#fixed code public Object execute(Object ctx, Map tokens) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { switch (nodes[0].getToken()) { case PROPERTY_EX: //noinspect...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testVarInputs() { ExpressionCompiler compiler = new ExpressionCompiler("test != foo && bo.addSomething(trouble); String bleh = foo; twa = bleh;"); CompiledExpression c = compiler.compile(); assertEquals(4, compiler.getInputs().size(...
#fixed code public void testVarInputs() { ExpressionCompiler compiler = new ExpressionCompiler("test != foo && bo.addSomething(trouble); String bleh = foo; twa = bleh;"); CompiledExpression c = compiler.compile(); ParserContext pCtx = compiler.getParserContextSt...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static String readInFile(String fileName) { File file = new File(String.valueOf(peek()) + "/" + fileName); try { FileChannel fc = new FileInputStream(file).getChannel(); push(file.getParent()); ByteBuffer buf...
#fixed code public static String readInFile(String fileName) { File file = new File(String.valueOf(peek()) + "/" + fileName); try { // FileChannel fc = new FileInputStream(file).getChannel(); FileInputStream instream = new FileInputStream(file); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @SuppressWarnings({"unchecked"}) private Object getMethod(Object ctx, String name) throws Exception { int st = cursor; String tk = cursor != length && expr[cursor] == '(' && ((cursor = balancedCapture(expr, cursor, '(')) - st) > 1 ? ...
#fixed code @SuppressWarnings({"unchecked"}) private Object getMethod(Object ctx, String name) throws Exception { int st = cursor; String tk = cursor != length && expr[cursor] == '(' && ((cursor = balancedCapture(expr, cursor, '(')) - st) > 1 ? ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expres...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expressions....
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void setExpression(String expression) { if (expression != null && !"".equals(expression)) { if ((this.expr = EX_PRECACHE.get(expression)) == null) { synchronized (EX_PRECACHE) { length = (this.expr = expr...
#fixed code protected void setExpression(String expression) { if (expression != null && !"".equals(expression)) { synchronized (EX_PRECACHE) { if ((this.expr = EX_PRECACHE.get(expression)) == null) { length = (this.expr = expression...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { switch (nodes[0].getToken()) { case PROPERTY_EX: //noi...
#fixed code public Object execute(Object ctx, Map tokens) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expressions. */ ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expres...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expressions....
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Object getCollectionProperty(Object ctx, String prop) throws Exception { if (prop.length() != 0) { ctx = getBeanProperty(ctx, prop); } int start = ++cursor; whiteSpaceSkip(); if (cursor == length) ...
#fixed code private Object getCollectionProperty(Object ctx, String prop) throws Exception { if (prop.length() != 0) { ctx = getBeanProperty(ctx, prop); } int start = ++cursor; whiteSpaceSkip(); if (cursor == length || scanTo(']')) ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected ASTNode verify(ParserContext pCtx, ASTNode tk) { if (tk.isDiscard() || (tk.fields & (ASTNode.OPERATOR | ASTNode.LITERAL)) != 0) return tk; if (verifying) { if (tk.isAssignment()) { char[] assign = tk.getNameAsArray...
#fixed code protected ASTNode verify(ParserContext pCtx, ASTNode tk) { if (tk.isDiscard() || (tk.fields & (ASTNode.OPERATOR | ASTNode.LITERAL)) != 0) return tk; if (verifying) { if (tk.isAssignment()) { char[] assign = tk.getNameAsArray(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public CompiledExpression _compile() { ASTNode tk; ASTNode tkOp; ASTNode tkOp2; ASTNode tkLA; ASTNode tkLA2; ASTLinkedList astLinkedList = new ASTLinkedList(); boolean firstLA; pCtx = getParserContext(); ...
#fixed code public CompiledExpression _compile() { ASTNode tk; ASTNode tkOp; ASTNode tkOp2; ASTNode tkLA; ASTNode tkLA2; ASTLinkedList astLinkedList = new ASTLinkedList(); boolean firstLA; pCtx = getParserContext(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Class getWithProperty(Class ctx) { String root = new String(expr, 0, cursor - 1).trim(); int start = cursor + 1; int[] res = balancedCaptureWithLineAccounting(expr, cursor, '{'); cursor = res[0]; getParserContext().increm...
#fixed code private Class getWithProperty(Class ctx) { String root = new String(expr, 0, cursor - 1).trim(); int start = cursor + 1; cursor = balancedCaptureWithLineAccounting(expr, cursor, '{', pCtx); new WithAccessor(root, subset(expr, start, cursor++ ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) { return ~((Integer) MVEL.eval(name, ctx, factory)); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) { Object o = MVEL.eval(name, ctx, factory); if (o instanceof Integer) { return ~((Integer) o); } else { throw new CompileExcept...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expres...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expressions....
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected ASTNode nextToken() { /** * If the cursor is at the end of the expression, we have nothing more to do: * return null. */ if (cursor >= length) { return null; } else if (!splitAccumulator.is...
#fixed code protected ASTNode nextToken() { /** * If the cursor is at the end of the expression, we have nothing more to do: * return null. */ if (cursor >= length) { return null; } else if (!splitAccumulator.isEmpty(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object getValue(Object ctx, Object elCtx, VariableResolverFactory variableFactory) { return Math.sqrt(DataConversion.convert(p0.getValue(ctx, variableFactory), Double.class).doubleValue()); } #location 2 ...
#fixed code public Object getValue(Object ctx, Object elCtx, VariableResolverFactory variableFactory) { // return Math.sqrt(DataConversion.convert(p0.getValue(ctx, variableFactory), Double.class).doubleValue()); for (Method m : Math.class.getMethods()) { if ("...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void setExpression(String expression) { if (expression != null && !"".equals(expression)) { if ((this.expr = EX_PRECACHE.get(expression)) == null) { synchronized (EX_PRECACHE) { length = (this.expr = expr...
#fixed code protected void setExpression(String expression) { if (expression != null && !"".equals(expression)) { synchronized (EX_PRECACHE) { if ((this.expr = EX_PRECACHE.get(expression)) == null) { length = (this.expr = expression...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void runTest(PerfTest test, int count) throws Exception { int exFlags = test.getRunFlags(); String expression = test.getExpression(); String name = test.getName(); if (!silent) { System.out.println("Test Name ...
#fixed code public void runTest(PerfTest test, int count) throws Exception { int exFlags = test.getRunFlags(); String expression = test.getExpression(); String name = test.getName(); if (!silent) { System.out.println("Test Name : " ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected boolean hasImport(String name) { if (getParserContext().hasImport(name)) { return true; } else { VariableResolverFactory vrf = findClassImportResolverFactory(variableFactory); return vrf != null && vr...
#fixed code protected boolean hasImport(String name) { if (pCtx == null) pCtx = getParserContext(); if (pCtx.hasImport(name)) { return true; } else { VariableResolverFactory vrf = findClassImportResolverFactory(variableFactory); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Object getCollectionProperty(Object ctx, String prop) throws Exception { if (prop.length() != 0) { ctx = getBeanProperty(ctx, prop); } int start = ++cursor; whiteSpaceSkip(); if (cursor == length) ...
#fixed code private Object getCollectionProperty(Object ctx, String prop) throws Exception { if (prop.length() != 0) { ctx = getBeanProperty(ctx, prop); } int start = ++cursor; whiteSpaceSkip(); if (cursor == length || scanTo(']')) ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public CompiledExpression _compile() { ASTNode tk; ASTNode tkOp; ASTNode tkOp2; ASTNode tkLA; ASTNode tkLA2; ASTLinkedList astLinkedList = new ASTLinkedList(); boolean firstLA; pCtx = getParserContext(); ...
#fixed code public CompiledExpression _compile() { ASTNode tk; ASTNode tkOp; ASTNode tkOp2; ASTNode tkLA; ASTNode tkLA2; ASTLinkedList astLinkedList = new ASTLinkedList(); boolean firstLA; pCtx = getParserContext(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) { try { Boolean bool = (Boolean) MVEL.eval(this.name, ctx, factory); if (!bool) throw new AssertionError("assertion failed in expression: " + new...
#fixed code public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) { try { if (!((Boolean) MVEL.eval(this.name, ctx, factory))) { throw new AssertionError("assertion failed in expression: " + new String(this.name));...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Object getWithProperty(Object ctx) { String root = new String(expr, 0, cursor - 1).trim(); int start = cursor + 1; int[] res = balancedCaptureWithLineAccounting(expr, cursor, '{'); cursor = res[0]; getParserContext().incr...
#fixed code private Object getWithProperty(Object ctx) { String root = new String(expr, 0, cursor - 1).trim(); int start = cursor + 1; cursor = balancedCaptureWithLineAccounting(expr, cursor, '{', pCtx); WithAccessor wa = new WithAccessor(root, subset(ex...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected Class getImport(String name) { if (getParserContext().hasImport(name)) return getParserContext().getImport(name); VariableResolverFactory vrf = findClassImportResolverFactory(variableFactory); return (Class) vrf.getVariableResolver(nam...
#fixed code protected Class getImport(String name) { if (pCtx == null) pCtx = getParserContext(); if (pCtx.hasImport(name)) return pCtx.getImport(name); VariableResolverFactory vrf = findClassImportResolverFactory(variableFactory); return (Class) vrf.get...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void setExpression(String expression) { if (expression != null && !"".equals(expression)) { if ((this.expr = EX_PRECACHE.get(expression)) == null) { synchronized (EX_PRECACHE) { length = (this.expr = expr...
#fixed code protected void setExpression(String expression) { if (expression != null && !"".equals(expression)) { synchronized (EX_PRECACHE) { if ((this.expr = EX_PRECACHE.get(expression)) == null) { length = (this.expr = expression...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Object getWithProperty(Object ctx) { assert debug("\n ** ENTER -> {with}"); if (first) { assert debug("ALOAD 1"); mv.visitVarInsn(ALOAD, 1); first = false; } String root = new String(expr, 0,...
#fixed code private Object getWithProperty(Object ctx) { assert debug("\n ** ENTER -> {with}"); if (first) { assert debug("ALOAD 1"); mv.visitVarInsn(ALOAD, 1); first = false; } String root = new String(expr, 0, curso...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static Object parse(File file, Object ctx, Map tokens, TemplateRegistry registry) throws IOException { if (!file.exists()) throw new CompileException("cannot find file: " + file.getName()); FileInputStream inStream = null; Rea...
#fixed code public static Object parse(File file, Object ctx, Map tokens, TemplateRegistry registry) throws IOException { if (!file.exists()) throw new CompileException("cannot find file: " + file.getName()); FileInputStream inStream = null; Readable...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public CompiledExpression compile() { ASTNode tk; ASTNode tkOp; ASTNode tkOp2; ASTNode tkLA; ASTNode tkLA2; ASTLinkedList astLinkedList = new ASTLinkedList(); boolean firstLA; ParserContext pCtx = getPars...
#fixed code public CompiledExpression compile() { ASTNode tk; ASTNode tkOp; ASTNode tkOp2; ASTNode tkLA; ASTNode tkLA2; ASTLinkedList astLinkedList = new ASTLinkedList(); boolean firstLA; ParserContext pCtx = getParserCont...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) { ItemResolverFactory.ItemResolver itemR = new ItemResolverFactory.ItemResolver(item); ItemResolverFactory itemFactory = new ItemResolverFactory(itemR, new Defau...
#fixed code public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) { ItemResolverFactory.ItemResolver itemR = new ItemResolverFactory.ItemResolver(item); ItemResolverFactory itemFactory = new ItemResolverFactory(itemR, new DefaultLoca...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expres...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expressions....
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map<String, Object> tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for ...
#fixed code public Object execute(Object ctx, Map<String, Object> tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for proper...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected ASTNode nextToken() { /** * If the cursor is at the end of the expression, we have nothing more to do: * return null. */ if (cursor >= length) { return null; } else if (!splitAccumulator.is...
#fixed code protected ASTNode nextToken() { /** * If the cursor is at the end of the expression, we have nothing more to do: * return null. */ if (cursor >= length) { return null; } else if (!splitAccumulator.isEmpty(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object getValue(Object ctx, Object elCtx, VariableResolverFactory variableFactory) { // return Math.sqrt(DataConversion.convert(p0.getValue(ctx, variableFactory), Double.class).doubleValue()); return ((CharSequence) ctx).charAt(DataConversion.conv...
#fixed code public Object getValue(Object ctx, Object elCtx, VariableResolverFactory variableFactory) { // return Math.sqrt(DataConversion.convert(p0.getValue(ctx, variableFactory), Double.class).doubleValue()); return Integer.class; //return ((CharSequence) ctx...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expres...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expressions....
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static String readInFile(File file) { try { FileChannel fc = new FileInputStream(file).getChannel(); ByteBuffer buf = allocateDirect(10); StringAppender appender = new StringAppender(); int read; ...
#fixed code public static String readInFile(File file) { try { FileChannel fc = new FileInputStream(file).getChannel(); ByteBuffer buf = allocateDirect(10); StringAppender appender = new StringAppender(); int read; whil...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expres...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expressions....
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static Class findClass(VariableResolverFactory factory, String name, ParserContext ctx) throws ClassNotFoundException { try { if (LITERALS.containsKey(name)) { return (Class) LITERALS.get(name); } else i...
#fixed code public static Class findClass(VariableResolverFactory factory, String name, ParserContext ctx) throws ClassNotFoundException { try { if (LITERALS.containsKey(name)) { return (Class) LITERALS.get(name); } else if (fac...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Object getCollectionProperty(Object ctx, String prop) throws Exception { if (prop.length() != 0) { ctx = getBeanProperty(ctx, prop); } int start = ++cursor; whiteSpaceSkip(); if (cursor == length) ...
#fixed code private Object getCollectionProperty(Object ctx, String prop) throws Exception { if (prop.length() != 0) { ctx = getBeanProperty(ctx, prop); } int start = ++cursor; whiteSpaceSkip(); if (cursor == length || scanTo(']')) ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public CompiledExpression _compile() { ASTNode tk; ASTNode tkOp; ASTNode tkOp2; ASTNode tkLA; ASTNode tkLA2; ASTLinkedList astBuild = new ASTLinkedList(); boolean firstLA; debugSymbols = (pCtx = getPars...
#fixed code public CompiledExpression _compile() { ASTNode tk; ASTNode tkOp; ASTNode tkOp2; ASTNode tkLA; ASTNode tkLA2; ASTLinkedList astBuild = new ASTLinkedList(); boolean firstLA; if (pCtx == null) pCtx = getParserCo...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expres...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property expressions....
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void runTest(PerfTest test, int count) throws Exception { int exFlags = test.getRunFlags(); String expression = test.getExpression(); String name = test.getName(); if (!silent) { System.out.println("Test Name ...
#fixed code public void runTest(PerfTest test, int count) throws Exception { int exFlags = test.getRunFlags(); String expression = test.getExpression(); String name = test.getName(); if (!silent) { System.out.println("Test Name : " ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void setExpression(String expression) { if (expression != null && !"".equals(expression)) { if ((this.expr = EX_PRECACHE.get(expression)) == null) { synchronized (EX_PRECACHE) { length = (this.expr = expr...
#fixed code protected void setExpression(String expression) { if (expression != null && !"".equals(expression)) { synchronized (EX_PRECACHE) { if ((this.expr = EX_PRECACHE.get(expression)) == null) { length = (this.expr = expression...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { switch (nodes[0].getToken()) { case PROPERTY_EX: //noi...
#fixed code public Object execute(Object ctx, Map tokens) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { switch (nodes[0].getToken()) { case PROPERTY_EX: //noinspect...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /** * This is an optimization for property express...
#fixed code public Object execute(Object ctx, Map tokens, TemplateRegistry registry) { synchronized (Runtime.getRuntime()) { if (nodes == null) { return new String(expression); } else if (nodes.length == 2) { /*...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static Class getClassReference(ParserContext ctx, TypeDescriptor tDescr) throws ClassNotFoundException { Class cls; if (ctx.hasImport(tDescr.className)) { cls = ctx.getImport(tDescr.className); if (tDescr.isArray()) { ...
#fixed code public static Class getClassReference(ParserContext ctx, TypeDescriptor tDescr) throws ClassNotFoundException { Class cls; if (ctx != null && ctx.hasImport(tDescr.className)) { cls = ctx.getImport(tDescr.className); if (tDescr.isArray()...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void sortXml() { newDocument = (Document) originalDocument.clone(); final Element rootElement = (Element) originalDocument.getRootElement().clone(); HierarchyWrapper rootWrapper = factory.createFromRootElement(rootElement); rootW...
#fixed code public void sortXml() { newDocument = (Document) originalDocument.clone(); final Element rootElement = (Element) originalDocument.getRootElement().clone(); HierarchyRootWrapper rootWrapper = factory.createFromRootElement(rootElement); rootWra...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public HmilyParticipant preTryParticipant(final HmilyTransactionContext context, final ProceedingJoinPoint point) { LogUtil.debug(LOGGER, "participant hmily tcc transaction start..:{}", context::toString); final HmilyParticipant hmilyParticipant = buildH...
#fixed code public HmilyParticipant preTryParticipant(final HmilyTransactionContext context, final ProceedingJoinPoint point) { LogUtil.debug(LOGGER, "participant hmily tcc transaction start..:{}", context::toString); final HmilyParticipant hmilyParticipant = buildHmilyPa...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public boolean revert(final HmilyParticipantUndo participantUndo) throws SQLRevertException { RevertSQLUnit revertSQLUnit = SQLImageMapperFactory.newInstance(participantUndo.getUndoInvocation()).cast(); DataSource dataSource = HmilyResource...
#fixed code @Override public boolean revert(final HmilyParticipantUndo participantUndo) throws SQLRevertException { try (Connection connection = HmilyResourceManager.get(participantUndo.getResourceId()).getTargetDataSource().getConnection()) { return doRevertInTra...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @SafeVarargs public static Type wrapInArrayTypes(Type type, List<ArrayBracketPair>... arrayBracketPairLists) { for (int i = arrayBracketPairLists.length - 1; i >= 0; i--) { final List<ArrayBracketPair> arrayBracketPairList = arrayBracketPairLists...
#fixed code @SafeVarargs public static Type wrapInArrayTypes(Type type, List<ArrayBracketPair>... arrayBracketPairLists) { for (int i = arrayBracketPairLists.length - 1; i >= 0; i--) { final List<ArrayBracketPair> arrayBracketPairList = arrayBracketPairLists[i]; ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public Optional<MethodUsage> solveMethodAsUsage(String name, List<TypeUsage> parameterTypes, TypeSolver typeSolver, Context invokationContext, List<TypeUsage> typeParameterValues) { List<MethodUsage> methods = new ArrayList<>(); for (Method...
#fixed code @Override public Optional<MethodUsage> solveMethodAsUsage(String name, List<TypeUsage> parameterTypes, TypeSolver typeSolver, Context invokationContext, List<TypeUsage> typeParameterValues) { List<MethodUsage> methods = new ArrayList<>(); for (Method metho...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test void resolveFieldOfEnumAsInternalClassOfInterfaceUnqualifiedSamePackage() throws IOException { File src = new File("src/test/resources/internalClassInInterface"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + ...
#fixed code @Test void resolveFieldOfEnumAsInternalClassOfInterfaceUnqualifiedSamePackage() throws IOException { File src = new File("src/test/resources/internalClassInInterface"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "bar" ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public Optional<MethodUsage> solveMethodAsUsage(String name, List<TypeUsage> parameterTypes, TypeSolver typeSolver) { // TODO consider call of static methods if (wrappedNode.getScope() != null) { try { TypeUsage ...
#fixed code @Override public Optional<MethodUsage> solveMethodAsUsage(String name, List<TypeUsage> parameterTypes, TypeSolver typeSolver) { // TODO consider call of static methods if (wrappedNode.getScope() != null) { try { TypeUsage typeOf...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public SymbolReference<? extends ValueDeclaration> solveSymbol(String name, TypeSolver typeSolver) { return JavaParserFactory.getContext(wrappedNode.getParentNode()).solveSymbol(name, typeSolver); } #location 3 ...
#fixed code @Override public SymbolReference<? extends ValueDeclaration> solveSymbol(String name, TypeSolver typeSolver) { return getParent().solveSymbol(name, typeSolver); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public CommentsCollection parse(final InputStream in, final String encoding) throws IOException, UnsupportedEncodingException { boolean lastWasASlashR = false; BufferedReader br = new BufferedReader(new InputStreamReader(in)); CommentsCollection ...
#fixed code public CommentsCollection parse(final InputStream in, final String encoding) throws IOException, UnsupportedEncodingException { boolean lastWasASlashR = false; BufferedReader br = new BufferedReader(new InputStreamReader(in)); CommentsCollection commen...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public SymbolReference<MethodDeclaration> solveMethod(String name, List<TypeUsage> parameterTypes, TypeSolver typeSolver) { List<MethodDeclaration> methods = new ArrayList<>(); for (Method method : Arrays.stream(clazz.getDeclaredMethods())....
#fixed code @Override public SymbolReference<MethodDeclaration> solveMethod(String name, List<TypeUsage> parameterTypes, TypeSolver typeSolver) { List<MethodDeclaration> methods = new ArrayList<>(); for (Method method : Arrays.stream(clazz.getDeclaredMethods()).filter...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public ParseResult<CompilationUnit> tryToParse(String startPackage, String filename, ParserConfiguration configuration) throws IOException { assertNotNull(startPackage); assertNotNull(filename); final Path relativePath = fileInPackageRelativePath...
#fixed code public ParseResult<CompilationUnit> tryToParse(String startPackage, String filename, ParserConfiguration configuration) throws IOException { assertNotNull(startPackage); assertNotNull(filename); final Path relativePath = fileInPackageRelativePath(start...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test void resolveFieldOfEnumAsInternalClassOfClassQualifiedDifferentPackage() throws IOException { File src = new File("src/test/resources/enumLiteralsInAnnotatedClass"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separator...
#fixed code @Test void resolveFieldOfEnumAsInternalClassOfClassQualifiedDifferentPackage() throws IOException { File src = new File("src/test/resources/enumLiteralsInAnnotatedClass"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "ba...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void parse(String fileName) throws IOException { Path sourceFile = properSrc.resolve( fileName + ".java"); SourceFileInfoExtractor sourceFileInfoExtractor = getSourceFileInfoExtractor(); OutputStream outErrStream = new ByteArrayOutputStre...
#fixed code private void parse(String fileName) throws IOException { Path sourceFile = properSrc.resolve( fileName + ".java"); SourceFileInfoExtractor sourceFileInfoExtractor = getSourceFileInfoExtractor(); OutputStream outErrStream = new ByteArrayOutputStream(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test void resolveFieldOfEnumAsInternalClassOfClassQualifiedDifferentPackage() throws IOException { File src = new File("src/test/resources/enumLiteralsInAnnotatedClass"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separator...
#fixed code @Test void resolveFieldOfEnumAsInternalClassOfClassQualifiedDifferentPackage() throws IOException { File src = new File("src/test/resources/enumLiteralsInAnnotatedClass"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "ba...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test void resolveFieldOfEnumAsInternalClassOfClassQualifiedDifferentPackage() throws IOException { File src = new File("src/test/resources/enumLiteralsInAnnotatedClass"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separator...
#fixed code @Test void resolveFieldOfEnumAsInternalClassOfClassQualifiedDifferentPackage() throws IOException { File src = new File("src/test/resources/enumLiteralsInAnnotatedClass"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "ba...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test void resolveFieldOfEnumAsInternalClassOfInterfaceUnqualifiedDifferentPackage() throws IOException { File src = new File("src/test/resources/internalClassInInterface"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separat...
#fixed code @Test void resolveFieldOfEnumAsInternalClassOfInterfaceUnqualifiedDifferentPackage() throws IOException { File src = new File("src/test/resources/internalClassInInterface"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private TypeUsage getTypeConcrete(Node node, boolean solveLambdas) { if (node == null) throw new IllegalArgumentException(); if (node instanceof NameExpr) { NameExpr nameExpr = (NameExpr) node; logger.finest("getType on name expr ...
#fixed code private TypeUsage getTypeConcrete(Node node, boolean solveLambdas) { if (node == null) throw new IllegalArgumentException(); if (node instanceof NameExpr) { NameExpr nameExpr = (NameExpr) node; logger.finest("getType on name expr " + no...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test void resolveFieldOfEnumAsInternalClassOfInterfaceQualifiedSamePackage() throws IOException { File src = new File("src/test/resources/internalClassInInterface"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "b...
#fixed code @Test void resolveFieldOfEnumAsInternalClassOfInterfaceQualifiedSamePackage() throws IOException { File src = new File("src/test/resources/internalClassInInterface"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "bar" ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public List<ReferenceTypeUsage> getAllAncestors() { List<ReferenceTypeUsage> ancestors = new LinkedList<>(); if (getSuperClass(typeSolver) != null) { ReferenceTypeUsage superClass = getSuperClass(typeSolver); ancesto...
#fixed code @Override public List<ReferenceTypeUsage> getAllAncestors() { List<ReferenceTypeUsage> ancestors = new LinkedList<>(); if (getSuperClass() != null) { ReferenceTypeUsage superClass = getSuperClass(); ancestors.add(superClass); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public Type getType() { if (wrappedNode instanceof Parameter) { Parameter parameter = (Parameter) wrappedNode; if (wrappedNode.getParentNode() instanceof LambdaExpr) { int pos = getParamPos(parameter); ...
#fixed code @Override public Type getType() { if (wrappedNode instanceof Parameter) { Parameter parameter = (Parameter) wrappedNode; if (getParentNode(wrappedNode) instanceof LambdaExpr) { int pos = getParamPos(parameter); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private FileVisitResult callback(Path absolutePath, ParserConfiguration configuration, Callback callback) throws IOException { Path localPath = root.relativize(absolutePath); Log.trace("Parsing %s", () -> localPath); ParseResult<CompilationUnit> ...
#fixed code private FileVisitResult callback(Path absolutePath, ParserConfiguration configuration, Callback callback) throws IOException { Path localPath = root.relativize(absolutePath); Log.trace("Parsing %s", () -> localPath); ParseResult<CompilationUnit> result...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public CommentsCollection parse(final InputStream in, final String charsetName) throws IOException, UnsupportedEncodingException { boolean lastWasASlashR = false; BufferedReader br = new BufferedReader(new InputStreamReader(in, charsetName)); Com...
#fixed code public CommentsCollection parse(final InputStream in, final String charsetName) throws IOException { return parse(new InputStreamReader(in, charsetName)); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test void resolveFieldOfEnumAsInternalClassOfInterfaceUnqualifiedSamePackage() throws IOException { File src = new File("src/test/resources/internalClassInInterface"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + ...
#fixed code @Test void resolveFieldOfEnumAsInternalClassOfInterfaceUnqualifiedSamePackage() throws IOException { File src = new File("src/test/resources/internalClassInInterface"); File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "bar" ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public List<ResolvedConstructorDeclaration> getConstructors() { List<ResolvedConstructorDeclaration> declared = new LinkedList<>(); for (BodyDeclaration<?> member : wrappedNode.getMembers()) { if (member instanceof com.github.ja...
#fixed code @Override public List<ResolvedConstructorDeclaration> getConstructors() { return AstResolutionUtils.getConstructors(this.wrappedNode, typeSolver, this); }
Below is the vulnerable code, please generate the patch based on the following information.