output stringlengths 64 73.2k | input stringlengths 208 73.3k | instruction stringclasses 1
value |
|---|---|---|
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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.
*/
... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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.... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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(']'))
... | #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)
... | Below is the vulnerable code, please generate the patch based on the following information. |
#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();
... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public CompiledExpression _compile() {
ASTNode tk;
ASTNode tkOp;
ASTNode tkOp2;
ASTNode tkLA;
ASTNode tkLA2;
ASTLinkedList astLinkedList = new ASTLinkedList();
boolean firstLA;
pCtx = getParserContext();
... | #vulnerable 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. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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++ ... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #vulnerable code
public Object getReducedValue(Object ctx, Object thisValue, VariableResolverFactory factory) {
return ~((Integer) MVEL.eval(name, ctx, factory));
}
#location 2
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#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.... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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(... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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 ("... | #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
... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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 : " ... | #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 ... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected boolean hasImport(String name) {
if (pCtx == null) pCtx = getParserContext();
if (pCtx.hasImport(name)) {
return true;
}
else {
VariableResolverFactory vrf = findClassImportResolverFactory(variableFactory);
... | #vulnerable code
protected boolean hasImport(String name) {
if (getParserContext().hasImport(name)) {
return true;
}
else {
VariableResolverFactory vrf = findClassImportResolverFactory(variableFactory);
return vrf != null && vr... | Below is the vulnerable code, please generate the patch based on the following information. |
#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(']'))
... | #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)
... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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));... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #vulnerable code
protected Class getImport(String name) {
if (getParserContext().hasImport(name)) return getParserContext().getImport(name);
VariableResolverFactory vrf = findClassImportResolverFactory(variableFactory);
return (Class) vrf.getVariableResolver(nam... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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,... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public CompiledExpression compile() {
ASTNode tk;
ASTNode tkOp;
ASTNode tkOp2;
ASTNode tkLA;
ASTNode tkLA2;
ASTLinkedList astLinkedList = new ASTLinkedList();
boolean firstLA;
ParserContext pCtx = getParserCont... | #vulnerable code
public CompiledExpression compile() {
ASTNode tk;
ASTNode tkOp;
ASTNode tkOp2;
ASTNode tkLA;
ASTNode tkLA2;
ASTLinkedList astLinkedList = new ASTLinkedList();
boolean firstLA;
ParserContext pCtx = getPars... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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(... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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.... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#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.... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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(']'))
... | #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)
... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #vulnerable code
public CompiledExpression _compile() {
ASTNode tk;
ASTNode tkOp;
ASTNode tkOp2;
ASTNode tkLA;
ASTNode tkLA2;
ASTLinkedList astBuild = new ASTLinkedList();
boolean firstLA;
debugSymbols = (pCtx = getPars... | Below is the vulnerable code, please generate the patch based on the following information. |
#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.... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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 : " ... | #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 ... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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) {
/*... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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()... | #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()) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void sortXml() {
newDocument = (Document) originalDocument.clone();
final Element rootElement = (Element) originalDocument.getRootElement().clone();
HierarchyRootWrapper rootWrapper = factory.createFromRootElement(rootElement);
rootWra... | #vulnerable code
public void sortXml() {
newDocument = (Document) originalDocument.clone();
final Element rootElement = (Element) originalDocument.getRootElement().clone();
HierarchyWrapper rootWrapper = factory.createFromRootElement(rootElement);
rootW... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public boolean revert(final HmilyParticipantUndo participantUndo) throws SQLRevertException {
try (Connection connection = HmilyResourceManager.get(participantUndo.getResourceId()).getTargetDataSource().getConnection()) {
return doRevertInTra... | #vulnerable code
@Override
public boolean revert(final HmilyParticipantUndo participantUndo) throws SQLRevertException {
RevertSQLUnit revertSQLUnit = SQLImageMapperFactory.newInstance(participantUndo.getUndoInvocation()).cast();
DataSource dataSource = HmilyResource... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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 ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public SymbolReference<? extends ValueDeclaration> solveSymbol(String name, TypeSolver typeSolver) {
return getParent().solveSymbol(name, typeSolver);
} | #vulnerable code
@Override
public SymbolReference<? extends ValueDeclaration> solveSymbol(String name, TypeSolver typeSolver) {
return JavaParserFactory.getContext(wrappedNode.getParentNode()).solveSymbol(name, typeSolver);
}
#location 3
... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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 ... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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()).... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public ParseResult<CompilationUnit> tryToParse(String startPackage, String filename, ParserConfiguration configuration) throws IOException {
assertNotNull(startPackage);
assertNotNull(filename);
final Path relativePath = fileInPackageRelativePath(start... | #vulnerable code
public ParseResult<CompilationUnit> tryToParse(String startPackage, String filename, ParserConfiguration configuration) throws IOException {
assertNotNull(startPackage);
assertNotNull(filename);
final Path relativePath = fileInPackageRelativePath... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void parse(String fileName) throws IOException {
Path sourceFile = properSrc.resolve( fileName + ".java");
SourceFileInfoExtractor sourceFileInfoExtractor = getSourceFileInfoExtractor();
OutputStream outErrStream = new ByteArrayOutputStream();
... | #vulnerable code
private void parse(String fileName) throws IOException {
Path sourceFile = properSrc.resolve( fileName + ".java");
SourceFileInfoExtractor sourceFileInfoExtractor = getSourceFileInfoExtractor();
OutputStream outErrStream = new ByteArrayOutputStre... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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 + "... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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 ... | Below is the vulnerable code, please generate the patch based on the following information. |
#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"
... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public List<ReferenceTypeUsage> getAllAncestors() {
List<ReferenceTypeUsage> ancestors = new LinkedList<>();
if (getSuperClass() != null) {
ReferenceTypeUsage superClass = getSuperClass();
ancestors.add(superClass);
... | #vulnerable code
@Override
public List<ReferenceTypeUsage> getAllAncestors() {
List<ReferenceTypeUsage> ancestors = new LinkedList<>();
if (getSuperClass(typeSolver) != null) {
ReferenceTypeUsage superClass = getSuperClass(typeSolver);
ancesto... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public Type getType() {
if (wrappedNode instanceof Parameter) {
Parameter parameter = (Parameter) wrappedNode;
if (getParentNode(wrappedNode) instanceof LambdaExpr) {
int pos = getParamPos(parameter);
... | #vulnerable code
@Override
public Type getType() {
if (wrappedNode instanceof Parameter) {
Parameter parameter = (Parameter) wrappedNode;
if (wrappedNode.getParentNode() instanceof LambdaExpr) {
int pos = getParamPos(parameter);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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> ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public CommentsCollection parse(final InputStream in, final String charsetName) throws IOException {
return parse(new InputStreamReader(in, charsetName));
} | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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"
... | #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 + ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public List<ResolvedConstructorDeclaration> getConstructors() {
return AstResolutionUtils.getConstructors(this.wrappedNode, typeSolver, this);
} | #vulnerable code
@Override
public List<ResolvedConstructorDeclaration> getConstructors() {
List<ResolvedConstructorDeclaration> declared = new LinkedList<>();
for (BodyDeclaration<?> member : wrappedNode.getMembers()) {
if (member instanceof com.github.ja... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
public Integer visit(final ConstructorDeclaration n, final Void arg) {
return (n.getBody().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(this, ... | #vulnerable code
@Generated("com.github.javaparser.generator.core.visitor.HashCodeVisitorGenerator")
public Integer visit(final ConstructorDeclaration n, final Void arg) {
return (n.getBody().accept(this, arg)) * 31 + (n.getModifiers().hashCode()) * 31 + (n.getName().accept(... | Below is the vulnerable code, please generate the patch based on the following information. |
#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"
... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#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 + "... | #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... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public SymbolReference<TypeDeclaration> solveType(String name, TypeSolver typeSolver) {
return JavaParserFactory.getContext(getParentNode(wrappedNode), typeSolver).solveType(name, typeSolver);
} | #vulnerable code
@Override
public SymbolReference<TypeDeclaration> solveType(String name, TypeSolver typeSolver) {
return JavaParserFactory.getContext(wrappedNode.getParentNode(), typeSolver).solveType(name, typeSolver);
}
#location 3
... | Below is the vulnerable code, please generate the patch based on the following information. |
#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... | #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 ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public SymbolReference<ResolvedTypeDeclaration> solveType(String name, TypeSolver typeSolver) {
if (wrappedNode.getTypes() != null) {
for (TypeDeclaration<?> type : wrappedNode.getTypes()) {
if (type.getName().getId().equals(n... | #vulnerable code
@Override
public SymbolReference<ResolvedTypeDeclaration> solveType(String name, TypeSolver typeSolver) {
if (wrappedNode.getTypes() != null) {
for (TypeDeclaration<?> type : wrappedNode.getTypes()) {
if (type.getName().getId().eq... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
void resolveFieldOfEnumAsInternalClassOfInterfaceQualifiedDifferentPackage() throws IOException {
File src = new File("src/test/resources/internalClassInInterface");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "ba... | #vulnerable code
@Test
void resolveFieldOfEnumAsInternalClassOfInterfaceQualifiedDifferentPackage() 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. |
#fixed code
public void saveAll() throws FileNotFoundException, UnsupportedEncodingException {
saveAll(root);
} | #vulnerable code
public void saveAll() throws FileNotFoundException, UnsupportedEncodingException {
for (CompilationUnit cu : compilationUnits) {
Path filename = cu.getData(ORIGINAL_LOCATION);
System.out.println("Saving " + filename);
filename... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
void resolveFieldOfEnumAsInternalClassOfClassUnqualifiedSamePackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "bar"
... | #vulnerable code
@Test
void resolveFieldOfEnumAsInternalClassOfClassUnqualifiedSamePackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
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. |
#fixed code
@Override
public SymbolReference<MethodDeclaration> solveMethod(String name, List<Type> parameterTypes) {
Context ctx = getContext();
return ctx.solveMethod(name, parameterTypes, typeSolver);
} | #vulnerable code
@Override
public SymbolReference<MethodDeclaration> solveMethod(String name, List<Type> parameterTypes) {
return getContext().solveMethod(name, parameterTypes, typeSolver());
}
#location 3
#vulnerability type NU... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void solveMethodCalls(Path path) throws IOException {
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (file... | #vulnerable code
public void solveMethodCalls(Path path) throws IOException {
File file = path.toFile();
if (file.isDirectory()) {
for (File f : file.listFiles()) {
solveMethodCalls(f.toPath());
}
} else {
if (f... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
void resolveFieldOfEnumAsInternalClassOfClassQualifiedSamePackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "bar"
... | #vulnerable code
@Test
void resolveFieldOfEnumAsInternalClassOfClassQualifiedSamePackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "b... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public Type getType() {
if (wrappedNode instanceof Parameter) {
Parameter parameter = (Parameter) wrappedNode;
if (getParentNode(wrappedNode) instanceof LambdaExpr) {
int pos = getParamPos(parameter);
... | #vulnerable code
@Override
public Type getType() {
if (wrappedNode instanceof Parameter) {
Parameter parameter = (Parameter) wrappedNode;
if (wrappedNode.getParentNode() instanceof LambdaExpr) {
int pos = getParamPos(parameter);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public List<ReferenceTypeUsage> getAllAncestors() {
List<ReferenceTypeUsage> ancestors = new LinkedList<>();
if (getSuperClass(typeSolver) != null) {
ReferenceTypeUsage superClass = getSuperClass(typeSolver);
ancestors.add... | #vulnerable code
@Override
public List<ReferenceTypeUsage> getAllAncestors() {
List<ReferenceTypeUsage> ancestors = new LinkedList<>();
if (getSuperClass(typeSolver) != null) {
ancestors.add(new ReferenceTypeUsage(getSuperClass(typeSolver), typeSolver));
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void parse(String fileName) throws IOException {
Path sourceFile = properSrc.resolve( fileName + ".java");
SourceFileInfoExtractor sourceFileInfoExtractor = getSourceFileInfoExtractor();
OutputStream outErrStream = new ByteArrayOutputStream();
... | #vulnerable code
private void parse(String fileName) throws IOException {
Path sourceFile = properSrc.resolve( fileName + ".java");
SourceFileInfoExtractor sourceFileInfoExtractor = getSourceFileInfoExtractor();
OutputStream outErrStream = new ByteArrayOutputStre... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
void resolveFieldOfEnumAsInternalClassOfInterfaceQualifiedDifferentPackage() throws IOException {
File src = new File("src/test/resources/internalClassInInterface");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "ba... | #vulnerable code
@Test
void resolveFieldOfEnumAsInternalClassOfInterfaceQualifiedDifferentPackage() 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. |
#fixed code
@Test
void resolveFieldOfEnumAsInternalClassOfClassUnqualifiedDifferentPackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "... | #vulnerable code
@Test
void resolveFieldOfEnumAsInternalClassOfClassUnqualifiedDifferentPackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separat... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public Optional<Value> solveSymbolAsValue(String name, TypeSolver typeSolver) {
return getParent().solveSymbolAsValue(name, typeSolver);
} | #vulnerable code
@Override
public Optional<Value> solveSymbolAsValue(String name, TypeSolver typeSolver) {
return JavaParserFactory.getContext(wrappedNode.getParentNode()).solveSymbolAsValue(name, typeSolver);
}
#location 3
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public SymbolReference<? extends ValueDeclaration> solveSymbol(String name, TypeSolver typeSolver) {
if (wrappedNode.getFieldExpr().toString().equals(name)) {
if (wrappedNode.getScope() instanceof ThisExpr) {
Type typeOfThis =... | #vulnerable code
@Override
public SymbolReference<? extends ValueDeclaration> solveSymbol(String name, TypeSolver typeSolver) {
if (wrappedNode.getFieldExpr().toString().equals(name)) {
if (wrappedNode.getScope() instanceof ThisExpr) {
Type typeOf... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Optional<Value> solveSymbolAsValue(String name, Node node) {
Context context = JavaParserFactory.getContext(node);
return solveSymbolAsValue(name, context);
} | #vulnerable code
public Optional<Value> solveSymbolAsValue(String name, Node node) {
return solveSymbolAsValue(name, JavaParserFactory.getContext(node));
}
#location 2
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#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"
... | #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 + ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
void resolveFieldOfEnumAsInternalClassOfClassQualifiedSamePackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "bar"
... | #vulnerable code
@Test
void resolveFieldOfEnumAsInternalClassOfClassQualifiedSamePackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "b... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
void resolveFieldOfEnumAsInternalClassOfClassUnqualifiedDifferentPackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "... | #vulnerable code
@Test
void resolveFieldOfEnumAsInternalClassOfClassUnqualifiedDifferentPackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separat... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
void resolveFieldOfEnumAsInternalClassOfClassUnqualifiedDifferentPackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "... | #vulnerable code
@Test
void resolveFieldOfEnumAsInternalClassOfClassUnqualifiedDifferentPackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separat... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
void resolveFieldOfEnumAsInternalClassOfClassUnqualifiedSamePackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
File aClass = new File(src.getPath() + File.separator + "foo" + File.separator + "bar"
... | #vulnerable code
@Test
void resolveFieldOfEnumAsInternalClassOfClassUnqualifiedSamePackage() throws IOException {
File src = new File("src/test/resources/enumLiteralsInAnnotatedClass");
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. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.