input stringlengths 205 73.3k | output stringlengths 64 73.2k | instruction stringclasses 1
value |
|---|---|---|
#vulnerable code
@Test
public void testPropertiesNotBeingCachedOnVertexOut() {
Vertex v1 = this.sqlgGraph.addVertex(T.label, "Person");
Vertex v2 = this.sqlgGraph.addVertex(T.label, "Car", "name", "a");
Vertex v3 = this.sqlgGraph.addVertex(T.label, "Car", "n... | #fixed code
@Test
public void testPropertiesNotBeingCachedOnVertexOut() {
Vertex v1 = this.sqlgGraph.addVertex(T.label, "Person");
Vertex v2 = this.sqlgGraph.addVertex(T.label, "Car", "name", "a");
Vertex v3 = this.sqlgGraph.addVertex(T.label, "Car", "name", ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testIdNotLoadedAsProperty() throws Exception {
Vertex v = this.sqlgGraph.addVertex(T.label, "Person", "name", "a");
this.sqlgGraph.tx().commit();
this.sqlgGraph.close();
try (SqlgGraph sqlgGraph1 = SqlgGraph.open(con... | #fixed code
@Test
public void testIdNotLoadedAsProperty() throws Exception {
Vertex v = this.sqlgGraph.addVertex(T.label, "Person", "name", "a");
this.sqlgGraph.tx().commit();
this.sqlgGraph.close();
try (SqlgGraph sqlgGraph1 = SqlgGraph.open(configura... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testLoadEdgeProperties() {
Vertex marko = this.sqlgGraph.addVertex(T.label, "Person", "name", "marko");
Vertex john = this.sqlgGraph.addVertex(T.label, "Person", "name", "john");
Edge friend = marko.addEdge("friend", john, "... | #fixed code
@Test
public void testLoadEdgeProperties() {
Vertex marko = this.sqlgGraph.addVertex(T.label, "Person", "name", "marko");
Vertex john = this.sqlgGraph.addVertex(T.label, "Person", "name", "john");
Edge friend = marko.addEdge("friend", john, "weight... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testLoadingDatasourceFromJndi() throws Exception {
SqlgGraph g = SqlgGraph.open(configuration);
assertNotNull(g.getSqlDialect());
assertNotNull(g.getSqlgDataSource().get(configuration.getString("jdbc.url")));
}
... | #fixed code
@Test
public void testLoadingDatasourceFromJndi() throws Exception {
SqlgGraph g = SqlgGraph.open(configuration);
assertNotNull(g.getSqlDialect());
assertEquals(configuration.getString("jdbc.url"), g.getJdbcUrl());
assertNotNull(g.getConnec... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@POST
@Path(value = "test")
@Produces(MediaType.APPLICATION_JSON)
public Map<String, Object> test(@Context Repository repository,
@FormParam(Notifier.JENKINS_BASE) String jenkinsBase,
@FormParam(Notifier.CLONE_TYPE) String cloneType,
@FormPar... | #fixed code
@POST
@Path(value = "test")
@Produces(MediaType.APPLICATION_JSON)
public Map<String, Object> test(@Context Repository repository,
@FormParam(Notifier.JENKINS_BASE) String jenkinsBase,
@FormParam(Notifier.CLONE_TYPE) String cloneType,
@FormParam(Not... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args) throws Exception {
MongoCollection<Document> eventCollection =
new MongoClient(
new MongoClientURI("mongodb://localhost:27001,localhost:27002,localhost:27003/test?replicatSet=demo-dev")
).getDatabase("test").getColle... | #fixed code
public static void main(String[] args) throws Exception {
try (MongoClient client = new MongoClient(Connection.URI)) {
MongoCollection<Document> eventCollection =
client.getDatabase("test").getCollection("events");
long i = 0;
while (tru... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args) throws Exception {
MongoCollection<Document> eventCollection =
new MongoClient(
new MongoClientURI("mongodb://localhost:27001,localhost:27002,localhost:27003/test?replicatSet=demo-dev")
).getD... | #fixed code
public static void main(String[] args) throws Exception {
try (MongoClient client = new MongoClient(Connection.URI)) {
MongoCollection<Document> eventCollection =
client.getDatabase("test").getCollection("events");
ChangeStreamIterable<Document> chang... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void start(int port, SSLContext context, boolean authReq) throws IOException {
SocketConnection socketConnection = new SocketConnection(authReq ? new AuthRequiredServer(server) : server);
socketConnection.connect(new InetSocketAddress(port), con... | #fixed code
@Override
public void start(int port, SSLContext context, boolean authReq) throws IOException {
ContainerSocketProcessor server = new ContainerSocketProcessor(this, count, select);
socketConnection = new SocketConnection(authReq ? new AuthRequiredServer(server) : serv... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public FloatProcessor toFloat(int channelNumber, FloatProcessor fp)
{
int width = getWidth();
int height = getHeight();
long size = getNumPixels(this.imageData);
if (fp == null || fp.getWidth()!=width || fp.getHeight()!=height)
fp = new FloatPr... | #fixed code
@Override
public FloatProcessor toFloat(int channelNumber, FloatProcessor fp)
{
int width = getWidth();
int height = getHeight();
long size = ImageUtils.getTotalSamples(this.imageData);
if (fp == null || fp.getWidth()!=width || fp.getHeight()!=height)
fp = new... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void undoFilter() {
if (ip!=null) {
ip.reset();
updateAndDraw();
}
}
#location 4
#vulnerability type THREAD_SAFETY_VIOLATION | #fixed code
void invertLookupTable() {
int nImages = getStackSize();
ip.invertLut();
if (nImages==1)
ip.invert();
else {
ImageStack stack2 = getStack();
for (int i=1; i<=nImages; i++)
stack2.getProcessor(i).invert();
stack2.setColorModel(ip.getColorModel());
}
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void setPixels(Object pixels)
{
int[] position = Index.create(0, 0, getPlanePosition());
setImagePlanePixels(this.imageData, position, pixels);
}
#location 4
#vulnerability type NULL_DEREF... | #fixed code
@Override
public void setPixels(Object pixels)
{
setImagePlanePixels(this.imageData, getPlanePosition(), pixels);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public AttributeBuilder nodeAttributes(String groupId, String artifactId, String version, String scopes, String effectiveScope) {
Map<String, ? extends AbstractNode> scopedNodes = getScopedNodes();
AbstractNode node = scopedNodes.containsKey(effectiveScope) ? scop... | #fixed code
public AttributeBuilder nodeAttributes(String groupId, String artifactId, String version, String scopes, String effectiveScope) {
AbstractNode node = this.scopeStyles.containsKey(effectiveScope) ? this.scopeStyles.get(effectiveScope) : this.defaultNode;
return node.crea... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private String downloadNzb(SearchResultEntity result) throws IOException {
Request request = new Request.Builder().url(result.getLink()).build();
Indexer indexerByName = searchModuleProvider.getIndexerByName(result.getIndexer().getName());
Intege... | #fixed code
private String downloadNzb(SearchResultEntity result) throws IOException {
Request request = new Request.Builder().url(result.getLink()).build();
Indexer indexerByName = searchModuleProvider.getIndexerByName(result.getIndexer().getName());
Integer time... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@PreDestroy
public void destroy() {
String osName = System.getProperty("os.name");
boolean isOsWindows = osName.toLowerCase().contains("windows");
if (isOsWindows) {
logger.debug("Initiating removal of windows tray icon (if it exi... | #fixed code
@PreDestroy
public void destroy() {
boolean isOsWindows = isOsWindows();
if (isOsWindows) {
logger.debug("Initiating removal of windows tray icon (if it exists)");
try {
WindowsTrayIcon.remove();
} catch ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void testExecute() throws Exception {
MockWebServer server = new MockWebServer();
Release draftReleaseResponse = new Release();
draftReleaseResponse.setUploadUrl(server.url("/repos/theotherp/nzbhydra2/releases/1/assets").toString());
... | #fixed code
public void testExecute() throws Exception {
MockWebServer server = getMockWebServer();
HttpUrl url = server.url("/repos/theotherp/nzbhydra2/releases");
//Here the magic happens
File pom = getTestFile("/src/test/resources/org/nzbhydra/github/m... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@PostConstruct
private void addTrayIconIfApplicable() {
String osName = System.getProperty("os.name");
boolean isOsWindows = osName.toLowerCase().contains("windows");
if (isOsWindows) {
logger.info("Adding windows system tray icon... | #fixed code
@PostConstruct
private void addTrayIconIfApplicable() {
boolean isOsWindows = isOsWindows();
if (isOsWindows) {
logger.info("Adding windows system tray icon");
try {
new WindowsTrayIcon();
} catch (Headle... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public BaseConfig originalConfig() throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(BaseConfig.class.getResource("/config/baseConfig.yml").openStream()));
String applicationYmlContent = reader.lines().collect(Collecto... | #fixed code
public BaseConfig originalConfig() throws IOException {
String applicationYmlContent;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(BaseConfig.class.getResource("/config/baseConfig.yml").openStream()))) {
applicationYmlConte... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void shouldSetEnabledOnDownloadEvent() {
testee.queueCheckEnabled = false;
testee.lastDownload = null;
testee.onNzbDownloadEvent(new FileDownloadEvent(null, null));
assertThat(testee.queueCheckEnabled).isTrue();
... | #fixed code
@Test
public void shouldSetEnabledOnDownloadEvent() {
testee.queueCheckEnabled = false;
testee.lastDownload = null;
testee.onNzbDownloadEvent(new FileDownloadEvent(new FileDownloadEntity(), new SearchResultEntity()));
assertThat(testee.qu... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void shouldMigrate() {
HashMap<String, Object> input = new HashMap<>(ImmutableMap.of("main", new HashMap<>(ImmutableMap.of("configVersion", 1))));
HashMap<String, Object> afterMigration = new HashMap<>(ImmutableMap.of("main", new HashMap... | #fixed code
@Test
public void shouldMigrate() {
BaseConfig input = new BaseConfig();
input.getMain().setConfigVersion(1);
BaseConfig afterMigration = new BaseConfig();
afterMigration.getMain().setConfigVersion(2);
when(configMigrationStepMock.... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@RequestMapping(value = {"/api", "/dognzb/api"}, produces = MediaType.TEXT_XML_VALUE)
public ResponseEntity<? extends Object> api(NewznabParameters params, HttpServletRequest request) throws Exception {
if (params.getT() == ActionAttribute.CAPS) {
... | #fixed code
@RequestMapping(value = {"/api", "/dognzb/api"}, produces = MediaType.TEXT_XML_VALUE)
public ResponseEntity<? extends Object> api(NewznabParameters params, HttpServletRequest request) throws Exception {
if (params.getT() == ActionAttribute.CAPS) {
//t... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void migrateIndexerApiAccesses(Map<Integer, IndexerEntity> oldIdToIndexersMap) throws SQLException {
Statement statement = connection.createStatement();
int countIndexerApiAccesses = getCount(statement, "INDEXERAPIACCESS");
logger.info("M... | #fixed code
private void migrateIndexerApiAccesses(Map<Integer, IndexerEntity> oldIdToIndexersMap) throws SQLException {
Statement statement = connection.createStatement();
int countIndexerApiAccesses = getCount(statement, "INDEXERAPIACCESS");
logger.info("Migrati... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void buildVariablesFor(AbstractBuild build, Map<String, String> variables) {
final Executor executor = build.getExecutor();
if (executor != null && executor.getOwner() instanceof DockerComputer) {
final DockerComputer doc... | #fixed code
@Override
public void buildVariablesFor(AbstractBuild build, Map<String, String> variables) {
final Executor executor = build.getExecutor();
if (executor != null && executor.getOwner() instanceof DockerComputer) {
final DockerComputer dockerCom... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testAddingVmargsInBeforeContainerCreated() throws IOException, InterruptedException {
String vmargs = "-Dhttp.proxyPort=8080";
DockerComputerJNLPConnector connector = new DockerComputerJNLPConnector(new JNLPLauncher(null, vmargs));... | #fixed code
@Test
public void testAddingVmargsInBeforeContainerCreated() throws IOException, InterruptedException {
// Given
final String vmargs = "-Dhttp.proxyPort=8080";
final DockerComputerJNLPConnector connector = new DockerComputerJNLPConnector(new JNLPLa... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public synchronized Collection<NodeProvisioner.PlannedNode> provision(Label label, int excessWorkload) {
try {
LOGGER.log(Level.INFO, "Asked to provision {0} slave(s) for: {1}", new Object[]{excessWorkload,label});
List<No... | #fixed code
@Override
public synchronized Collection<NodeProvisioner.PlannedNode> provision(Label label, int excessWorkload) {
try {
LOGGER.log(Level.INFO, "Asked to provision {0} slave(s) for: {1}", new Object[]{excessWorkload,label});
List<NodeProvi... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testKeepingEvnInBeforeContainerCreated() throws IOException, InterruptedException {
String env1 = "ENV1=val1";
DockerComputerJNLPConnector connector = new DockerComputerJNLPConnector(new JNLPLauncher(null, "-Dhttp.proxyPort=8080"))... | #fixed code
@Test
public void testKeepingEvnInBeforeContainerCreated() throws IOException, InterruptedException {
// Given
final String env1 = "ENV1=val1";
final String vmargs = "-Dhttp.proxyPort=8080";
final DockerComputerJNLPConnector connector = new... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void pullImage(DockerTemplate dockerTemplate) throws IOException {
final String imageName = dockerTemplate.getDockerTemplateBase().getImage();
if (shouldPullImage(imageName, dockerTemplate.getPullStrategy())) {
LOGGER.info("Pulling... | #fixed code
private void pullImage(DockerTemplate dockerTemplate) throws IOException {
final String imageName = dockerTemplate.getDockerTemplateBase().getImage();
if (shouldPullImage(imageName, dockerTemplate.getPullStrategy())) {
LOGGER.info("Pulling image... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public RpcResponse send(RpcRequest request) throws Exception {
EventLoopGroup group = new NioEventLoopGroup();
try {
Bootstrap bootstrap = new Bootstrap();
bootstrap.group(group).channel(NioSocketChannel.class).handler(new ChannelInitializer<SocketChannel>() {
... | #fixed code
public RpcResponse send(RpcRequest request) throws Exception {
EventLoopGroup group = new NioEventLoopGroup();
try {
Bootstrap bootstrap = new Bootstrap();
bootstrap.group(group)
.channel(NioSocketChannel.class)
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testDecompressionWithZLIB() throws Exception {
// ZLIB compress message.
byte[] compressMe = this.originalMessage.getBytes();
byte[] compressedMessage = new byte[compressMe.length];
Deflater compressor = new Deflater... | #fixed code
@Test
public void testDecompressionWithZLIB() throws Exception {
// Build a datagram packet.
DatagramPacket gelfMessage = GELFTestHelper.buildZLIBCompressedDatagramPacket(this.originalMessage);
// Let the decompression take place.
SimpleGE... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static double heightDegrees(int n) {
if (hashHeightCache.get(n) == null) {
double a;
if (n % 2 == 0)
a = -1;
else
a = -0.5;
double result = 90 / Math.pow(2, 2.5 * n + a);
hashHeightCache.put(n, result);
}
return hashHeightCache.get(n);
... | #fixed code
public static double heightDegrees(int n) {
if (hashHeightCache[n - 1] == null) {
double a;
if (n % 2 == 0)
a = -1;
else
a = -0.5;
double result = 90 / Math.pow(2, 2.5 * n + a);
hashHeightCache[n - 1] = result;
}
return hashHeightCache[n - 1];
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void add(double lat, double lon, long time, T t, long expiryTime) {
String hash = GeoHash.encodeHash(lat, lon);
for (int i = 1; i <= hash.length(); i++) {
String key = hash.substring(0, i);
if (map.get(key) == null) {
map.put(key, Maps.<Long, T> newTre... | #fixed code
public void add(double lat, double lon, long time, T t, long expiryTime) {
String hash = GeoHash.encodeHash(lat, lon);
// full hash length is 12 so this will insert 12 entries
for (int i = 1; i <= hash.length(); i++) {
long key = Base32.dec... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testDeleteViewIndexSequences() throws Exception {
createBaseTable(tableName, false, null, null);
Connection conn1 = getConnection();
Connection conn2 = getConnection();
conn1.createStatement().execute("CREATE VIEW " ... | #fixed code
@Test
public void testDeleteViewIndexSequences() throws Exception {
createBaseTable(tableName, false, null, null);
Connection conn1 = getConnection();
Connection conn2 = getConnection();
String viewName = schemaName + "." + VIEW_NAME;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static Object[] coerceToNewLength(PDataType baseType, Object[] elements, int maxLength) {
Object[] resizedElements = new Object[elements.length];
for (int i = 0; i < elements.length; i++) {
int length = baseType.getMaxLength(elements[i])... | #fixed code
private static Object[] coerceToNewLength(PDataType baseType, Object[] elements, int maxLength) {
Object[] resizedElements = new Object[elements.length];
for (int i = 0; i < elements.length; i++) {
Integer length = baseType.getMaxLength(elements[i]);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private PTable doGetTable(byte[] tenantId, byte[] schemaName, byte[] tableName,
long clientTimeStamp, RowLock rowLock, int clientVersion, boolean skipAddingIndexes,
boolean skipAddingParentColumns, PTable lockedAncestorTable) throws IOException, ... | #fixed code
private PTable doGetTable(byte[] tenantId, byte[] schemaName, byte[] tableName,
long clientTimeStamp, RowLock rowLock, int clientVersion, boolean skipAddingIndexes,
boolean skipAddingParentColumns, PTable lockedAncestorTable) throws IOException, SQLExc... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void close() throws SQLException {
SQLException sqlE = null;
try {
// Attempt to return any unused sequences.
returnAllSequences(this.sequenceMap);
} catch (SQLException e) {
sqlE = e;
... | #fixed code
@Override
public void close() throws SQLException {
if (closed) {
return;
}
synchronized (this) {
if (closed) {
return;
}
closed = true;
SQLException sqlE = null;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public Expression visitLeave(ArrayConstructorNode node, List<Expression> children) throws SQLException {
boolean isChildTypeUnknown = false;
Expression arrayElemChild = null;
PDataType arrayElemDataType = children.get(0).getDataType... | #fixed code
@Override
public Expression visitLeave(ArrayConstructorNode node, List<Expression> children) throws SQLException {
boolean isChildTypeUnknown = false;
Expression arrayElemChild = null;
PDataType arrayElemDataType = children.get(0).getDataType();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public boolean next(List<Cell> results) throws IOException {
if (indexRowKey != null &&
singleRowRebuildReturnCode == GlobalIndexChecker.RebuildReturnCode.NO_DATA_ROW.getValue()) {
byte[] rowCountBytes =
... | #fixed code
@Override
public boolean next(List<Cell> results) throws IOException {
if (indexRowKey != null &&
singleRowRebuildReturnCode == GlobalIndexChecker.RebuildReturnCode.NO_DATA_ROW.getValue()) {
byte[] rowCountBytes =
PL... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public int executeStatements(Reader reader, List<Object> binds, PrintStream out) throws IOException, SQLException {
int bindsOffset = 0;
int nStatements = 0;
PhoenixStatementParser parser = new PhoenixStatementParser(reader);
try {
... | #fixed code
public int executeStatements(Reader reader, List<Object> binds, PrintStream out) throws IOException, SQLException {
int bindsOffset = 0;
int nStatements = 0;
PhoenixStatementParser parser = new PhoenixStatementParser(reader);
try {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void modifyTable(byte[] tableName, HTableDescriptor newDesc) throws IOException,
InterruptedException, TimeoutException {
HBaseAdmin admin = new HBaseAdmin(config);
if (!allowOnlineTableSchemaUpdate()) {
admin.di... | #fixed code
@Override
public void modifyTable(byte[] tableName, HTableDescriptor newDesc) throws IOException,
InterruptedException, TimeoutException {
try (HBaseAdmin admin = new HBaseAdmin(config)) {
if (!allowOnlineTableSchemaUpdate()) {
admin.disableTable(tab... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testSystemCatalogWALEntryFilter() throws Exception {
//now create WAL.Entry objects that refer to cells in those view rows in System.Catalog
Get tenantGet = getGet(catalogTable, TENANT_BYTES, TENANT_VIEW_NAME);
Get nonTenantGet = getGet(c... | #fixed code
@Test
public void testSystemCatalogWALEntryFilter() throws Exception {
//now create WAL.Entry objects that refer to cells in those view rows in System.Catalog
Get tenantViewGet = getTenantViewGet(catalogTable, TENANT_BYTES, TENANT_VIEW_NAME);
Get nonTenantViewGe... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testSelectUpsertWithNewClient() throws Exception {
checkForPreConditions();
// Insert data with old client and read with new client
executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
executeQueriesWi... | #fixed code
@Test
public void testSelectUpsertWithNewClient() throws Exception {
// Insert data with old client and read with new client
executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
executeQueriesWithCurrentVersion(QUERY);
assert... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testUpsertSelectSameBatchConcurrently() throws Exception {
final String dataTable = generateUniqueName();
final String index = "IDX_" + dataTable;
// create the table and ensure its empty
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES... | #fixed code
@Test
public void testUpsertSelectSameBatchConcurrently() throws Exception {
try (Connection conn = driver.connect(url, props)) {
int numUpsertSelectRunners = 5;
ExecutorService exec = Executors.newFixedThreadPool(numUpsertSelectRunners);
Complet... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected static void setupTxManager() throws SQLException, IOException {
TransactionFactory.getTransactionFactory().getTransactionContext().setupTxManager(config, getUrl());
}
#location 2
#vulnerabil... | #fixed code
protected static void setupTxManager() throws SQLException, IOException {
TransactionFactory.getTransactionProvider().getTransactionContext().setupTxManager(config, getUrl());
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testExternalTxContext() throws Exception {
ResultSet rs;
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = DriverManager.getConnection(getUrl(), props);
conn.setAutoCommit(false);
... | #fixed code
@Test
public void testExternalTxContext() throws Exception {
ResultSet rs;
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = DriverManager.getConnection(getUrl(), props);
conn.setAutoCommit(false);
Strin... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testUpsertDeleteWithNewClient() throws Exception {
checkForPreConditions();
// Insert data with old client and read with new client
executeQueriesWithCurrentVersion(CREATE_ADD);
executeQueryWithClientVersion(compatib... | #fixed code
@Test
public void testUpsertDeleteWithNewClient() throws Exception {
// Insert data with old client and read with new client
executeQueriesWithCurrentVersion(CREATE_ADD);
executeQueryWithClientVersion(compatibleClientVersion, QUERY);
assert... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public Expression visitLeave(ArrayConstructorNode node, List<Expression> children) throws SQLException {
boolean isChildTypeUnknown = false;
Expression arrayElemChild = null;
PDataType arrayElemDataType = children.get(0).getDataType... | #fixed code
@Override
public Expression visitLeave(ArrayConstructorNode node, List<Expression> children) throws SQLException {
boolean isChildTypeUnknown = false;
Expression arrayElemChild = null;
PDataType arrayElemDataType = children.get(0).getDataType();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testIndexRebuildTask() throws Throwable {
String baseTable = generateUniqueName();
Connection conn = null;
Connection viewConn = null;
try {
conn = DriverManager.getConnection(getUrl());
conn.... | #fixed code
@Test
public void testIndexRebuildTask() throws Throwable {
String baseTable = generateUniqueName();
String viewName = generateUniqueName();
Connection conn = null;
Connection tenantConn = null;
try {
conn = DriverManage... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void modifyTable(byte[] tableName, HTableDescriptor newDesc) throws IOException,
InterruptedException, TimeoutException {
HBaseAdmin admin = new HBaseAdmin(config);
if (!allowOnlineTableSchemaUpdate()) {
admin.di... | #fixed code
@Override
public void modifyTable(byte[] tableName, HTableDescriptor newDesc) throws IOException,
InterruptedException, TimeoutException {
try (HBaseAdmin admin = new HBaseAdmin(config)) {
if (!allowOnlineTableSchemaUpdate()) {
admin.disableTable(tab... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
protected void reduce(TableRowkeyPair key, Iterable<ImmutableBytesWritable> values,
Reducer<TableRowkeyPair, ImmutableBytesWritable, TableRowkeyPair, KeyValue>.Context context)
throws IOException, InterruptedException ... | #fixed code
@Override
protected void reduce(TableRowkeyPair key, Iterable<ImmutableBytesWritable> values,
Reducer<TableRowkeyPair, ImmutableBytesWritable, TableRowkeyPair, KeyValue>.Context context)
throws IOException, InterruptedException {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testSystemCatalogWALEntryFilter() throws Exception {
//now create WAL.Entry objects that refer to cells in those view rows in System.Catalog
Get tenantGet = getGet(catalogTable, TENANT_BYTES, TENANT_VIEW_NAME);
Get nonTenantGet = getGet(c... | #fixed code
@Test
public void testSystemCatalogWALEntryFilter() throws Exception {
//now create WAL.Entry objects that refer to cells in those view rows in System.Catalog
Get tenantViewGet = getTenantViewGet(catalogTable, TENANT_BYTES, TENANT_VIEW_NAME);
Get nonTenantViewGe... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static Object[] coerceToEqualLength(PDataType baseType, Object[] elements) {
if (elements == null || elements.length == 0) {
return elements;
}
Object element = elements[0];
int maxLength = baseType.getMaxLength(element);
boolean r... | #fixed code
private static Object[] coerceToEqualLength(PDataType baseType, Object[] elements) {
if (elements == null || elements.length == 0) {
return elements;
}
int maxLength = 0;
boolean resizeElements = false;
for (int i = 0; i < elements.leng... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private DeleteType getDeleteTypeOrNull(Collection<? extends Cell> pendingUpdates, int nCFs) {
int nDeleteCF = 0;
int nDeleteVersionCF = 0;
for (Cell kv : pendingUpdates) {
if (kv.getTypeByte() == KeyValue.Type.DeleteFamilyVersion.getCode... | #fixed code
private DeleteType getDeleteTypeOrNull(Collection<? extends Cell> pendingUpdates, int nCFs) {
int nDeleteCF = 0;
int nDeleteVersionCF = 0;
for (Cell kv : pendingUpdates) {
if (kv.getTypeByte() == KeyValue.Type.DeleteFamilyVersion.getCode()) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testIndexQos() throws Exception {
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = driver.connect(getUrl(), props);
try {
// create the table
conn.createStatement().exe... | #fixed code
@Test
public void testIndexQos() throws Exception {
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = driver.connect(getUrl(), props);
try {
// create the table
createTable(conn, dataTableFullNa... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
protected RegionScanner doPostScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c, final Scan scan, final RegionScanner s) throws IOException {
RegionCoprocessorEnvironment env = c.getEnvironment();
Region region = env.getRegi... | #fixed code
@Override
protected RegionScanner doPostScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c, final Scan scan, final RegionScanner s) throws IOException {
RegionCoprocessorEnvironment env = c.getEnvironment();
Region region = env.getRegion();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testUpsertDeleteWithOldClient() throws Exception {
checkForPreConditions();
// Insert data with old client and read with new client
executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
executeQueriesWi... | #fixed code
@Test
public void testUpsertDeleteWithOldClient() throws Exception {
// Insert data with old client and read with new client
executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
executeQueriesWithCurrentVersion(QUERY);
assert... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public boolean isFilterDone() { return hasMore; }
#location 2
#vulnerability type THREAD_SAFETY_VIOLATION | #fixed code
@Override
public boolean isFilterDone() { return false; } | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@SuppressWarnings("unchecked")
protected QueryPlan compileJoinQuery(StatementContext context, List<Object> binds, JoinTable joinTable, boolean asSubquery, boolean projectPKColumns, List<OrderByNode> orderBy) throws SQLException {
byte[] emptyByteArray = new ... | #fixed code
@SuppressWarnings("unchecked")
protected QueryPlan compileJoinQuery(StatementContext context, List<Object> binds, JoinTable joinTable, boolean asSubquery, boolean projectPKColumns, List<OrderByNode> orderBy) throws SQLException {
byte[] emptyByteArray = new byte[0... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testDeleteRowFromTableWithImmutableIndex() throws SQLException {
Connection con = null;
try {
boolean autoCommit = false;
con = DriverManager.getConnection(getUrl());
con.setAutoCommit(autoCommit)... | #fixed code
@Test
public void testDeleteRowFromTableWithImmutableIndex() throws SQLException {
testDeleteRowFromTableWithImmutableIndex(false);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void writeMetrics() throws Exception {
Connection conn = getConnectionWithoutTracing();
String tableName = generateUniqueName();
TraceSpanReceiver traceSpanReceiver = new TraceSpanReceiver();
latch = new CountDownLatch(1... | #fixed code
@Test
public void writeMetrics() throws Exception {
Connection conn = getConnectionWithoutTracing();
latch = new CountDownLatch(1);
testTraceWriter.start();
// create a simple metrics record
long traceid = 987654;
String d... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public boolean next(List<Cell> results) throws IOException {
if (indexRowKey != null &&
singleRowRebuildReturnCode == GlobalIndexChecker.RebuildReturnCode.NO_DATA_ROW.getValue()) {
byte[] rowCountBytes =
... | #fixed code
@Override
public boolean next(List<Cell> results) throws IOException {
if (indexRowKey != null &&
singleRowRebuildReturnCode == GlobalIndexChecker.RebuildReturnCode.NO_DATA_ROW.getValue()) {
byte[] rowCountBytes =
PL... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static long convertToNanoseconds(long serverTimeStamp) {
return serverTimeStamp * TransactionFactory.getTransactionFactory().getTransactionContext().getMaxTransactionsPerSecond();
}
#location 2
... | #fixed code
public static long convertToNanoseconds(long serverTimeStamp) {
return serverTimeStamp * TransactionFactory.getTransactionProvider().getTransactionContext().getMaxTransactionsPerSecond();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testDeleteViewIndexSequences() throws Exception {
createBaseTable(tableName, false, null, null);
Connection conn1 = getConnection();
Connection conn2 = getConnection();
conn1.createStatement().execute("CREATE VIEW " ... | #fixed code
@Test
public void testDeleteViewIndexSequences() throws Exception {
createBaseTable(tableName, false, null, null);
Connection conn1 = getConnection();
Connection conn2 = getConnection();
String viewName = schemaName + "." + VIEW_NAME;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public byte[] buildRowKey(ValueGetter valueGetter, ImmutableBytesWritable rowKeyPtr, byte[] regionStartKey, byte[] regionEndKey, long ts) {
ImmutableBytesWritable ptr = new ImmutableBytesWritable();
boolean prependRegionStartKey = isLocalIndex && region... | #fixed code
public byte[] buildRowKey(ValueGetter valueGetter, ImmutableBytesWritable rowKeyPtr, byte[] regionStartKey, byte[] regionEndKey, long ts) {
ImmutableBytesWritable ptr = new ImmutableBytesWritable();
boolean prependRegionStartKey = isLocalIndex && regionStartK... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testCSVCommonsUpsert_WithArray() throws Exception {
CSVParser parser = null;
PhoenixConnection conn = null;
try {
// Create table
String statements = "CREATE TABLE IF NOT EXISTS ARRAY_TABLE "
... | #fixed code
@Test
public void testCSVCommonsUpsert_WithArray() throws Exception {
CSVParser parser = null;
PhoenixConnection conn = null;
try {
// Create table
String statements = "CREATE TABLE IF NOT EXISTS ARRAY_TABLE "
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private String makeQueryString(JobConf jobConf, String tableName, List<String>
readColumnList, String whereClause, String queryTemplate, String hints, Map<String,
TypeInfo> columnTypeMap) throws IOException {
StringBuilder sql = new Strin... | #fixed code
private String makeQueryString(JobConf jobConf, String tableName, List<String>
readColumnList, String whereClause, String queryTemplate, String hints, Map<String,
TypeInfo> columnTypeMap) throws IOException {
StringBuilder sql = new StringBuild... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void initTxServiceClient() {
txZKClientService = TransactionFactory.getTransactionFactory().getTransactionContext().setTransactionClient(config, props, connectionInfo);
}
#location 2
#vulnerab... | #fixed code
private void initTxServiceClient() {
txZKClientService = TransactionFactory.getTransactionProvider().getTransactionContext().setTransactionClient(config, props, connectionInfo);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testUpsertWithOldClient() throws Exception {
checkForPreConditions();
// Insert data with old client and read with new client
executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
executeQueriesWithCurr... | #fixed code
@Test
public void testUpsertWithOldClient() throws Exception {
// Insert data with old client and read with new client
executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
executeQueriesWithCurrentVersion(QUERY);
assertExpect... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public boolean next(List<Cell> results) throws IOException {
if (indexRowKey != null &&
singleRowRebuildReturnCode == GlobalIndexChecker.RebuildReturnCode.NO_DATA_ROW.getValue()) {
byte[] rowCountBytes =
... | #fixed code
@Override
public boolean next(List<Cell> results) throws IOException {
if (indexRowKey != null &&
singleRowRebuildReturnCode == GlobalIndexChecker.RebuildReturnCode.NO_DATA_ROW.getValue()) {
byte[] rowCountBytes =
PL... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public DataValue getDataForRule(Scenario scenario, Column phxMetaColumn) throws Exception {
// TODO Make a Set of Rules that have already been applied so that so we don't generate for every value
List<Scenario> scenarios = parser.getScenarios();
... | #fixed code
public DataValue getDataForRule(Scenario scenario, Column phxMetaColumn) throws Exception {
// TODO Make a Set of Rules that have already been applied so that so we don't generate for every value
List<Scenario> scenarios = parser.getScenarios();
DataV... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testLocalIndexTableRegionSplitPolicyAndSplitKeys() throws Exception {
createBaseTable(DATA_TABLE_NAME, null,"('e','i','o')");
Connection conn1 = DriverManager.getConnection(getUrl());
Connection conn2 = DriverManager.getConn... | #fixed code
@Test
public void testLocalIndexTableRegionSplitPolicyAndSplitKeys() throws Exception {
createBaseTable(DATA_TABLE_NAME, null,"('e','i','o')");
Connection conn1 = DriverManager.getConnection(getUrl());
Connection conn2 = DriverManager.getConnection... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testUpsertSelectSameBatchConcurrently() throws Exception {
final String dataTable = generateUniqueName();
final String index = "IDX_" + dataTable;
// create the table and ensure its empty
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES... | #fixed code
@Test
public void testUpsertSelectSameBatchConcurrently() throws Exception {
try (Connection conn = driver.connect(url, props)) {
int numUpsertSelectRunners = 5;
ExecutorService exec = Executors.newFixedThreadPool(numUpsertSelectRunners);
Complet... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public byte[] buildRowKey(ValueGetter valueGetter, ImmutableBytesWritable rowKeyPtr, byte[] regionStartKey, byte[] regionEndKey, long ts) {
ImmutableBytesWritable ptr = new ImmutableBytesWritable();
boolean prependRegionStartKey = isLocalIndex && region... | #fixed code
public byte[] buildRowKey(ValueGetter valueGetter, ImmutableBytesWritable rowKeyPtr, byte[] regionStartKey, byte[] regionEndKey, long ts) {
ImmutableBytesWritable ptr = new ImmutableBytesWritable();
boolean prependRegionStartKey = isLocalIndex && regionStartK... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testIndexHalfStoreFileReader() throws Exception {
Connection conn1 = getConnection();
ConnectionQueryServices connectionQueryServices = driver.getConnectionQueryServices(getUrl(), TestUtil.TEST_PROPERTIES);
HBaseAdmin admin = conn... | #fixed code
@Test
public void testIndexHalfStoreFileReader() throws Exception {
Connection conn1 = getConnection();
ConnectionQueryServices connectionQueryServices = driver.getConnectionQueryServices(getUrl(), TestUtil.TEST_PROPERTIES);
HBaseAdmin admin = connection... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public boolean seekOrReseek(Cell cell, boolean isSeek) throws IOException{
KeyValue kv = PhoenixKeyValueUtil.maybeCopyCell(cell);
KeyValue keyToSeek = kv;
KeyValue splitKeyValue = KeyValueUtil.createKeyValueFromKey(reader.getSplitkey());
... | #fixed code
public boolean seekOrReseek(Cell cell, boolean isSeek) throws IOException{
Cell keyToSeek = cell;
KeyValue splitKeyValue = new KeyValue.KeyOnlyKeyValue(reader.getSplitkey());
if (reader.isTop()) {
if(this.comparator.compare(cell, splitKeyVa... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test(timeout=300000)
public void testWriteFailureDisablesIndex() throws Exception {
String query;
ResultSet rs;
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = driver.connect(url, props);
conn.... | #fixed code
@Test(timeout=300000)
public void testWriteFailureDisablesIndex() throws Exception {
testWriteFailureDisablesIndex(false);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void batchStarted(MiniBatchOperationInProgress<Mutation> miniBatchOp, IndexMetaData context) throws IOException {
// The entire purpose of this method impl is to get the existing rows for the
// table rows being indexed into the bloc... | #fixed code
@Override
public void batchStarted(MiniBatchOperationInProgress<Mutation> miniBatchOp, IndexMetaData context) throws IOException {
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testCSVCommonsUpsert_WithTimestamp() throws Exception {
CSVParser parser = null;
PhoenixConnection conn = null;
try {
// Create table
String statements = "CREATE TABLE IF NOT EXISTS TS_TABLE "
... | #fixed code
@Test
public void testCSVCommonsUpsert_WithTimestamp() throws Exception {
CSVParser parser = null;
PhoenixConnection conn = null;
try {
// Create table
String statements = "CREATE TABLE IF NOT EXISTS TS_TABLE "
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testLocalIndexTableRegionSplitPolicyAndSplitKeys() throws Exception {
createBaseTable(DATA_TABLE_NAME, null,"('e','i','o')");
Connection conn1 = DriverManager.getConnection(getUrl());
Connection conn2 = DriverManager.getConn... | #fixed code
@Test
public void testLocalIndexTableRegionSplitPolicyAndSplitKeys() throws Exception {
createBaseTable(DATA_TABLE_NAME, null,"('e','i','o')");
Connection conn1 = DriverManager.getConnection(getUrl());
Connection conn2 = DriverManager.getConnection... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static long convertToMilliseconds(long serverTimeStamp) {
return serverTimeStamp / TransactionFactory.getTransactionFactory().getTransactionContext().getMaxTransactionsPerSecond();
}
#location 2
... | #fixed code
public static long convertToMilliseconds(long serverTimeStamp) {
return serverTimeStamp / TransactionFactory.getTransactionProvider().getTransactionContext().getMaxTransactionsPerSecond();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testSelectUpsertWithOldClient() throws Exception {
checkForPreConditions();
// Insert data with new client and read with old client
executeQueriesWithCurrentVersion(CREATE_ADD);
executeQueryWithClientVersion(compatib... | #fixed code
@Test
public void testSelectUpsertWithOldClient() throws Exception {
// Insert data with new client and read with old client
executeQueriesWithCurrentVersion(CREATE_ADD);
executeQueryWithClientVersion(compatibleClientVersion, QUERY);
assert... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static void tearDownTxManager() throws SQLException {
TransactionFactory.getTransactionFactory().getTransactionContext().tearDownTxManager();
}
#location 2
#vulnerability type NULL_DEREFERENCE | #fixed code
private static void tearDownTxManager() throws SQLException {
TransactionFactory.getTransactionProvider().getTransactionContext().tearDownTxManager();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testSelectWithOldClient() throws Exception {
checkForPreConditions();
// Insert data with new client and read with old client
executeQueriesWithCurrentVersion(CREATE_ADD);
executeQueryWithClientVersion(compatibleClie... | #fixed code
@Test
public void testSelectWithOldClient() throws Exception {
// Insert data with new client and read with old client
executeQueriesWithCurrentVersion(CREATE_ADD);
executeQueryWithClientVersion(compatibleClientVersion, QUERY);
assertExpect... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected static void setTxnConfigs() throws IOException {
TransactionFactory.getTransactionFactory().getTransactionContext().setTxnConfigs(config, tmpFolder.newFolder().getAbsolutePath(), DEFAULT_TXN_TIMEOUT_SECONDS);
}
#locatio... | #fixed code
protected static void setTxnConfigs() throws IOException {
TransactionFactory.getTransactionProvider().getTransactionContext().setTxnConfigs(config, tmpFolder.newFolder().getAbsolutePath(), DEFAULT_TXN_TIMEOUT_SECONDS);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public boolean seekToPreviousRow(Cell key) throws IOException {
KeyValue kv = PhoenixKeyValueUtil.maybeCopyCell(key);
if (reader.isTop()) {
Optional<Cell> firstKey = reader.getFirstKey();
// This will be null when th... | #fixed code
@Override
public boolean seekToPreviousRow(Cell key) throws IOException {
KeyValue kv = PhoenixKeyValueUtil.maybeCopyCell(key);
if (reader.isTop()) {
Optional<Cell> firstKey = reader.getFirstKey();
// This will be null when the file... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static long getWallClockTimeFromCellTimeStamp(long tsOfCell) {
return TransactionFactory.getTransactionFactory().getTransactionContext().isPreExistingVersion(tsOfCell) ? tsOfCell : TransactionUtil.convertToMilliseconds(tsOfCell);
}
... | #fixed code
public static long getWallClockTimeFromCellTimeStamp(long tsOfCell) {
return TransactionFactory.getTransactionProvider().getTransactionContext().isPreExistingVersion(tsOfCell) ? tsOfCell : TransactionUtil.convertToMilliseconds(tsOfCell);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void batchStarted(MiniBatchOperationInProgress<Mutation> miniBatchOp, IndexMetaData context) throws IOException {
// The entire purpose of this method impl is to get the existing rows for the
// table rows being indexed into the bloc... | #fixed code
@Override
public void batchStarted(MiniBatchOperationInProgress<Mutation> miniBatchOp, IndexMetaData context) throws IOException {
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
protected RegionScanner doPostScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c, final Scan scan, final RegionScanner s) throws IOException, SQLException {
RegionCoprocessorEnvironment env = c.getEnvironment();
Region region... | #fixed code
@Override
protected RegionScanner doPostScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c, final Scan scan, final RegionScanner s) throws IOException, SQLException {
RegionCoprocessorEnvironment env = c.getEnvironment();
Region region = env... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public int newKey(ImmutableBytesWritable key, byte[][] values) {
int nValues = values.length;
while (nValues > 0 && (values[nValues-1] == null || values[nValues-1].length == 0)) {
nValues--;
}
int i = 0;
... | #fixed code
@Override
public int newKey(ImmutableBytesWritable key, byte[][] values) {
int nValues = values.length;
while (nValues > 0 && (values[nValues-1] == null || values[nValues-1].length == 0)) {
nValues--;
}
int i = 0;
Truste... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public byte[] getViewIndexIdFromIndexRowKey(ImmutableBytesWritable indexRowKeyPtr) {
assert(isLocalIndex);
RowKeySchema indexRowKeySchema = getIndexRowKeySchema();
// TODO add logic to skip region start key as well because we cannot find the regi... | #fixed code
public byte[] getViewIndexIdFromIndexRowKey(ImmutableBytesWritable indexRowKeyPtr) {
assert (isLocalIndex);
ImmutableBytesPtr ptr =
new ImmutableBytesPtr(indexRowKeyPtr.get(),( indexRowKeyPtr.getOffset()
+ (nIndexSaltBuc... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public boolean seekOrReseek(Cell cell, boolean isSeek) throws IOException{
KeyValue kv = PhoenixKeyValueUtil.maybeCopyCell(cell);
KeyValue keyToSeek = kv;
KeyValue splitKeyValue = KeyValueUtil.createKeyValueFromKey(reader.getSplitkey());
... | #fixed code
public boolean seekOrReseek(Cell cell, boolean isSeek) throws IOException{
Cell keyToSeek = cell;
KeyValue splitKeyValue = new KeyValue.KeyOnlyKeyValue(reader.getSplitkey());
if (reader.isTop()) {
if(this.comparator.compare(cell, splitKeyVa... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void lookup()
{
ClassGroup group = this.getInstructions().getCode().getAttributes().getClassFile().getGroup();
ClassFile otherClass = group.findClass(method.getClassEntry().getName());
if (otherClass == null)
return; // not our class
// ... | #fixed code
@Override
public void lookup()
{
myMethods = lookupMethods();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void run(ClassGroup one, ClassGroup two)
{
eone = new Execution(one);
eone.populateInitialMethods();
List<Method> initial1 = eone.getInitialMethods().stream().sorted((m1, m2) -> m1.getName().compareTo(m2.getName())).collect(Collectors.toList());
eone.run();... | #fixed code
public void run(ClassGroup one, ClassGroup two)
{
eone = new Execution(one);
eone.populateInitialMethods();
List<Method> initial1 = eone.getInitialMethods().stream().sorted((m1, m2) -> m1.getName().compareTo(m2.getName())).collect(Collectors.toList());
eone.run();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void renameField(net.runelite.deob.Field f, Field newField)
{
Class clazz = field.getClassEntry();
NameAndType nat = field.getNameAndType();
ClassFile cf = this.getInstructions().getCode().getAttributes().getClassFile().getGroup().findClass(clazz.... | #fixed code
@Override
public void renameField(net.runelite.deob.Field f, Field newField)
{
net.runelite.deob.Field f2 = getMyField();
if (f2 == f)
field = newField;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void test1() throws IOException
{
File file = folder.newFile();
Store store = new Store();
DataFile df = new DataFile(store, 42, file);
int sector = df.write(3, ByteBuffer.wrap("test".getBytes()));
ByteBuffer buf = df.read(3, sector, 4);
String s... | #fixed code
@Test
public void test1() throws IOException
{
File file = folder.newFile();
Store store = new Store(folder.getRoot());
DataFile df = new DataFile(store, 42, file);
int sector = df.write(3, ByteBuffer.wrap("test".getBytes()));
ByteBuffer buf = df.read(3, sector, 4);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void buildInstructionGraph()
{
Class clazz = field.getClassEntry();
NameAndType nat = field.getNameAndType();
ClassFile cf = this.getInstructions().getCode().getAttributes().getClassFile().getGroup().findClass(clazz.getName());
if (cf == null)
... | #fixed code
@Override
public void buildInstructionGraph()
{
net.runelite.deob.Field f = getMyField();
if (f != null)
f.addReference(this);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void run(ClassGroup one, ClassGroup two)
{
eone = new Execution(one);
eone.populateInitialMethods();
eone.run();
etwo = new Execution(two);
etwo.populateInitialMethods();
etwo.run();
process(
one.findClass("client").findMethod("init"),
two... | #fixed code
public void run(ClassGroup one, ClassGroup two)
{
eone = new Execution(one);
eone.populateInitialMethods();
List<Method> initial1 = eone.getInitialMethods().stream().sorted((m1, m2) -> m1.getName().compareTo(m2.getName())).collect(Collectors.toList());
eone.run();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void renameField(net.runelite.deob.Field f, Field newField)
{
Class clazz = field.getClassEntry();
NameAndType nat = field.getNameAndType();
ClassFile cf = this.getInstructions().getCode().getAttributes().getClassFile().getGroup().findClass(clazz.... | #fixed code
@Override
public void renameField(net.runelite.deob.Field f, Field newField)
{
net.runelite.deob.Field f2 = getMyField();
if (f2 == f)
{
field = newField;
}
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void test2() throws IOException
{
byte[] b = new byte[1024];
for (int i = 0; i < 1024; ++i) b[i] = (byte) i;
File file = folder.newFile();
Store store = new Store(folder.getRoot());
DataFile df = new DataFile(store, file);
int sector = df.writ... | #fixed code
@Test
public void test2() throws IOException
{
byte[] b = new byte[1024];
for (int i = 0; i < 1024; ++i)
b[i] = (byte) i;
File file = folder.newFile();
Store store = new Store(folder.getRoot());
DataFile df = new DataFile(store, file);
DataFileWriteResult res... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public NameMappings run(ClassGroup one, ClassGroup two)
{
Execution eone = new Execution(one);
eone.setBuildGraph(true);
eone.populateInitialMethods();
eone.run();
Execution etwo = new Execution(two);
etwo.setBuildGraph(true);
etwo.populateInitialMethods(... | #fixed code
public NameMappings run(ClassGroup one, ClassGroup two)
{
Execution eone = new Execution(one);
eone.setBuildGraph(true);
eone.populateInitialMethods();
eone.run();
Execution etwo = new Execution(two);
etwo.setBuildGraph(true);
etwo.populateInitialMethods();
e... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public List<net.runelite.deob.Method> getMethods()
{
ClassGroup group = this.getInstructions().getCode().getAttributes().getClassFile().getGroup();
ClassFile otherClass = group.findClass(method.getClassEntry().getName());
if (otherClass == null)
ret... | #fixed code
@Override
public List<net.runelite.deob.Method> getMethods()
{
return myMethods != null ? myMethods : Arrays.asList();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private ParallelExecutorMapping mapMethods(ClassGroup one, ClassGroup two)
{
MethodSignatureMapper msm = new MethodSignatureMapper();
msm.map(one, two);
List<ParallelExecutorMapping> pmes = new ArrayList<>();
for (Method m : msm.getMap().keySet())
{
Collect... | #fixed code
private ParallelExecutorMapping mapMethods(ClassGroup one, ClassGroup two)
{
MethodSignatureMapper msm = new MethodSignatureMapper();
msm.map(one, two);
List<ParallelExecutorMapping> pmes = new ArrayList<>();
for (Method m : msm.getMap().keySet())
{
Collection<Me... | 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.