output
stringlengths
64
73.2k
input
stringlengths
208
73.3k
instruction
stringclasses
1 value
#fixed code @Test public void testUpdateAllWithParameterFourRuns() { try (Database db = db()) { db.update("update person set score=?") // .parameters(1, 2, 3, 4) // .counts() // .test().awaitDone(TIMEOUT_...
#vulnerable code @Test public void testUpdateAllWithParameterFourRuns() { db().update("update person set score=?") // .parameters(1, 2, 3, 4) // .counts() // .test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectTransactedChained() throws Exception { try (Database db = db()) { db // .select("select score from person where name=?") // .parameters("FRED", "JOSEPH") // .transa...
#vulnerable code @Test public void testSelectTransactedChained() throws Exception { Database db = db(); db // .select("select score from person where name=?") // .parameters("FRED", "JOSEPH") // .transacted() // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectTransactedTuple4() { try (Database db = db()) { Tx<Tuple4<String, Integer, String, Integer>> t = db // .select("select name, score, name, score from person where name=?") // .parameter...
#vulnerable code @Test public void testSelectTransactedTuple4() { Tx<Tuple4<String, Integer, String, Integer>> t = db() // .select("select name, score, name, score from person where name=?") // .parameters("FRED") // .transacte...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectDependsOnCompletable() { try (Database db = db()) { Completable a = db.update("update person set score=100 where name=?") // .parameter("FRED") // .counts().ignoreElements(); ...
#vulnerable code @Test public void testSelectDependsOnCompletable() { Database db = db(); Completable a = db.update("update person set score=100 where name=?") // .parameter("FRED") // .counts().ignoreElements(); db.select("sel...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testFewerColumnsMappedThanAvailable() { try (Database db = db()) { db.select("select name, score from person where name='FRED'") // .getAs(String.class) // .test().awaitDone(TIMEOUT_SECONDS, Tim...
#vulnerable code @Test public void testFewerColumnsMappedThanAvailable() { db().select("select name, score from person where name='FRED'") // .getAs(String.class) // .test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) // .asse...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static Database test(int maxPoolSize) { return Database.from( // Pools.nonBlocking() // .connectionProvider(testConnectionProvider()) // .maxPoolSize(maxPoolSize) // .build(...
#vulnerable code public static Database test(int maxPoolSize) { return Database.from(new NonBlockingConnectionPool(testConnectionProvider(), maxPoolSize, 1000)); } #location 2 #vulnerability type RESOURCE_LEAK
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateWithParameterTwoRuns() { try (Database db = db()) { db.update("update person set score=20 where name=?") // .parameters("FRED", "JOSEPH").counts() // .test().awaitDone(TIMEOUT_SECONDS,...
#vulnerable code @Test public void testUpdateWithParameterTwoRuns() { db().update("update person set score=20 where name=?") // .parameters("FRED", "JOSEPH").counts() // .test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) // ....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test @Ignore // TODO fix test public void testMaxIdleTime() throws InterruptedException { TestScheduler s = new TestScheduler(); AtomicInteger count = new AtomicInteger(); AtomicInteger disposed = new AtomicInteger(); MemberFactory...
#vulnerable code @Test @Ignore // TODO fix test public void testMaxIdleTime() throws InterruptedException { TestScheduler s = new TestScheduler(); AtomicInteger count = new AtomicInteger(); AtomicInteger disposed = new AtomicInteger(); MemberF...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test @Ignore public void testCallableApi() { Database db = DatabaseCreator.createDerbyWithStoredProcs(1); db // .call("call getPersonCount(?,?)") // .in() // .out(Type.INTEGER, Integer.class) // ...
#vulnerable code @Test @Ignore public void testCallableApi() { Database db = DatabaseCreator.createDerbyWithStoredProcs(1); db // .call("call getPersonCount(?,?)") // .in() // .out(Type.INTEGER, Integer.class) // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectWithFetchSize() { try (Database db = db()) { db.select("select score from person order by name") // .fetchSize(2) // .getAs(Integer.class) // .test() // ...
#vulnerable code @Test public void testSelectWithFetchSize() { db().select("select score from person order by name") // .fetchSize(2) // .getAs(Integer.class) // .test() // .awaitDone(TIMEOUT_SECONDS, TimeUnit.S...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectAutomappedTransactedValuesOnly() { try (Database db = db()) { db // .select("select name, score from person") // .transacted() // .valuesOnly() // ...
#vulnerable code @Test public void testSelectAutomappedTransactedValuesOnly() { db() // .select("select name, score from person") // .transacted() // .valuesOnly() // .autoMap(Person2.class) // ....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectTransactedTuple5() { try (Database db = db()) { Tx<Tuple5<String, Integer, String, Integer, String>> t = db // .select("select name, score, name, score, name from person where name=?") // ...
#vulnerable code @Test public void testSelectTransactedTuple5() { Tx<Tuple5<String, Integer, String, Integer, String>> t = db() // .select("select name, score, name, score, name from person where name=?") // .parameters("FRED") // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateClobWithReader() throws FileNotFoundException { try (Database db = db()) { Reader reader = new FileReader(new File("src/test/resources/big.txt")); insertNullClob(db); db // .update...
#vulnerable code @Test public void testUpdateClobWithReader() throws FileNotFoundException { Database db = db(); Reader reader = new FileReader(new File("src/test/resources/big.txt")); insertNullClob(db); db // .update("update person_c...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testInsertBlobAndReadBlobAsInputStream() { try (Database db = db()) { byte[] bytes = "some text here".getBytes(); db.update("insert into person_blob(name,document) values(?,?)") // .parameters("FRED", n...
#vulnerable code @Test public void testInsertBlobAndReadBlobAsInputStream() { Database db = db(); byte[] bytes = "some text here".getBytes(); db.update("insert into person_blob(name,document) values(?,?)") // .parameters("FRED", new ByteArrayI...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateWithBatchSize3GreaterThanNumRecords() { try (Database db = db()) { db.update("update person set score=?") // .batchSize(3) // .parameters(1, 2, 3, 4) // .counts() /...
#vulnerable code @Test public void testUpdateWithBatchSize3GreaterThanNumRecords() { db().update("update person set score=?") // .batchSize(3) // .parameters(1, 2, 3, 4) // .counts() // .test().awaitDone(TIMEOUT...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testTuple3() { try (Database db = db()) { db // .select("select name, score, name from person order by name") // .getAs(String.class, Integer.class, String.class) // .firstOr...
#vulnerable code @Test public void testTuple3() { db() // .select("select name, score, name from person order by name") // .getAs(String.class, Integer.class, String.class) // .firstOrError() // .test().awaitDon...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testAutoMapToInterfaceWithIndexTooLarge() { try (Database db = db()) { db // .select("select name, score from person order by name") // .autoMap(Person6.class) // .firstOrErr...
#vulnerable code @Test public void testAutoMapToInterfaceWithIndexTooLarge() { db() // .select("select name, score from person order by name") // .autoMap(Person6.class) // .firstOrError() // .map(Person6::examS...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectUsingNamedParameterList() { try (Database db = db()) { db.select("select score from person where name=:name") // .parameters(Parameter.named("name", "FRED").value("JOSEPH").list()) // ...
#vulnerable code @Test public void testSelectUsingNamedParameterList() { db().select("select score from person where name=:name") // .parameters(Parameter.named("name", "FRED").value("JOSEPH").list()) // .getAs(Integer.class) // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateBlobWithNull() { try (Database db = db()) { insertPersonBlob(db); db // .update("update person_blob set document = :doc") // .parameter("doc", Database.NULL_BLOB) // ...
#vulnerable code @Test public void testUpdateBlobWithNull() { Database db = db(); insertPersonBlob(db); db // .update("update person_blob set document = :doc") // .parameter("doc", Database.NULL_BLOB) // .counts...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testComplete() throws InterruptedException { try (Database db = db(1)) { Completable a = db // .update("update person set score=-3 where name='FRED'") // .complete(); db.update("upda...
#vulnerable code @Test public void testComplete() throws InterruptedException { Database db = db(1); Completable a = db // .update("update person set score=-3 where name='FRED'") // .complete(); db.update("update person set sco...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectTransactedTupleN() { try (Database db = db()) { List<Tx<TupleN<Object>>> list = db // .select("select name, score from person where name=?") // .parameters("FRED") // ...
#vulnerable code @Test public void testSelectTransactedTupleN() { List<Tx<TupleN<Object>>> list = db() // .select("select name, score from person where name=?") // .parameters("FRED") // .transacted() // .getTup...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testMoreColumnsMappedThanAvailable() { try (Database db = db()) { db // .select("select name, score from person where name='FRED'") // .getAs(String.class, Integer.class, String.class) // ...
#vulnerable code @Test public void testMoreColumnsMappedThanAvailable() { db() // .select("select name, score from person where name='FRED'") // .getAs(String.class, Integer.class, String.class) // .test().awaitDone(TIMEOUT_SEC...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testTuple6() { try (Database db = db()) { db // .select("select name, score, name, score, name, score from person order by name") // .getAs(String.class, Integer.class, String.class, Integer.cla...
#vulnerable code @Test public void testTuple6() { db() // .select("select name, score, name, score, name, score from person order by name") // .getAs(String.class, Integer.class, String.class, Integer.class, String.class, ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test @SuppressFBWarnings public void testTupleSupport() { try (Database db = db()) { db.select("select name, score from person") // .getAs(String.class, Integer.class) // .forEach(System.out::println); ...
#vulnerable code @Test @SuppressFBWarnings public void testTupleSupport() { db().select("select name, score from person") // .getAs(String.class, Integer.class) // .forEach(System.out::println); } #location...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCountsOnlyInTransaction() { try (Database db = db()) { db.update("update person set score = -3") // .transacted() // .countsOnly() // .test().awaitDone(TIMEOUT_SECONDS, T...
#vulnerable code @Test public void testCountsOnlyInTransaction() { db().update("update person set score = -3") // .transacted() // .countsOnly() // .test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) // .assert...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectUsingName() { try (Database db = db()) { db // .select("select score from person where name=:name") // .parameter("name", "FRED") // .parameter("name", "JOSEPH") //...
#vulnerable code @Test public void testSelectUsingName() { db() // .select("select score from person where name=:name") // .parameter("name", "FRED") // .parameter("name", "JOSEPH") // .getAs(Integer.class) // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testAutoMapWithUnmappableColumnType() { try (Database db = db()) { db // .select("select name from person order by name") // .autoMap(Person8.class) // .map(p -> p.name()) //...
#vulnerable code @Test public void testAutoMapWithUnmappableColumnType() { db() // .select("select name from person order by name") // .autoMap(Person8.class) // .map(p -> p.name()) // .test().awaitDone(TIMEOUT_...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testInsertNullClobAndReadClobAsString() { try (Database db = db()) { insertNullClob(db); db.select("select document from person_clob where name='FRED'") // .getAsOptional(String.class) // ...
#vulnerable code @Test public void testInsertNullClobAndReadClobAsString() { Database db = db(); insertNullClob(db); db.select("select document from person_clob where name='FRED'") // .getAsOptional(String.class) // .test().awa...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateOneRow() { try (Database db = db()) { db.update("update person set score=20 where name='FRED'") // .counts() // .test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) // ...
#vulnerable code @Test public void testUpdateOneRow() { db().update("update person set score=20 where name='FRED'") // .counts() // .test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) // .assertValue(1) // .ass...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReleasedMemberIsRecreated() throws Exception { TestScheduler s = new TestScheduler(); AtomicInteger count = new AtomicInteger(); AtomicInteger disposed = new AtomicInteger(); Pool<Integer> pool = NonBlockingPool // ...
#vulnerable code @Test public void testReleasedMemberIsRecreated() throws InterruptedException { TestScheduler s = new TestScheduler(); AtomicInteger count = new AtomicInteger(); AtomicInteger disposed = new AtomicInteger(); Pool<Integer> pool = NonBl...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectTimestampAsDate() { try (Database db = db()) { db // .select("select registered from person where name='FRED'") // .getAs(Date.class) // .map(d -> d.getTime()) // ...
#vulnerable code @Test public void testSelectTimestampAsDate() { db() // .select("select registered from person where name='FRED'") // .getAs(Date.class) // .map(d -> d.getTime()) // .test().awaitDone(TIMEOUT_SE...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectTimestampAsInstant() { try (Database db = db()) { db // .select("select registered from person where name='FRED'") // .getAs(Instant.class) // .map(d -> d.toEpochMi...
#vulnerable code @Test public void testSelectTimestampAsInstant() { db() // .select("select registered from person where name='FRED'") // .getAs(Instant.class) // .map(d -> d.toEpochMilli()) // .test().awaitDone...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectTransactedTuple6() { try (Database db = db()) { Tx<Tuple6<String, Integer, String, Integer, String, Integer>> t = db // .select("select name, score, name, score, name, score from person where name=?") // ...
#vulnerable code @Test public void testSelectTransactedTuple6() { Tx<Tuple6<String, Integer, String, Integer, String, Integer>> t = db() // .select("select name, score, name, score, name, score from person where name=?") // .parameters("FRED")...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testTransactedReturnGeneratedKeys() { try (Database db = db()) { // note is a table with auto increment db.update("insert into note(text) values(?)") // .parameters("HI", "THERE") // ...
#vulnerable code @Test public void testTransactedReturnGeneratedKeys() { Database db = db(); // note is a table with auto increment db.update("insert into note(text) values(?)") // .parameters("HI", "THERE") // .transacted() //...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReturnGeneratedKeys() { try (Database db = db()) { // note is a table with auto increment db.update("insert into note(text) values(?)") // .parameters("HI", "THERE") // .returnGe...
#vulnerable code @Test public void testReturnGeneratedKeys() { Database db = db(); // note is a table with auto increment db.update("insert into note(text) values(?)") // .parameters("HI", "THERE") // .returnGeneratedKeys() // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectDependsOnObservable() { try (Database db = db()) { Observable<Integer> a = db.update("update person set score=100 where name=?") // .parameter("FRED") // .counts().toObservable(); ...
#vulnerable code @Test public void testSelectDependsOnObservable() { Database db = db(); Observable<Integer> a = db.update("update person set score=100 where name=?") // .parameter("FRED") // .counts().toObservable(); db.select...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testTuple5() { try (Database db = db()) { db // .select("select name, score, name, score, name from person order by name") // .getAs(String.class, Integer.class, String.class, Integer.class, Str...
#vulnerable code @Test public void testTuple5() { db() // .select("select name, score, name, score, name from person order by name") // .getAs(String.class, Integer.class, String.class, Integer.class, String.class) // .firstOrE...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testInsert() { try (Database db = db()) { db.update("insert into person(name, score) values(?,?)") // .parameters("DAVE", 12, "ANNE", 18) // .counts() // .test().awaitDone(TI...
#vulnerable code @Test public void testInsert() { Database db = db(); db.update("insert into person(name, score) values(?,?)") // .parameters("DAVE", 12, "ANNE", 18) // .counts() // .test().awaitDone(TIMEOUT_SECONDS, Ti...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testDrivingSelectWithoutParametersUsingParameterStream() { try (Database db = db()) { db.select("select count(*) from person") // .parameters(1, 2, 3) // .getAs(Integer.class) // ...
#vulnerable code @Test public void testDrivingSelectWithoutParametersUsingParameterStream() { db().select("select count(*) from person") // .parameters(1, 2, 3) // .getAs(Integer.class) // .test().awaitDone(TIMEOUT_SECONDS, Tim...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSimplePool() throws InterruptedException { TestScheduler s = new TestScheduler(); AtomicInteger count = new AtomicInteger(); MemberFactory<Integer, NonBlockingPool<Integer>> memberFactory = pool -> new NonBlockingMember<Intege...
#vulnerable code @Test public void testSimplePool() throws InterruptedException { TestScheduler s = new TestScheduler(); AtomicInteger count = new AtomicInteger(); MemberFactory2<Integer, NonBlockingPool2<Integer>> memberFactory = pool -> new NonBlockingMembe...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateWithinTransactionBatchSize0() { try (Database db = db()) { db // .select("select name from person") // .transactedValuesOnly() // .getAs(String.class) // ...
#vulnerable code @Test public void testUpdateWithinTransactionBatchSize0() { db() // .select("select name from person") // .transactedValuesOnly() // .getAs(String.class) // .doOnNext(System.out::println) // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateWithBatchSize2() { try (Database db = db()) { db.update("update person set score=?") // .batchSize(2) // .parameters(1, 2, 3, 4) // .counts() // ...
#vulnerable code @Test public void testUpdateWithBatchSize2() { db().update("update person set score=?") // .batchSize(2) // .parameters(1, 2, 3, 4) // .counts() // .test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SE...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCallableApiNoParameters() { Database db = DatabaseCreator.createDerbyWithStoredProcs(1); db // .call("call zero()") // .once() // .test() // .awaitDone(TIMEOUT_SECONDS, T...
#vulnerable code @Test public void testCallableApiNoParameters() { Database db = DatabaseCreator.createDerbyWithStoredProcs(1); db // .call("call zero()") // .once().test() // .awaitDone(TIMEOUT_SECONDS, TimeUnit.SECOND...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectTimestamp() { try (Database db = db()) { db // .select("select registered from person where name='FRED'") // .getAs(Long.class) // .test().awaitDone(TIMEOUT_SECONDS...
#vulnerable code @Test public void testSelectTimestamp() { db() // .select("select registered from person where name='FRED'") // .getAs(Long.class) // .test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) // .ass...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(expected = IllegalArgumentException.class) public void testSelectUsingNameWithoutSpecifyingNameThrowsImmediately() { try (Database db = db()) { db // .select("select score from person where name=:name") // ...
#vulnerable code @Test(expected = IllegalArgumentException.class) public void testSelectUsingNameWithoutSpecifyingNameThrowsImmediately() { db() // .select("select score from person where name=:name") // .parameters("FRED", "JOSEPH"); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testAutoMapToInterfaceWithIndexTooSmall() { try (Database db = db()) { db // .select("select name, score from person order by name") // .autoMap(Person7.class) // .firstOrErr...
#vulnerable code @Test public void testAutoMapToInterfaceWithIndexTooSmall() { db() // .select("select name, score from person order by name") // .autoMap(Person7.class) // .firstOrError() // .map(Person7::examS...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateTimestampAsInstant() { try (Database db = db()) { db.update("update person set registered=? where name='FRED'") // .parameter(Instant.ofEpochMilli(FRED_REGISTERED_TIME)) // .counts() /...
#vulnerable code @Test public void testUpdateTimestampAsInstant() { Database db = db(); db.update("update person set registered=? where name='FRED'") // .parameter(Instant.ofEpochMilli(FRED_REGISTERED_TIME)) // .counts() // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testConnectionPoolRecylesAlternating() { TestScheduler s = new TestScheduler(); AtomicInteger count = new AtomicInteger(); Pool<Integer> pool = NonBlockingPool // .factory(() -> count.incrementAndGet()) // ...
#vulnerable code @Test public void testConnectionPoolRecylesAlternating() { TestScheduler s = new TestScheduler(); Database db = DatabaseCreator.create(2, s); TestSubscriber<Connection> ts = db.connections() // .doOnNext(System.out::println) /...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateTxPerformed() { Database db = db(1); db.update("update person set score = 1000") // .transacted() // .counts() // .test() // .awaitDone(TIMEOUT_SECONDS, TimeUnit.SE...
#vulnerable code @Test public void testUpdateTxPerformed() { Database db = db(); db.update("update person set score = 1000") // .transacted() // .counts() // .test() // .awaitDone(TIMEOUT_SECONDS, TimeUn...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static Database create(int maxSize, boolean big, Scheduler scheduler) { NonBlockingConnectionPool pool = Pools.nonBlocking() // .connectionProvider(connectionProvider(nextUrl(), big)) // .maxPoolSize(maxSize) // ....
#vulnerable code public static Database create(int maxSize, boolean big, Scheduler scheduler) { return Database.from(Pools.nonBlocking() // .connectionProvider(connectionProvider(nextUrl(), big)) // .maxPoolSize(maxSize) // .schedu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateBlobWithBlob() throws SQLException { try (Database db = db()) { Blob blob = new JDBCBlobFile(new File("src/test/resources/big.txt")); insertPersonBlob(db); db // .update("update person_blob set do...
#vulnerable code @Test public void testUpdateBlobWithBlob() throws SQLException { Database db = db(); Blob blob = new JDBCBlobFile(new File("src/test/resources/big.txt")); insertPersonBlob(db); db // .update("update person_blob set doc...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectTransactedTuple3() { try (Database db = db()) { Tx<Tuple3<String, Integer, String>> t = db // .select("select name, score, name from person where name=?") // .parameters("FRED") // ...
#vulnerable code @Test public void testSelectTransactedTuple3() { Tx<Tuple3<String, Integer, String>> t = db() // .select("select name, score, name from person where name=?") // .parameters("FRED") // .transacted() // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testHealthCheck() throws InterruptedException { AtomicBoolean once = new AtomicBoolean(true); testHealthCheck(c -> { log.debug("doing health check"); return !once.compareAndSet(true, false); }); }
#vulnerable code @Test public void testHealthCheck() throws InterruptedException { TestScheduler scheduler = new TestScheduler(); AtomicBoolean once = new AtomicBoolean(true); NonBlockingConnectionPool pool = Pools // .nonBlocking() // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateTimestampParameter() { try (Database db = db()) { Timestamp t = new Timestamp(1234); db.update("update person set registered=?") // .parameter(t) // .counts() // ...
#vulnerable code @Test public void testUpdateTimestampParameter() { Database db = db(); Timestamp t = new Timestamp(1234); db.update("update person set registered=?") // .parameter(t) // .counts() // .test() // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(expected = IllegalArgumentException.class) public void testSelectWithFetchSizeNegative() { try (Database db = db()) { db.select("select score from person order by name") // .fetchSize(-1); } }
#vulnerable code @Test(expected = IllegalArgumentException.class) public void testSelectWithFetchSizeNegative() { db().select("select score from person order by name") // .fetchSize(-1); } #location 4 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectUsingQuestionMark() { try (Database db = db()) { db.select("select score from person where name=?") // .parameters("FRED", "JOSEPH") // .getAs(Integer.class) // .te...
#vulnerable code @Test public void testSelectUsingQuestionMark() { db().select("select score from person where name=?") // .parameters("FRED", "JOSEPH") // .getAs(Integer.class) // .test() // .awaitDone(TIMEOUT_...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCallableStatementReturningResultSets() { Database db = DatabaseCreator.createDerbyWithStoredProcs(1); db.apply(con -> { try (Statement stmt = con.createStatement()) { CallableStatement st = con.prepareCall(...
#vulnerable code @Test public void testCallableStatementReturningResultSets() { Database db = DatabaseCreator.createDerby(1); db.apply(con -> { try (Statement stmt = con.createStatement()) { stmt.execute( "create ta...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static Database test(int maxPoolSize) { Preconditions.checkArgument(maxPoolSize > 0, "maxPoolSize must be greater than 0"); return Database.from( // Pools.nonBlocking() // .connectionProvider(testConnectionProvide...
#vulnerable code public static Database test(int maxPoolSize) { Preconditions.checkArgument(maxPoolSize > 0, "maxPoolSize must be greater than 0"); return Database.from( // Pools.nonBlocking() // .connectionProvider(testConnectionP...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCompleteCompletes() { try (Database db = db(1)) { db // .update("update person set score=-3 where name='FRED'") // .complete() // .timeout(TIMEOUT_SECONDS, TimeUnit.SECON...
#vulnerable code @Test public void testCompleteCompletes() { Database db = db(1); db // .update("update person set score=-3 where name='FRED'") // .complete() // .timeout(TIMEOUT_SECONDS, TimeUnit.SECONDS) // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testAutoMapToInterface() { try (Database db = db()) { db // .select("select name from person") // .autoMap(Person.class) // .map(p -> p.name()) // .test()...
#vulnerable code @Test public void testAutoMapToInterface() { db() // .select("select name from person") // .autoMap(Person.class) // .map(p -> p.name()) // .test() // .awaitDone(TIMEOUT_SECONDS,...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(expected = IllegalArgumentException.class) public void testReturnGeneratedKeysWithBatchSizeShouldThrow() { try (Database db = db()) { // note is a table with auto increment db.update("insert into note(text) values(?)") // ...
#vulnerable code @Test(expected = IllegalArgumentException.class) public void testReturnGeneratedKeysWithBatchSizeShouldThrow() { Database db = db(); // note is a table with auto increment db.update("insert into note(text) values(?)") // .para...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateThreeRows() { try (Database db = db()) { db.update("update person set score=20") // .counts() // .test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) // .assertValu...
#vulnerable code @Test public void testUpdateThreeRows() { db().update("update person set score=20") // .counts() // .test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) // .assertValue(3) // .assertComplete(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testAutoMapWithQueryInAnnotation() { try (Database db = db()) { db.select(Person10.class) // .get() // .firstOrError() // .map(Person10::score) // .test()...
#vulnerable code @Test public void testAutoMapWithQueryInAnnotation() { db().select(Person10.class) // .get() // .firstOrError() // .map(Person10::score) // .test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) /...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectDependsOnOnSingle() { try (Database db = db()) { Single<Long> a = db.update("update person set score=100 where name=?") // .parameter("FRED") // .counts().count(); db.selec...
#vulnerable code @Test public void testSelectDependsOnOnSingle() { Database db = db(); Single<Long> a = db.update("update person set score=100 where name=?") // .parameter("FRED") // .counts().count(); db.select("select score f...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testAutoMapToInterfaceWithTwoMethods() { try (Database db = db()) { db // .select("select name, score from person order by name") // .autoMap(Person2.class) // .firstOrError(...
#vulnerable code @Test public void testAutoMapToInterfaceWithTwoMethods() { db() // .select("select name, score from person order by name") // .autoMap(Person2.class) // .firstOrError() // .map(Person2::score) /...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateUtilDateParameter() { try (Database db = db()) { Date d = new Date(1234); db.update("update person set registered=?") // .parameter(d) // .counts() // ....
#vulnerable code @Test public void testUpdateUtilDateParameter() { Database db = db(); Date d = new Date(1234); db.update("update person set registered=?") // .parameter(d) // .counts() // .test() // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectAutomappedTransacted() { try (Database db = db()) { db // .select("select name, score from person") // .transacted() // .autoMap(Person2.class) // ...
#vulnerable code @Test public void testSelectAutomappedTransacted() { db() // .select("select name, score from person") // .transacted() // .autoMap(Person2.class) // .test() // .awaitDone(TIMEOU...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateWithinTransaction() { try (Database db = db()) { db // .select("select name from person") // .transactedValuesOnly() // .getAs(String.class) // ...
#vulnerable code @Test public void testUpdateWithinTransaction() { db() // .select("select name from person") // .transactedValuesOnly() // .getAs(String.class) // .doOnNext(System.out::println) // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectTransactedTuple7() { try (Database db = db()) { Tx<Tuple7<String, Integer, String, Integer, String, Integer, String>> t = db // .select("select name, score, name, score, name, score, name from person wher...
#vulnerable code @Test public void testSelectTransactedTuple7() { Tx<Tuple7<String, Integer, String, Integer, String, Integer, String>> t = db() // .select("select name, score, name, score, name, score, name from person where name=?") // .para...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testInsertBlobAndReadBlobAsByteArray() { try (Database db = db()) { insertPersonBlob(db); db.select("select document from person_blob where name='FRED'") // .getAs(byte[].class) // ....
#vulnerable code @Test public void testInsertBlobAndReadBlobAsByteArray() { Database db = db(); insertPersonBlob(db); db.select("select document from person_blob where name='FRED'") // .getAs(byte[].class) // .map(b -> new Stri...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testTupleN() { try (Database db = db()) { db // .select("select name, score, name from person order by name") // .getTupleN() // .firstOrError().test().awaitDone(TIMEOUT_SECO...
#vulnerable code @Test public void testTupleN() { db() // .select("select name, score, name from person order by name") // .getTupleN() // .firstOrError().test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS) // ....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectWithFetchSizeZero() { try (Database db = db()) { db.select("select score from person order by name") // .fetchSize(0) // .getAs(Integer.class) // .test() // ...
#vulnerable code @Test public void testSelectWithFetchSizeZero() { db().select("select score from person order by name") // .fetchSize(0) // .getAs(Integer.class) // .test() // .awaitDone(TIMEOUT_SECONDS, TimeUn...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateClobWithClob() throws SQLException { try (Database db = db()) { Clob clob = new JDBCClobFile(new File("src/test/resources/big.txt")); insertNullClob(db); db // .update("update pers...
#vulnerable code @Test public void testUpdateClobWithClob() throws SQLException { Database db = db(); Clob clob = new JDBCClobFile(new File("src/test/resources/big.txt")); insertNullClob(db); db // .update("update person_clob set docum...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectUsingNonBlockingBuilder() { NonBlockingConnectionPool pool = Pools // .nonBlocking() // .connectionProvider(DatabaseCreator.connectionProvider()) // .maxIdleTime(1, TimeUnit.MINUTES) // ...
#vulnerable code @Test public void testSelectUsingNonBlockingBuilder() { NonBlockingConnectionPool pool = Pools // .nonBlocking() // .connectionProvider(DatabaseCreator.connectionProvider()) // .maxIdleTime(1, TimeUnit.MINUTES)...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectTransactedGetAsOptional() { try (Database db = db()) { List<Tx<Optional<String>>> list = db // .select("select name from person where name=?") // .parameters("FRED") // ...
#vulnerable code @Test public void testSelectTransactedGetAsOptional() { List<Tx<Optional<String>>> list = db() // .select("select name from person where name=?") // .parameters("FRED") // .transacted() // .getA...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateCalendarParameter() { Calendar c = GregorianCalendar.from(ZonedDateTime.parse("2017-03-25T15:37Z")); try (Database db = db()) { db.update("update person set registered=?") // .parameter(c) // ...
#vulnerable code @Test public void testUpdateCalendarParameter() { Calendar c = GregorianCalendar.from(ZonedDateTime.parse("2017-03-25T15:37Z")); Database db = db(); db.update("update person set registered=?") // .parameter(c) // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(expected = NullPointerException.class) public void testSelectUsingNullNameInParameter() { try (Database db = db()) { db // .select("select score from person where name=:name") // .parameter(null, "FRED"); /...
#vulnerable code @Test(expected = NullPointerException.class) public void testSelectUsingNullNameInParameter() { db() // .select("select score from person where name=:name") // .parameter(null, "FRED"); // } #l...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectTransactedTuple2() { try (Database db = db()) { Tx<Tuple2<String, Integer>> t = db // .select("select name, score from person where name=?") // .parameters("FRED") // ...
#vulnerable code @Test public void testSelectTransactedTuple2() { Tx<Tuple2<String, Integer>> t = db() // .select("select name, score from person where name=?") // .parameters("FRED") // .transacted() // .getAs(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testUpdateSqlDateParameter() { try (Database db = db()) { java.sql.Date t = new java.sql.Date(1234); db.update("update person set registered=?") // .parameter(t) // .counts() // ...
#vulnerable code @Test public void testUpdateSqlDateParameter() { Database db = db(); java.sql.Date t = new java.sql.Date(1234); db.update("update person set registered=?") // .parameter(t) // .counts() // .tes...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testInsertClobAndReadClobUsingReader() { try (Database db = db()) { db.update("insert into person_clob(name,document) values(?,?)") // .parameters("FRED", "some text here") // .counts() // ...
#vulnerable code @Test public void testInsertClobAndReadClobUsingReader() { Database db = db(); db.update("insert into person_clob(name,document) values(?,?)") // .parameters("FRED", "some text here") // .counts() // .t...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testTransactedReturnGeneratedKeys2() { try (Database db = db()) { // note is a table with auto increment Flowable<Integer> a = db.update("insert into note(text) values(?)") // .parameters("HI", "THERE")...
#vulnerable code @Test public void testTransactedReturnGeneratedKeys2() { Database db = db(); // note is a table with auto increment Flowable<Integer> a = db.update("insert into note(text) values(?)") // .parameters("HI", "THERE") // ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void sendMessage(CommandIssuer issuer, MessageType type, MessageKeyProvider key, String... replacements) { String message = formatMessage(issuer, type, key, replacements); for (String msg : ACFPatterns.NEWLINE.split(message)) { issuer.sendM...
#vulnerable code public void sendMessage(CommandIssuer issuer, MessageType type, MessageKeyProvider key, String... replacements) { String message = getLocales().getMessage(issuer, key.getMessageKey()); if (replacements.length > 0) { message = ACFUtil.replaceS...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<String> tabComplete(CommandIssuer issuer, String commandLabel, String[] args) { return tabComplete(issuer, commandLabel, args, false); }
#vulnerable code public List<String> tabComplete(CommandIssuer issuer, String commandLabel, String[] args) throws IllegalArgumentException { commandLabel = commandLabel.toLowerCase(); try { CommandOperationContext commandOperationContext = preCommand...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void stop() { if (State.TRANSCRIBING.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now finishing up"); updateDDClient(DD_ASPECT_STOP); this.state = State.FINISHI...
#vulnerable code public void stop() { if (State.TRANSCRIBING.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now finishing up"); StatsDClient dClient = JigasiBundleActivator.getDataDogClient(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void updatePresenceStatusForXmppProviders() { Collection<ServiceReference<ProtocolProviderService>> refs = ServiceUtils.getServiceReferences( osgiContext, ProtocolProviderService.class); for (ServiceRefe...
#vulnerable code private void updatePresenceStatusForXmppProviders() { SipGateway gateway = ServiceUtils.getService( osgiContext, SipGateway.class); int participants = 0; for(SipGatewaySession ses : gateway.getActiveSessions()) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void start() { if (State.NOT_STARTED.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now transcribing"); updateDDClient(DD_ASPECT_START); this.state = State.TRANSC...
#vulnerable code public void start() { if (State.NOT_STARTED.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now transcribing"); StatsDClient dClient = JigasiBundleActivator.getDataDogClient(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void notifyCallEnded(String callResource) { GatewaySession session; synchronized (sessions) { session = sessions.remove(callResource); if (session == null) { // FIXME: print some gateway ID or p...
#vulnerable code void notifyCallEnded(String callResource) { GatewaySession session; synchronized (sessions) { session = sessions.remove(callResource); if (session == null) { // FIXME: print some gateway I...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void stop() { if (State.TRANSCRIBING.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now finishing up"); updateDDClient(DD_ASPECT_STOP); this.state = State.FINISHI...
#vulnerable code public void stop() { if (State.TRANSCRIBING.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now finishing up"); StatsDClient dClient = JigasiBundleActivator.getDataDogClient(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void stop() { if (State.TRANSCRIBING.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now finishing up"); updateDDClient(DD_ASPECT_STOP); this.state = State.FINISHI...
#vulnerable code public void stop() { if (State.TRANSCRIBING.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now finishing up"); StatsDClient dClient = JigasiBundleActivator.getDataDogClient(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void sendPresenceExtension(ExtensionElement extension) { if (mucRoom != null) { // Send presence update OperationSetJitsiMeetTools jitsiMeetTools = xmppProvider.getOperationSet( OperationSetJitsiM...
#vulnerable code void setPresenceStatus(String statusMsg) { if (mucRoom != null) { // Send presence status update OperationSetJitsiMeetTools jitsiMeetTools = xmppProvider.getOperationSet( OperationSetJitsiMe...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void checkIfFinishedUp() { if (State.FINISHING_UP.equals(this.state)) { synchronized (this.participants) { for (Participant participant : participants.values()) { if (!participant....
#vulnerable code void checkIfFinishedUp() { if (State.FINISHING_UP.equals(this.state)) { synchronized (this.participants) { for (Participant participant : participants.values()) { if (!partic...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void sendPresenceExtension(ExtensionElement extension) { if (mucRoom != null) { // Send presence update OperationSetJitsiMeetTools jitsiMeetTools = xmppProvider.getOperationSet( OperationSetJitsiM...
#vulnerable code void setPresenceStatus(String statusMsg) { if (mucRoom != null) { // Send presence status update OperationSetJitsiMeetTools jitsiMeetTools = xmppProvider.getOperationSet( OperationSetJitsiMe...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public synchronized void stop() { if (!started) { logger.error(this.callContext + " Already stopped !"); return; } started = false; JigasiBundleActivator.osgiContext.removeServiceListener(this); if...
#vulnerable code public synchronized void stop() { if (!started) { logger.error(this.callContext + " Already stopped !"); return; } started = false; JigasiBundleActivator.osgiContext.removeServiceListener(this); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void start() { if (State.NOT_STARTED.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now transcribing"); updateDDClient(DD_ASPECT_START); this.state = State.TRANSC...
#vulnerable code public void start() { if (State.NOT_STARTED.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now transcribing"); StatsDClient dClient = JigasiBundleActivator.getDataDogClient(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void start() { if (State.NOT_STARTED.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now transcribing"); updateDDClient(DD_ASPECT_START); this.state = State.TRANSC...
#vulnerable code public void start() { if (State.NOT_STARTED.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now transcribing"); StatsDClient dClient = JigasiBundleActivator.getDataDogClient(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void onConferenceCallInvited(Call incomingCall) { // Incoming SIP connection mode sets common conference here if (destination == null) { incomingCall.setConference(sipCall.getConference()); boolean useTranslator = incomingC...
#vulnerable code void onJvbConferenceStopped(JvbConference jvbConference, int reasonCode, String reason) { this.jvbConference = null; if (sipCall != null) { hangUp(reasonCode, reason); } else ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void start() { if (State.NOT_STARTED.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now transcribing"); updateDDClient(DD_ASPECT_START); this.state = State.TRANSC...
#vulnerable code public void start() { if (State.NOT_STARTED.equals(this.state)) { if (logger.isDebugEnabled()) logger.debug("Transcriber is now transcribing"); StatsDClient dClient = JigasiBundleActivator.getDataDogClient(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void onConferenceCallInvited(Call incomingCall) { // Incoming SIP connection mode sets common conference here if (destination == null) { call.setConference(incomingCall.getConference()); boolean useTranslator = incomingCall...
#vulnerable code void onJvbConferenceStopped(JvbConference jvbConference, int reasonCode, String reason) { this.jvbConference = null; if (call != null) { hangUp(reasonCode, reason); } else {...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public String pay(final String target, final Cash amount, final String details) throws IOException { final Props props = new Props(this.farm); final Coinbase base = new CoinbaseBuilder().withApiKey( props.get("//coinbase/key")...
#vulnerable code @Override public String pay(final String target, final Cash amount, final String details) throws IOException { if (amount.compareTo(new Cash.S("$20")) < 0) { throw new SoftException( new Par( "The amoun...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public String pay(final Project project, final String login, final Cash amount, final String reason) throws IOException { final People people = new People(this.farm).bootstrap(); final String wallet = people.wallet(login); if (wallet.is...
#vulnerable code public String pay(final Project project, final String login, final Cash amount, final String reason) throws IOException { final People people = new People(this.farm).bootstrap(); final String wallet = people.wallet(login); if (wal...
Below is the vulnerable code, please generate the patch based on the following information.