input stringlengths 205 73.3k | output stringlengths 64 73.2k | instruction stringclasses 1
value |
|---|---|---|
#vulnerable code
@Override public void consistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
for (IntVar e : x)
if (e.min() == 1)
numberOnes++;
else if (e.max() != 0)
... | #fixed code
@Override public void consistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
int numberZeros = 0;
for (IntVar e : x) {
if (e.min() == 1)
numberOnes++;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override public ArrayList<Constraint> decompose(Store store) {
if (constraints != null)
return constraints;
IntDomain setComplement = new IntervalDomain();
for (IntVar var : list)
setComplement.addDom(var.domain);
... | #fixed code
@Override public ArrayList<Constraint> decompose(Store store) {
if (constraints != null)
return constraints;
IntDomain setComplement = new IntervalDomain();
for (IntVar var : list)
setComplement.addDom(var.domain);
set... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Parameterized.Parameters
public static Collection<String> parametricTest() throws IOException {
FileReader file = new FileReader(relativePath + timeCategory + listFileName);
BufferedReader br = new BufferedReader(file);
String line = "";
... | #fixed code
@Parameterized.Parameters
public static Collection<String> parametricTest() throws IOException {
return fileReader(timeCategory);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void prepareVizHeader() {
PrintWriter printWriter;
try {
printWriter = new PrintWriter(new FileOutputStream(visFilename));
} catch (FileNotFoundException e) {
e.printStackTrace();
printWriter = new PrintWrite... | #fixed code
void prepareTreeHeader() {
OutputStreamWriter printWriter;
try {
printWriter = new OutputStreamWriter(
new FileOutputStream(treeFilename),
Charset.forName("UTF-8").newEncoder()
);
} catch (FileN... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void run_sequence_search(int solveKind, SimpleNode kind, SearchItem si) {
singleSearch = false;
//kind.dump("");
this.si = si;
if (options.getVerbose()) {
String solve = "notKnown";
switch (solveKind) {
... | #fixed code
ArrayList<SearchItem> parseSearchAnnotations(ArrayList<SearchItem> search_seq) {
ArrayList<SearchItem> ns = new ArrayList<SearchItem>();
for (SearchItem s : search_seq)
if (s.search_type.equals("restart_none"))
continue;
else if (s.search_type.equals("restart_... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override public void notConsistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
for (IntVar e : x)
if (e.min() == 1)
numberOnes++;
else if (e.max() != 0)
... | #fixed code
@Override public void notConsistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
int numberZeros = 0;
for (IntVar e : x) {
if (e.min() == 1)
numberOnes++;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static String[] readFile(String file) {
ArrayList<String> result = new ArrayList<String>();
System.out.println("readFile(" + file + ")");
try {
BufferedReader inr = new BufferedReader(new FileReader(file));
Stri... | #fixed code
public static String[] readFile(String file) {
ArrayList<String> result = new ArrayList<String>();
System.out.println("readFile(" + file + ")");
try {
BufferedReader inr = new BufferedReader(new InputStreamReader(new FileInp... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override public void notConsistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
for (IntVar e : x)
if (e.min() == 1)
numberOnes++;
else if (e.max() != 0)
... | #fixed code
@Override public void notConsistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
int numberZeros = 0;
for (IntVar e : x) {
if (e.min() == 1)
numberOnes++;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public int countWatches() {
if (watchedConstraints == null)
return 0;
int count = 0;
for (Var v : watchedConstraints.keySet())
count += watchedConstraints.get(v).size();
return count;
}
... | #fixed code
public int countWatches() {
if (watchedConstraints == null)
return 0;
int count = 0;
for (HashSet<Constraint> c : watchedConstraints.values())
count += c.size();
return count;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public FloatVar[] getVariableFloatArray(String ident) {
FloatVar[] a = variableFloatArrayTable.get(ident);
if (a == null) {
double[] floatA = floatArrayTable.get(ident);
a = new FloatVar[floatA.length];
for (int i = 0;... | #fixed code
public FloatVar[] getVariableFloatArray(String ident) {
FloatVar[] a = variableFloatArrayTable.get(ident);
if (a == null) {
double[] floatA = floatArrayTable.get(ident);
if (floatA != null) {
a = new FloatVar[floatA.length];
for (int i = 0... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override public void consistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
for (IntVar e : x)
if (e.min() == 1)
numberOnes++;
else if (e.max() != 0)
... | #fixed code
@Override public void consistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
int numberZeros = 0;
for (IntVar e : x) {
if (e.min() == 1)
numberOnes++;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override public void notConsistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
for (IntVar e : x)
if (e.min() == 1)
numberOnes++;
else if (e.max() != 0)
... | #fixed code
@Override public void notConsistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
int numberZeros = 0;
for (IntVar e : x) {
if (e.min() == 1)
numberOnes++;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void readDictionaryFromFile(String file, List<Integer> wordSizes) {
for (int wordSize : wordSizes) {
int wordCount = 0;
IntVar[] list = new IntVar[wordSize];
for (int i = 0; i < wordSize; i++)
list[i]... | #fixed code
public void readDictionaryFromFile(String file, List<Integer> wordSizes) {
for (int wordSize : wordSizes) {
int wordCount = 0;
IntVar[] list = new IntVar[wordSize];
for (int i = 0; i < wordSize; i++)
list[i] = bla... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override public ArrayList<Constraint> decompose(Store store) {
if (constraints != null)
return constraints;
IntDomain setComplement = new IntervalDomain();
for (IntVar var : list)
setComplement.addDom(var.domain);
... | #fixed code
@Override public ArrayList<Constraint> decompose(Store store) {
if (constraints != null)
return constraints;
IntDomain setComplement = new IntervalDomain();
for (IntVar var : list)
setComplement.addDom(var.domain);
set... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Parameterized.Parameters
public static Collection<String> parametricTest() throws IOException {
FileReader file = new FileReader(relativePath + timeCategory + listFileName);
BufferedReader br = new BufferedReader(file);
String line = "";
... | #fixed code
@Parameterized.Parameters
public static Collection<String> parametricTest() throws IOException {
return fileReader(timeCategory);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void filterDomains() {
for (int i = 0; i < x.length; i++) {
int xIndex = varMap.get(x[i]);
Map<Integer,long[]> xSupport = supports[xIndex];
ValueEnumeration e = x[i].dom().valueEnumeration();
while (e.hasMoreElements()) {
int el = e.nextElement()... | #fixed code
void init() {
int n = tuple.length;
rbs = new ReversibleSparseBitSet(store, x, tuple);
makeSupport();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override public void consistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
for (IntVar e : x)
if (e.min() == 1)
numberOnes++;
else if (e.max() != 0)
... | #fixed code
@Override public void consistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
int numberZeros = 0;
for (IntVar e : x) {
if (e.min() == 1)
numberOnes++;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void prepareTreeHeader() {
PrintWriter printWriter;
try {
printWriter = new PrintWriter(new FileOutputStream(treeFilename));
} catch (FileNotFoundException e) {
e.printStackTrace();
printWriter = new PrintWri... | #fixed code
void prepareTreeHeader() {
OutputStreamWriter printWriter;
try {
printWriter = new OutputStreamWriter(
new FileOutputStream(treeFilename),
Charset.forName("UTF-8").newEncoder()
);
} catch (FileN... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void updateTable(HashSet<IntVar> fdvs) {
for (IntVar v : fdvs) {
// recent pruning
IntDomain cd = v.dom();
IntDomain pd = cd.previousDomain();
IntDomain rp;
int delta;
if (pd == null) {
... | #fixed code
void init() {
int n = tuple.length;
int lastWordSize = n % 64;
int numberBitSets = n / 64 + ((lastWordSize != 0) ? 1 : 0);
rbs = new ReversibleSparseBitSet();
long[] words = makeSupportAndWords(numberBitSets);
rbs.init(store... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Parameterized.Parameters
public static Collection<String> parametricTest() throws IOException {
FileReader file = new FileReader(relativePath + timeCategory + listFileName);
BufferedReader br = new BufferedReader(file);
String line = "";
... | #fixed code
@Parameterized.Parameters
public static Collection<String> parametricTest() throws IOException {
return fileReader(timeCategory);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void readFile(String file) {
System.out.println("readFile(" + file + ")");
try {
BufferedReader inr = new BufferedReader(new FileReader(file));
String str;
int lineCount = 0;
ArrayList<ArrayList<I... | #fixed code
public void readFile(String file) {
System.out.println("readFile(" + file + ")");
try {
BufferedReader inr = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
String str;
int lineC... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public HashSet<Constraint> getConstraints() {
HashSet<Constraint> constraints = new HashSet<Constraint>();
Set<String> ids = variablesHashMap.keySet();
for (String s : ids) {
Domain d = variablesHashMap.get(s).dom();
Arr... | #fixed code
public HashSet<Constraint> getConstraints() {
HashSet<Constraint> constraints = new HashSet<Constraint>();
for (Var v : variablesHashMap.values()) {
Domain d = v.dom();
ArrayList<Constraint> c = d.constraints();
constraint... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Parameterized.Parameters
public static Collection<String> parametricTest() throws IOException {
FileReader file = new FileReader(relativePath + timeCategory + listFileName);
BufferedReader br = new BufferedReader(file);
String line = "";
... | #fixed code
@Parameterized.Parameters
public static Collection<String> parametricTest() throws IOException {
return fileReader(timeCategory);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void saveLatexToFile(String desc) {
String fileName = this.latexFile + (calls++) + ".tex";
File f = new File(fileName);
FileOutputStream fs;
try {
System.out.println("save latex file " + fileName);
fs = new ... | #fixed code
public void saveLatexToFile(String desc) {
String fileName = this.latexFile + (calls++) + ".tex";
File f = new File(fileName);
try(FileOutputStream fs = new FileOutputStream(f)) {
System.out.println("save latex file " + fileName);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static int[][] readFile(String file) {
int[][] problem = null; // The problem matrix
int r = 0;
int c = 0;
System.out.println("readFile(" + file + ")");
int lineCount = 0;
try {
BufferedReader inr = ... | #fixed code
public static int[][] readFile(String file) {
int[][] problem = null; // The problem matrix
int r = 0;
int c = 0;
System.out.println("readFile(" + file + ")");
int lineCount = 0;
try(BufferedReader inr = new BufferedReader(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void uppendToLatexFile(String desc, String fileName) {
try {
System.out.println("save latex file " + fileName);
OutputStreamWriter char_output = new OutputStreamWriter(
new FileOutputStream(fileName),
... | #fixed code
public void uppendToLatexFile(String desc, String fileName) {
try(OutputStreamWriter char_output = new OutputStreamWriter(new FileOutputStream(fileName),
Charset.forName("UTF-8").newEncoder());
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void saveLatexToFile(String desc) {
String fileName = this.latexFile + (calls++) + ".tex";
File f = new File(fileName);
FileOutputStream fs;
try {
System.out.println("save latex file " + fileName);
fs = new ... | #fixed code
public void saveLatexToFile(String desc) {
String fileName = this.latexFile + (calls++) + ".tex";
File f = new File(fileName);
try(FileOutputStream fs = new FileOutputStream(f)) {
System.out.println("save latex file " + fileName);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static int[][] readFile(String file) {
int[][] problem = null; // The problem matrix
int r = 0;
int c = 0;
System.out.println("readFile(" + file + ")");
int lineCount = 0;
try {
BufferedReader inr = ... | #fixed code
public static int[][] readFile(String file) {
int[][] problem = null; // The problem matrix
int r = 0;
int c = 0;
System.out.println("readFile(" + file + ")");
int lineCount = 0;
try(BufferedReader inr = new BufferedReader(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
int estimatePruningRecursive(IntVar xVar, Integer v, List<IntVar> exploredX, List<Integer> exploredV) {
if (exploredX.contains(xVar))
return 0;
exploredX.add(xVar);
exploredV.add(v);
int pruning = 0;
IntDomain xDom... | #fixed code
int estimatePruning(IntVar x, Integer v) {
List<IntVar> exploredX = new ArrayList<IntVar>();
List<Integer> exploredV = new ArrayList<Integer>();
int pruning = estimatePruningRecursive(x, v, exploredX, exploredV);
SimpleArrayList<IntVar> curr... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override public void notConsistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
for (IntVar e : x)
if (e.min() == 1)
numberOnes++;
else if (e.max() != 0)
... | #fixed code
@Override public void notConsistency(final Store store) {
IntVar nonGround = null;
int numberOnes = 0;
int numberZeros = 0;
for (IntVar e : x) {
if (e.min() == 1)
numberOnes++;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override public void model() {
if (filename != null) {
/* read from file args[0] */
try {
BufferedReader in = new BufferedReader(new FileReader(filename));
String str;
while ((str = in.readLin... | #fixed code
@Override public void model() {
if (filename != null) {
/* read from file args[0] */
try {
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF-8"));
String... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void readFromFile(String filename) {
String lines[] = new String[100];
int[] dimensions = new int[2];
/* read from file args[0] or qcp.txt */
try {
BufferedReader in = new BufferedReader(new FileReader(filename));
... | #fixed code
public void readFromFile(String filename) {
String lines[] = new String[100];
int[] dimensions = new int[2];
/* read from file args[0] or qcp.txt */
try {
BufferedReader in = new BufferedReader(new InputStreamReader(new Fi... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void float_comparison(int operation, SimpleNode node, int reifStart) {
// node.dump("");
ASTScalarFlatExpr p1 = (ASTScalarFlatExpr)node.jjtGetChild(0);
ASTScalarFlatExpr p2 = (ASTScalarFlatExpr)node.jjtGetChild(1);
boolean reified = false;
if (p.startsWith(... | #fixed code
void generateConstraints(SimpleNode constraintWithAnnotations, Tables table, Options opt) throws FailException {
this.opt = opt;
// if (!storeLevelIncreased) {
// System.out.println("1. Level="+store.level);
// store.setLevel(store.level + 1);
// storeLevel... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void readAuction(String filename) {
noGoods = 0;
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF-8"));
// the first line represents the input goods
Stri... | #fixed code
public void readAuction(String filename) {
noGoods = 0;
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF-8"));
// the first line represents the input goods
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void updateTable(HashSet<IntVar> fdvs) {
for (IntVar v : fdvs) {
// recent pruning
IntDomain cd = v.dom();
IntDomain pd = cd.previousDomain();
IntDomain rp;
int delta;
if (pd == null) {
... | #fixed code
boolean validTuple(int index) {
int[] t = tuple[index];
int n = t.length;
int i = 0;
while (i < n) {
if (!x[i].dom().contains(t[i]))
return false;
i++;
}
return true;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
StringInterner stringInterner() {
if (stringInterner == null)
stringInterner = new StringInterner(8 * 1024);
return stringInterner;
}
#location 3
#vulnerability type THREAD_SAFETY_... | #fixed code
AbstractBytes() {
this(new VanillaBytesMarshallerFactory(), new AtomicInteger(1));
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testSimpleLock() {
DirectBytes bytes = new DirectStore(64).createSlice();
bytes.writeLong(0, -1L);
assertFalse(bytes.tryLockLong(0));
bytes.writeLong(0, 0L);
assertTrue(bytes.tryLockLong(0));
long val... | #fixed code
@Test
public void testSimpleLock() {
DirectBytes bytes = new DirectStore(64).bytes();
bytes.writeLong(0, -1L);
assertFalse(bytes.tryLockLong(0));
bytes.writeLong(0, 0L);
assertTrue(bytes.tryLockLong(0));
long val1 = bytes.re... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testLocking() throws Exception {
// a page
long start = System.nanoTime();
final DirectStore store1 = DirectStore.allocate(1 << 12);
final int lockCount = 20 * 1000000;
Thread t = new Thread(new Runnable() {... | #fixed code
@Test
public void testLocking() {
// a page
long start = System.nanoTime();
final DirectStore store1 = DirectStore.allocate(1 << 12);
final int lockCount = 20 * 1000 * 1000;
new Thread(new Runnable() {
@Override
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String... args) throws IOException, InterruptedException {
boolean toggleTo = Boolean.parseBoolean(args[0]);
File tmpFile = new File(System.getProperty("java.io.tmpdir"), "lock-test.dat");
FileChannel fc = new RandomAccess... | #fixed code
public static void main(String... args) throws IOException, InterruptedException {
boolean toggleTo = Boolean.parseBoolean(args[0]);
File tmpFile = new File(System.getProperty("java.io.tmpdir"), "lock-test.dat");
FileChannel fc = new RandomAccessFile(t... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testLocking() throws Exception {
// a page
final DirectStore store1 = DirectStore.allocate(1 << 12);
final DirectStore store2 = DirectStore.allocate(1 << 12);
final int lockCount = 10 * 1000000;
Thread t = n... | #fixed code
@Test
public void testLocking() throws Exception {
// a page
long start = System.nanoTime();
final DirectStore store1 = DirectStore.allocate(1 << 12);
final int lockCount = 20 * 1000000;
Thread t = new Thread(new Runnable() {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testReadWrite() {
DirectStore ds = new DirectStore(null, 1024);
DirectBytes db = ds.createSlice();
RawCopier<A> aRawCopier = RawCopier.copies(A.class);
A a = new A();
a.i = 111;
a.j = -222;
a.... | #fixed code
@Test
public void testReadWrite() {
DirectStore ds = new DirectStore(null, 1024);
DirectBytes db = ds.bytes();
RawCopier<A> aRawCopier = RawCopier.copies(A.class);
A a = new A();
a.i = 111;
a.j = -222;
a.k = 333;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void manyToggles(DirectStore store1, int lockCount, int from, int to) {
long id = Thread.currentThread().getId();
assertEquals(0, id >>> 24);
System.out.println("Thread " + id);
DirectBytes slice1 = store1.createSlice();
... | #fixed code
private void manyToggles(DirectStore store1, int lockCount, int from, int to) {
long id = Thread.currentThread().getId();
assertEquals(0, id >>> 24);
System.out.println("Thread " + id);
DirectBytes slice1 = store1.createSlice();
int r... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testReadWrite() {
DirectStore ds = new DirectStore(null, 1024);
DirectBytes db = ds.createSlice();
RawCopier<A> aRawCopier = RawCopier.copies(A.class);
A a = new A();
a.i = 111;
a.j = -222;
a.... | #fixed code
@Test
public void testReadWrite() {
DirectStore ds = new DirectStore(null, 1024);
DirectBytes db = ds.bytes();
RawCopier<A> aRawCopier = RawCopier.copies(A.class);
A a = new A();
a.i = 111;
a.j = -222;
a.k = 333;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
@Ignore
public void benchmarkByteLargeArray() {
long length = 1L << 32;
long start = System.nanoTime();
DirectBytes array = DirectStore.allocateLazy(length).createSlice();
System.out.println("Constructor time: " + (System.na... | #fixed code
@Test
@Ignore
public void benchmarkByteLargeArray() {
long length = 1L << 32;
long start = System.nanoTime();
DirectBytes array = DirectStore.allocateLazy(length).bytes();
System.out.println("Constructor time: " + (System.nanoTime() - s... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testSimpleLock() {
DirectBytes bytes = new DirectStore(64).createSlice();
bytes.writeLong(0, -1L);
assertFalse(bytes.tryLockLong(0));
bytes.writeLong(0, 0L);
assertTrue(bytes.tryLockLong(0));
long val... | #fixed code
@Test
public void testSimpleLock() {
DirectBytes bytes = new DirectStore(64).bytes();
bytes.writeLong(0, -1L);
assertFalse(bytes.tryLockLong(0));
bytes.writeLong(0, 0L);
assertTrue(bytes.tryLockLong(0));
long val1 = bytes.re... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@NotNull
@Override
public String parseUtf8(@NotNull StopCharTester tester) {
StringBuilder utfReader = acquireStringBuilder();
parseUtf8(utfReader, tester);
return stringInterner().intern(utfReader);
}
#lo... | #fixed code
@NotNull
@Override
public String parseUtf8(@NotNull StopCharTester tester) {
StringBuilder utfReader = acquireStringBuilder();
parseUtf8(utfReader, tester);
return SI.intern(utfReader);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
StringInterner stringInterner() {
if (stringInterner == null)
stringInterner = new StringInterner(8 * 1024);
return stringInterner;
}
#location 4
#vulnerability type THREAD_SAFETY_... | #fixed code
AbstractBytes() {
this(new VanillaBytesMarshallerFactory(), new AtomicInteger(1));
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testAllocate() throws Exception {
long size = 1L << 24; // 31; don't overload cloud-bees
DirectStore store = DirectStore.allocate(size);
assertEquals(size, store.size());
DirectBytes slice = store.createSlice();
... | #fixed code
@Test
public void testAllocate() throws Exception {
long size = 1L << 24; // 31; don't overload cloud-bees
DirectStore store = DirectStore.allocate(size);
assertEquals(size, store.size());
DirectBytes slice = store.bytes();
slice.po... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testCreate() throws Exception {
File f1 = newTempraryFile("vmf-create-1");
File f2 = newTempraryFile("vmf-create-2");
VanillaMappedFile vmf1 = new VanillaMappedFile(f1,VanillaMappedMode.RW);
VanillaMappedFile vmf2 =... | #fixed code
@Test
public void testCreate() throws Exception {
File f1 = newTempraryFile("vmf-create-1");
File f2 = newTempraryFile("vmf-create-2");
VanillaMappedFile vmf1 = VanillaMappedFile.readWrite(f1);
VanillaMappedFile vmf2 = VanillaMappedFile.re... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testUnmap() throws IOException, InterruptedException {
String TMP = System.getProperty("java.io.tmpdir");
String basePath = TMP + "/testUnmap";
File file = new File(basePath);
File dir = file.getParentFile();
... | #fixed code
@Test
public void testUnmap() throws IOException, InterruptedException {
String TMP = System.getProperty("java.io.tmpdir");
String basePath = TMP + "/testUnmap";
File file = new File(basePath);
File dir = file.getParentFile();
long... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static void manyToggles(@NotNull DirectStore store1, int lockCount, int from, int to) {
long id = Thread.currentThread().getId();
assertEquals(0, id >>> 24);
System.out.println("Thread " + id);
DirectBytes slice1 = store1.createS... | #fixed code
private static void manyToggles(@NotNull DirectStore store1, int lockCount, int from, int to) {
long id = Thread.currentThread().getId();
assertEquals(0, id >>> 24);
System.out.println("Thread " + id);
DirectBytes slice1 = store1.bytes();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testAllocate() throws Exception {
long size = 1L << 24; // 31; don't overload cloud-bees
DirectStore store = DirectStore.allocate(size);
assertEquals(size, store.size());
DirectBytes slice = store.createSlice();
... | #fixed code
@Test
public void testAllocate() throws Exception {
long size = 1L << 24; // 31; don't overload cloud-bees
DirectStore store = DirectStore.allocate(size);
assertEquals(size, store.size());
DirectBytes slice = store.bytes();
slice.po... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testAcquireOverlap() throws Exception {
VanillaMappedFile vmf = new VanillaMappedFile(
newTempraryFile("vmf-acquire-overlap"),
VanillaMappedMode.RW);
VanillaMappedBlocks blocks = vmf.blocks(128);
Va... | #fixed code
@Test
public void testAcquireOverlap() throws Exception {
File path = newTempraryFile("vmf-acquire-overlap");
VanillaMappedFile vmf = VanillaMappedFile.readWrite(path);
VanillaMappedBlocks blocks = VanillaMappedBlocks.readWrite(path,128);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@NotNull
@Override
public String readUTF() {
try {
int len = readUnsignedShort();
StringBuilder utfReader = acquireStringBuilder();
readUTF0(utfReader, len);
return utfReader.length() == 0 ? "" : stringInte... | #fixed code
@NotNull
@Override
public String readUTF() {
try {
int len = readUnsignedShort();
StringBuilder utfReader = acquireStringBuilder();
readUTF0(utfReader, len);
return utfReader.length() == 0 ? "" : SI.intern(utfRea... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public VanillaMappedBuffer sliceOf(long size) throws IOException {
return sliceAtWithId(this.address, size, -1);
}
#location 2
#vulnerability type THREAD_SAFETY_VIOLATION | #fixed code
public VanillaMappedBuffer sliceOf(long size) throws IOException {
return sliceAt(this.address, size, -1);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public VanillaMappedBytes put(T key, File path, long size, long index) {
DataHolder data = this.cache.get(key);
if(data != null) {
data.close();
} else {
data = new DataHolder();
}
try {
final ... | #fixed code
public VanillaMappedBytes put(T key, File path, long size, long index) {
DataHolder data = this.cache.get(key);
if(data != null) {
data.close();
} else {
data = new DataHolder();
}
try {
cleanup();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static void manyLongToggles(@NotNull DirectStore store1, int lockCount, int from, int to) {
long id = Thread.currentThread().getId();
assertEquals(0, id >>> 32);
System.out.println("Thread " + id);
DirectBytes slice1 = store1.cre... | #fixed code
private static void manyLongToggles(@NotNull DirectStore store1, int lockCount, int from, int to) {
long id = Thread.currentThread().getId();
assertEquals(0, id >>> 32);
System.out.println("Thread " + id);
DirectBytes slice1 = store1.bytes();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testAcquireBlocks2() throws Exception {
VanillaMappedFile vmf = new VanillaMappedFile(
newTempraryFile("vmf-acquire-blocks-2"),
VanillaMappedMode.RW);
final long nblocks = 50 * 100 * 1000;
final Vani... | #fixed code
@Test
public void testAcquireBlocks2() throws Exception {
VanillaMappedBlocks blocks = VanillaMappedBlocks.readWrite(
newTempraryFile("vmf-acquire-blocks-2"),
64);
final long nblocks = 50 * 100 * 1000;
for (long i = 0; i < ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testToString() {
NativeBytes bytes = new DirectStore(32).createSlice();
assertEquals("[pos: 0, lim: 32, cap: 32 ] ٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠", bytes.toString());
bytes.writeByte(1);
assertEquals("[pos: 1, lim: ... | #fixed code
@Test
public void testToString() {
NativeBytes bytes = new DirectStore(32).bytes();
assertEquals("[pos: 0, lim: 32, cap: 32 ] ٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠٠", bytes.toString());
bytes.writeByte(1);
assertEquals("[pos: 1, lim: 32, cap: 32 ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@NotNull
@Override
public String readLine() {
StringBuilder input = acquireStringBuilder();
EOL:
while (position() < capacity()) {
int c = readUnsignedByteOrThrow();
switch (c) {
case END_OF_BUFFER:... | #fixed code
@NotNull
@Override
public String readLine() {
StringBuilder input = acquireStringBuilder();
EOL:
while (position() < capacity()) {
int c = readUnsignedByteOrThrow();
switch (c) {
case END_OF_BUFFER:
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testLocking() throws Exception {
// a page
long start = System.nanoTime();
final DirectStore store1 = DirectStore.allocate(1 << 12);
final int lockCount = 20 * 1000000;
Thread t = new Thread(new Runnable() {... | #fixed code
@Test
public void testLocking() {
// a page
long start = System.nanoTime();
final DirectStore store1 = DirectStore.allocate(1 << 12);
final int lockCount = 20 * 1000 * 1000;
new Thread(new Runnable() {
@Override
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void readXml(String fname) throws CoreException {
printX("Loading "+fname+"\n");
resetErrors();
resetWarnings();
// close existing substream
if (substream != null) {
substream.close();
}
... | #fixed code
public static void readXml(String fname) throws CoreException {
printX("Loading "+fname+"\n");
resetErrors();
resetWarnings();
// close existing subtitleStream
if (subtitleStream != null) {
subtitleStream.close();
}... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void setCurSrcDVDPalette(Palette pal) {
currentSourceDVDPalette = pal;
SubstreamDVD substreamDVD = null;
if (inMode == InputMode.VOBSUB) {
substreamDVD = subDVD;
} else if (inMode == InputMode.SUPIFO) {
... | #fixed code
public static void setCurSrcDVDPalette(Palette pal) {
currentSourceDVDPalette = pal;
DvdSubtitleStream substreamDvd = null;
if (inMode == InputMode.VOBSUB) {
substreamDvd = subDVD;
} else if (inMode == InputMode.SUPIFO) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args) throws Exception {
if (args.length < 4 || args.length > 5) {
System.err.println("Usage: QueryDriver <topicsFile> <qrelsFile> <submissionFile> <indexDir> [querySpec]");
System.err.println("topicsFile: input file conta... | #fixed code
public static void main(String[] args) throws Exception {
long curTime = System.nanoTime();
SearchArgs searchArgs = new SearchArgs();
CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90));
try {
parser.parseA... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args) throws IOException, ParseException {
if (args.length != 1) {
System.err.println("Usage: SearchTimeUtil <indexDir>");
System.err.println("indexDir: index directory");
System.exit(1);
}
String[] topics =... | #fixed code
public static void main(String[] args) throws IOException, ParseException {
if (args.length != 1) {
System.err.println("Usage: SearchTimeUtil <indexDir>");
System.err.println("indexDir: index directory");
System.exit(1);
}
String[] topics = {"top... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args) throws Exception {
if (args.length < 4 || args.length > 5) {
System.err.println("Usage: QueryDriver <topicsFile> <qrelsFile> <submissionFile> <indexDir> [querySpec]");
System.err.println("topicsFile: input file conta... | #fixed code
public static void main(String[] args) throws Exception {
long curTime = System.nanoTime();
SearchArgs searchArgs = new SearchArgs();
CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90));
try {
parser.parseA... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args) throws IOException, ParseException {
if (args.length != 3) {
System.err.println("Usage: SearcherCW09B <topicsFile> <submissionFile> <indexDir>");
System.err.println("topicsFile: input file containing queries. One of:... | #fixed code
public static void main(String[] args) throws IOException, ParseException {
long curTime = System.nanoTime();
SearchArgs searchArgs = new SearchArgs();
CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90));
try {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test(expected = NoSuchElementException.class)
public void test1() throws Exception {
Freebase freebase = new Freebase(Paths.get("src/test/resources/freebase-rdf-head100.gz"));
FreebaseNode node;
Iterator<FreebaseNode> iter = freebase.iterator();
assert... | #fixed code
@Test(expected = NoSuchElementException.class)
public void test1() throws Exception {
Freebase freebase = new Freebase(Paths.get("src/test/resources/freebase-rdf-head100.gz"));
FreebaseNode node;
Iterator<FreebaseNode> iter = freebase.iterator();
assertTrue(i... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void run() throws IOException, InterruptedException {
final long start = System.nanoTime();
LOG.info("Starting indexer...");
int numThreads = args.threads;
final Directory dir = FSDirectory.open(indexPath);
final EnglishAnalyzer englishAnalyze... | #fixed code
public void run() throws IOException, InterruptedException {
final long start = System.nanoTime();
LOG.info("Starting indexer...");
int numThreads = args.threads;
final Directory dir = FSDirectory.open(indexPath);
final EnglishAnalyzer englishAnalyzer= arg... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args) throws Exception {
Args searchArgs = new Args();
// Parse args
CmdLineParser parser = new CmdLineParser(searchArgs,
ParserProperties.defaults().withUsageWidth(90));
try {
parser.parseArgument(args)... | #fixed code
public static void main(String[] args) throws Exception {
Args searchArgs = new Args();
CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90));
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args) throws Exception {
Args searchArgs = new Args();
// Parse args
CmdLineParser parser = new CmdLineParser(searchArgs,
ParserProperties.defaults().withUsageWidth(90));
try {
parser.parseArgument(args)... | #fixed code
public static void main(String[] args) throws Exception {
Args searchArgs = new Args();
CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90));
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args) throws Exception {
if (args.length < 4 || args.length > 5) {
System.err.println("Usage: QueryDriver <topicsFile> <qrelsFile> <submissionFile> <indexDir> [querySpec]");
System.err.println("topicsFile: input file conta... | #fixed code
public static void main(String[] args) throws Exception {
long curTime = System.nanoTime();
SearchArgs searchArgs = new SearchArgs();
CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90));
try {
parser.parseA... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private OMElement efetuaConsulta(final OMElement omElementConsulta, final NotaFiscalChaveParser notaFiscalChaveParser) throws AxisFault, RemoteException {
final NfeConsulta2Stub.NfeCabecMsg cabec = new NfeConsulta2Stub.NfeCabecMsg();
cabec.setCUF(notaFis... | #fixed code
private OMElement efetuaConsulta(final OMElement omElementConsulta, final NotaFiscalChaveParser notaFiscalChaveParser) throws AxisFault, RemoteException {
final NfeConsulta2Stub.NfeCabecMsg cabec = new NfeConsulta2Stub.NfeCabecMsg();
cabec.setCUF(notaFiscalCha... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
if (args.length < 1) {
sender.sendMessage(messages.generalNoTagGiven);
return;
}
if (!Gui... | #fixed code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
if (args.length < 1) {
sender.sendMessage(messages.generalNoTagGiven);
return;
}
Guild guild = ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig msg = Messages.getInstance();
String tag = null;
if (args.length > 0) {
tag = args[0];
} else if (sender instanceof Player) {
... | #fixed code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
String tag = null;
if (args.length > 0) {
tag = args[0];
}
else if (sender instanceof Player) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static RankManager getInstance() {
if (instance == null) {
new RankManager();
}
return instance;
}
#location 5
#vulnerability type THREAD_SAFETY_VIOLATION | #fixed code
public static RankManager getInstance() {
return INSTANCE;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@EventHandler
public void onExplode(EntityExplodeEvent event) {
List<Block> destroyed = event.blockList();
Location loc = event.getLocation();
Settings s = Settings.getInstance();
List<Location> sphere = SpaceUtils.sphere(loc, s.expl... | #fixed code
@EventHandler
public void onExplode(EntityExplodeEvent event) {
List<Block> destroyed = event.blockList();
Location loc = event.getLocation();
Settings s = Settings.getInstance();
List<Location> sphere = SpaceUtils.sphere(loc, s.explodeRad... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static int spawnPacket(Location loc) throws Exception {
Object world = Reflections.getHandle(loc.getWorld());
Object crystal = enderCrystalClass.getConstructor(Reflections.getCraftClass("World")).newInstance(world);
Reflections.getMethod(... | #fixed code
private static int spawnPacket(Location loc) throws Exception {
Object world = Reflections.getHandle(loc.getWorld());
Object crystal = enderCrystalConstructor.newInstance(world);
setLocation.invoke(crystal, loc.getX(), loc.getY(), loc.getZ(), 0, 0);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static IndependentThread getInstance() {
if (instance == null) {
new IndependentThread().start();
}
return instance;
}
#location 3
#vulnerability type THREAD_SAFETY_... | #fixed code
public static IndependentThread getInstance() {
if (instance == null) {
new IndependentThread().start();
}
return instance;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig msg = Messages.getInstance();
String tag = null;
if (args.length > 0) {
tag = args[0];
} else if (sender instanceof Player) {
... | #fixed code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
String tag = null;
if (args.length > 0) {
tag = args[0];
}
else if (sender instanceof Player) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
if (args.length < 1) {
sender.sendMessage(messages.generalNoTagGiven);
return;
} else if (args.len... | #fixed code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
PluginConfig config = Settings.getConfig();
if (args.length < 1) {
sender.sendMessage(messages.generalNoTagGiven);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void onLoad() {
this.logger = new FunnyGuildsLogger(this);
try {
Class.forName("net.md_5.bungee.api.ChatColor");
}
catch (Exception spigotNeeded) {
FunnyGuilds.getInstance().getPluginLogger().... | #fixed code
@Override
public void onLoad() {
funnyguilds = this;
this.logger = new FunnyGuildsLogger(this);
try {
Class.forName("net.md_5.bungee.api.ChatColor");
}
catch (Exception spigotNeeded) {
FunnyGuilds.getInstanc... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
if (args.length < 1) {
sender.sendMessage(messages.generalNoTagGiven);
return;
}
if (!Gui... | #fixed code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
if (args.length < 1) {
sender.sendMessage(messages.generalNoTagGiven);
return;
}
Guild guild = ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static RankManager getInstance() {
if (instance == null) {
new RankManager();
}
return instance;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | #fixed code
public static RankManager getInstance() {
return INSTANCE;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private int[] getEloValues(int vP, int aP) {
PluginConfig config = Settings.getConfig();
int[] rankChanges = new int[2];
int aC = IntegerRange.inRange(aP, config.eloConstants);
int vC = IntegerRange.inRange(vP, config.eloConstant... | #fixed code
private int[] getEloValues(int vP, int aP) {
PluginConfig config = Settings.getConfig();
int[] rankChanges = new int[2];
int aC = IntegerRange.inRange(aP, config.eloConstants, "ELO_CONSTANTS");
int vC = IntegerRange.inRange(vP, config.... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
User user = User.get(player);
if (user == null) {
user = User.create(player);
}
user.updateReference(player);
PluginCon... | #fixed code
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
User user = User.get(player);
if (user == null) {
user = User.create(player);
} else {
if (! user.getName().equals(player.getName(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static int spawnPacket(Location loc) throws Exception {
Object world = Reflections.getHandle(loc.getWorld());
Object crystal = enderCrystalClass.getConstructor(Reflections.getCraftClass("World")).newInstance(world);
Reflections.getMethod(... | #fixed code
private static int spawnPacket(Location loc) throws Exception {
Object world = Reflections.getHandle(loc.getWorld());
Object crystal = enderCrystalConstructor.newInstance(world);
setLocation.invoke(crystal, loc.getX(), loc.getY(), loc.getZ(), 0, 0);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void update(User user) {
if (!this.users.contains(user.getRank())) {
this.users.add(user.getRank());
}
synchronized (users) {
Collections.sort(users);
}
if (user.hasGuild()) {
update(us... | #fixed code
public void update(User user) {
if (! this.users.contains(user.getRank())) {
this.users.add(user.getRank());
}
Collections.sort(users);
if (user.hasGuild()) {
update(user.getGuild());
}
for (int i = 0;... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(CommandSender sender, String[] args) {
PluginConfig c = Settings.getConfig();
MessagesConfig m = Messages.getInstance();
Player p = (Player) sender;
User user = User.get(p);
if (!c.baseEnable) {
... | #fixed code
@Override
public void execute(CommandSender sender, String[] args) {
PluginConfig config = Settings.getConfig();
MessagesConfig messages = Messages.getInstance();
Player player = (Player) sender;
User user = User.get(player);
if (!... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(CommandSender sender, String[] args) {
PluginConfig config = Settings.getConfig();
MessagesConfig messages = Messages.getInstance();
Player player = (Player) sender;
User user = User.get(player);
... | #fixed code
@Override
public void execute(CommandSender sender, String[] args) {
PluginConfig config = Settings.getConfig();
MessagesConfig messages = Messages.getInstance();
Player player = (Player) sender;
User user = User.get(player);
if (!... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void sendMessageToGuild(Guild guild, Player player, String message) {
if (guild == null || player == null || !player.isOnline()) {
return;
}
for (User user : guild.getOnlineMembers()) {
Player p = user.getPlayer()... | #fixed code
private void sendMessageToGuild(Guild guild, Player player, String message) {
if (guild == null || player == null || !player.isOnline()) {
return;
}
for (User user : guild.getOnlineMembers()) {
Player p = user.getPlayer();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig m = Messages.getInstance();
Player p = (Player) sender;
User user = User.get(p);
if (user.hasGuild()) {
p.sendMessage(m.joinHasGuild);
... | #fixed code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
Player player = (Player) sender;
User user = User.get(player);
if (user.hasGuild()) {
player.sendMessage(mes... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private int[] getEloValues(int vP, int aP) {
PluginConfig config = Settings.getConfig();
int[] rankChanges = new int[2];
int aC = IntegerRange.inRange(aP, config.eloConstants);
int vC = IntegerRange.inRange(vP, config.eloConstant... | #fixed code
private int[] getEloValues(int vP, int aP) {
PluginConfig config = Settings.getConfig();
int[] rankChanges = new int[2];
int aC = IntegerRange.inRange(aP, config.eloConstants, "ELO_CONSTANTS");
int vC = IntegerRange.inRange(vP, config.... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
if (args.length < 1) {
sender.sendMessage(messages.generalNoTagGiven);
return;
}
if (args... | #fixed code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
if (args.length < 1) {
sender.sendMessage(messages.generalNoTagGiven);
return;
}
if (args.lengt... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
if (args.length < 1) {
sender.sendMessage(messages.generalNoTagGiven);
return;
}
... | #fixed code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
if (args.length < 1) {
sender.sendMessage(messages.generalNoTagGiven);
return;
}
Guild ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public boolean isInIgnoredRegion(Location location) {
if (! isInRegion(location)) {
return false;
}
PluginConfiguration config = FunnyGuilds.getInstance().getPluginConfiguration();
return getRegionSet(location)... | #fixed code
@Override
public boolean isInIgnoredRegion(Location location) {
PluginConfiguration config = FunnyGuilds.getInstance().getPluginConfiguration();
ApplicableRegionSet regionSet = getRegionSet(location);
if (regionSet == null) {
return fa... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void update(User user) {
if (!this.users.contains(user.getRank())) {
this.users.add(user.getRank());
}
synchronized (users) {
Collections.sort(users);
}
if (user.hasGuild()) {
update(us... | #fixed code
public void update(User user) {
if (! this.users.contains(user.getRank())) {
this.users.add(user.getRank());
}
Collections.sort(users);
if (user.hasGuild()) {
update(user.getGuild());
}
for (int i = 0;... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(CommandSender sender, String[] args) {
PluginConfig pc = Settings.getConfig();
MessagesConfig m = Messages.getInstance();
Player p = (Player) sender;
User user = User.get(p);
Guild guild = user.ge... | #fixed code
@Override
public void execute(CommandSender sender, String[] args) {
PluginConfig config = Settings.getConfig();
MessagesConfig messages = Messages.getInstance();
Player player = (Player) sender;
User user = User.get(player);
Guild ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void sendMessageToGuild(Guild guild, Player player, String message) {
for (User user : guild.getMembers()) {
Player loopedPlayer = this.plugin.getServer().getPlayer(user.getName());
if (loopedPlayer != null) {
if (... | #fixed code
private void sendMessageToGuild(Guild guild, Player player, String message) {
for (User user : guild.getOnlineMembers()) {
Player p = user.getPlayer();
if(!p.equals(player) || !user.isSpy()) {
p.sendMessage(message)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
if (args.length < 1) {
sender.sendMessage(messages.generalNoTagGiven);
return;
} else if (args.len... | #fixed code
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
if (args.length < 1) {
sender.sendMessage(messages.generalNoTagGiven);
return;
} else if (args.length < ... | 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.