output stringlengths 64 73.2k | input stringlengths 208 73.3k | instruction stringclasses 1
value |
|---|---|---|
#fixed code
@Override
public void onControllerChange(NotificationContext changeContext) {
logger.info("START: GenericClusterController.onControllerChange() for cluster " + _clusterName);
_cache.requireFullRefresh();
_taskCache.requireFullRefresh();
if (changeContext != nu... | #vulnerable code
@Override
public void onControllerChange(NotificationContext changeContext) {
logger.info("START: GenericClusterController.onControllerChange() for cluster " + _clusterName);
_cache.requireFullRefresh();
if (changeContext != null && changeContext.getType() =... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testInvocation() throws Exception
{
System.out.println("TestCMTaskHandler.testInvocation()");
Message message = new Message(MessageType.STATE_TRANSITION);
message.setSrcName("cm-instance-0");
message.setTgtSessionId("1234");
message.set... | #vulnerable code
@Test
public void testInvocation() throws Exception
{
System.out.println("TestCMTaskHandler.testInvocation()");
Message message = new Message(MessageType.STATE_TRANSITION);
message.setSrcName("cm-instance-0");
message.setTgtSessionId("1234");
messa... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
void startRebalancingTimer(long period, HelixManager manager) {
if (period != _timerPeriod) {
logger.info("Controller starting timer at period " + period);
if (_rebalanceTimer != null) {
_rebalanceTimer.cancel();
}
_rebalanceTimer = new Timer... | #vulnerable code
void checkRebalancingTimer(HelixManager manager, List<IdealState> idealStates) {
if (manager.getConfigAccessor() == null) {
logger.warn(manager.getInstanceName()
+ " config accessor doesn't exist. should be in file-based mode.");
return;
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void execute(final ClusterEvent event) throws Exception {
_eventId = event.getEventId();
HelixManager manager = event.getAttribute(AttributeName.helixmanager.name());
Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOURCES.n... | #vulnerable code
@Override
public void execute(final ClusterEvent event) throws Exception {
_eventId = event.getEventId();
HelixManager manager = event.getAttribute(AttributeName.helixmanager.name());
Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOU... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test(groups = { "unitTest" })
public void testStaticFileCM()
{
final String clusterName = "TestSTaticFileCM";
final String controllerName = "controller_0";
ClusterView view;
String[] illegalNodesInfo = {"localhost_8900", "localhost_8901"};
List<DBP... | #vulnerable code
@Test(groups = { "unitTest" })
public void testStaticFileCM()
{
final String clusterName = "TestSTaticFileCM";
final String controllerName = "controller_0";
ClusterView view;
String[] illegalNodesInfo = {"localhost_8900", "localhost_8901"};
Li... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
if (cache == null)
{
throw new StageException("Missing attributes in event:" + event
+ ". Requires DataCache");
... | #vulnerable code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
Map<String, IdealState> idealStates = cache.getIdealStates();
Map<String, ResourceGroup> resourceGroupMap = new LinkedHas... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void onExternalViewChange(ExternalView externalView, IdealState idealState) {
try {
String resourceName = externalView.getId();
if (!_resourceMbeanMap.containsKey(resourceName)) {
synchronized (this) {
if (!_resourceMbeanMap.containsKey(... | #vulnerable code
public void onExternalViewChange(ExternalView externalView, IdealState idealState) {
try {
String resourceName = externalView.getId();
if (!_resourceMbeanMap.containsKey(resourceName)) {
synchronized (this) {
if (!_resourceMbeanMap.contai... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
if (cache == null)
{
throw new StageException("Missing attributes in event:" + event
+ ". Requires DataCache");
... | #vulnerable code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
Map<String, LiveInstance> liveInstances = cache.getLiveInstances();
CurrentStateOutput currentStateOutput = new CurrentSt... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void scheduleSingleJob(String jobResource, JobConfig jobConfig) {
HelixAdmin admin = _manager.getClusterManagmentTool();
IdealState jobIS = admin.getResourceIdealState(_manager.getClusterName(), jobResource);
if (jobIS != null) {
LOG.info("Job " + job... | #vulnerable code
private void scheduleSingleJob(String jobResource, JobConfig jobConfig) {
HelixAdmin admin = _manager.getClusterManagmentTool();
IdealState jobIS = admin.getResourceIdealState(_manager.getClusterName(), jobResource);
if (jobIS != null) {
LOG.info("Job "... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static int numberOfListeners(String zkAddr, String path) throws Exception
{
Map<String, Set<String>> listenerMap = getListenersByZkPath(zkAddr);
if (listenerMap.containsKey(path)) {
return listenerMap.get(path).size();
}
return 0;
} | #vulnerable code
public static int numberOfListeners(String zkAddr, String path) throws Exception
{
int count = 0;
String splits[] = zkAddr.split(":");
Socket sock = new Socket(splits[0], Integer.parseInt(splits[1]));
PrintWriter out = new PrintWriter(sock.getOutputStrea... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void disconnect()
{
if (!isConnected())
{
logger.error("ClusterManager " + _instanceName + " already disconnected");
return;
}
disconnectInternal();
} | #vulnerable code
@Override
public void disconnect()
{
if (!isConnected())
{
logger.warn("ClusterManager " + _instanceName + " already disconnected");
return;
}
logger.info("disconnect " + _instanceName + "(" + _instanceType + ") from "
+ _clusterN... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void handleChildChange(String parentPath, List<String> currentChilds) {
if (_zkClientForRoutingDataListener == null || _zkClientForRoutingDataListener.isClosed()) {
return;
}
// Resubscribe
_zkClientForRoutingDataListener.unsubscribeAll(... | #vulnerable code
@Override
public void handleChildChange(String parentPath, List<String> currentChilds) {
if (_zkClientForListener == null || _zkClientForListener.isClosed()) {
return;
}
// Resubscribe
_zkClientForListener.unsubscribeAll();
_zkClientForListener... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected static Set<String> getExpiredJobs(HelixDataAccessor dataAccessor,
HelixPropertyStore propertyStore, WorkflowConfig workflowConfig,
WorkflowContext workflowContext) {
Set<String> expiredJobs = new HashSet<String>();
if (workflowContext != null) {
... | #vulnerable code
protected static Set<String> getExpiredJobs(HelixDataAccessor dataAccessor,
HelixPropertyStore propertyStore, WorkflowConfig workflowConfig,
WorkflowContext workflowContext) {
Set<String> expiredJobs = new HashSet<String>();
if (workflowContext != nul... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
@PreFetch(enabled = false)
public void onIdealStateChange(List<IdealState> idealStates, NotificationContext changeContext) {
logger.info(
"START: Generic GenericClusterController.onIdealStateChange() for cluster " + _clusterName);
if (changeContext... | #vulnerable code
@Override
@PreFetch(enabled = false)
public void onIdealStateChange(List<IdealState> idealStates, NotificationContext changeContext) {
logger.info(
"START: Generic GenericClusterController.onIdealStateChange() for cluster " + _clusterName);
if (changeC... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void onControllerChange(NotificationContext changeContext) {
logger.info("START: GenericClusterController.onControllerChange() for cluster " + _clusterName);
_cache.requireFullRefresh();
if (changeContext != null && changeContext.getType() == Type... | #vulnerable code
@Override
public void onControllerChange(NotificationContext changeContext) {
logger.info("START: GenericClusterController.onControllerChange() for cluster " + _clusterName);
_cache.requireFullRefresh();
if (changeContext != null && changeContext.getType() =... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
Map<String, ResourceGroup> resourceGroupMap = event
.getAttribute(AttributeName.RESOURCE_GROUPS.toString());
MessageGene... | #vulnerable code
@Override
public void process(ClusterEvent event) throws Exception
{
// ClusterManager manager = event.getAttribute("clustermanager");
// if (manager == null)
// {
// throw new StageException("ClusterManager attribute value is null");
// }
Cluster... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public int send(final Criteria recipientCriteria, final Message message,
AsyncCallback callbackOnReply)
{
Map<InstanceType, List<Message>> generateMessage = generateMessage(
recipientCriteria, message);
int totalMessageCount = 0;
String ... | #vulnerable code
@Override
public int send(final Criteria recipientCriteria, final Message message,
AsyncCallback callbackOnReply)
{
Map<InstanceType, List<Message>> generateMessage = generateMessage(
recipientCriteria, message);
int totalMessageCount = 0;
S... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test()
public void TestSchedulerZeroMsg() throws Exception
{
TestMessagingHandlerFactory factory = new TestMessagingHandlerFactory();
HelixManager manager = null;
for (int i = 0; i < NODE_NR; i++)
{
String hostDest = "localhost_" + (START_PORT + i);
... | #vulnerable code
@Test()
public void TestSchedulerZeroMsg() throws Exception
{
TestMessagingHandlerFactory factory = new TestMessagingHandlerFactory();
HelixManager manager = null;
for (int i = 0; i < NODE_NR; i++)
{
String hostDest = "localhost_" + (START_PORT +... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void shutdown() throws InterruptedException {
stopRebalancingTimer();
terminateEventThread(_eventThread);
terminateEventThread(_taskEventThread);
_asyncTasksThreadPool.shutdown();
} | #vulnerable code
public void shutdown() throws InterruptedException {
stopRebalancingTimer();
while (_eventThread.isAlive()) {
_eventThread.interrupt();
_eventThread.join(EVENT_THREAD_JOIN_TIMEOUT);
}
_asyncTasksThreadPool.shutdown();
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void scheduleSingleJob(String jobResource, JobConfig jobConfig) {
HelixAdmin admin = _manager.getClusterManagmentTool();
IdealState jobIS = admin.getResourceIdealState(_manager.getClusterName(), jobResource);
if (jobIS != null) {
LOG.info("Job " + job... | #vulnerable code
private void scheduleSingleJob(String jobResource, JobConfig jobConfig) {
HelixAdmin admin = _manager.getClusterManagmentTool();
IdealState jobIS = admin.getResourceIdealState(_manager.getClusterName(), jobResource);
if (jobIS != null) {
LOG.info("Job "... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
void sendData()
{
ConcurrentHashMap<String, ZNRecordUpdate> updateCache = null;
synchronized(_dataBufferRef)
{
updateCache = _dataBufferRef.getAndSet(new ConcurrentHashMap<String, ZNRecordUpdate>());
}
if(updateCache != null)
{
L... | #vulnerable code
void enqueueData(ZNRecordUpdate e)
{
if(!_initialized || _shutdownFlag)
{
LOG.error("inited:" + _initialized + " shutdownFlag:"+_shutdownFlag+" , return");
return;
}
// Do local merge if receive multiple update on the same path
synchroniz... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testDeletingRecurrentQueueWithHistory() throws Exception {
final String queueName = TestHelper.getTestMethodName();
// Create a queue
LOG.info("Starting job-queue: " + queueName);
JobQueue.Builder queueBuild = TaskTestUtil.buildRecurrentJobQ... | #vulnerable code
@Test
public void testDeletingRecurrentQueueWithHistory() throws Exception {
final String queueName = TestHelper.getTestMethodName();
int intervalSeconds = 3;
// Create a queue
LOG.info("Starting job-queue: " + queueName);
JobQueue.Builder queueBuil... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void disconnect() {
if (_zkclient == null || _zkclient.isClosed()) {
LOG.info("instanceName: " + _instanceName + " already disconnected");
return;
}
LOG.info("disconnect " + _instanceName + "(" + _instanceType + ") from " + _clusterNa... | #vulnerable code
@Override
public void disconnect() {
if (_zkclient == null || _zkclient.isClosed()) {
LOG.info("instanceName: " + _instanceName + " already disconnected");
return;
}
LOG.info("disconnect " + _instanceName + "(" + _instanceType + ") from " + _clu... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testZkClientMonitor() throws Exception {
final String TEST_TAG = "test_monitor";
final String TEST_KEY = "test_key";
final String TEST_DATA = "testData";
final String TEST_ROOT = "/my_cluster/IDEALSTATES";
final String TEST_NODE = "/test_... | #vulnerable code
@Test
public void testZkClientMonitor() throws Exception {
final String TEST_TAG = "test_monitor";
final String TEST_KEY = "test_key";
final String TEST_DATA = "testData";
final String TEST_ROOT = "/my_cluster/IDEALSTATES";
final String TEST_NODE = "... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterManager manager = event.getAttribute("clustermanager");
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
Map<String, ResourceGroup> resourceGroupMap = event
.getA... | #vulnerable code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterManager manager = event.getAttribute("clustermanager");
if (manager == null)
{
throw new StageException("ClusterManager attribute value is null");
}
ClusterDataCache ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
void addControllerMessageListener(MessageListener listener)
{
addListener(listener, new Builder(_clusterName).controllerMessages(), ChangeType.MESSAGES_CONTROLLER,
new EventType[] { EventType.NodeChildrenChanged, EventType.NodeDeleted, EventType.NodeCreated });
} | #vulnerable code
void disconnectInternal()
{
// This function can be called when the connection are in bad state(e.g. flapping),
// in which isConnected() could be false and we want to disconnect from cluster.
logger.info("disconnect " + _instanceName + "(" + _instanceType ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testCreateFailZkCacheBaseDataAccessor() {
String className = TestHelper.getTestClassName();
String methodName = TestHelper.getTestMethodName();
String clusterName = className + "_" + methodName;
System.out.println("START " + clusterName + " a... | #vulnerable code
@Test
public void testCreateFailZkCacheBaseDataAccessor() {
String className = TestHelper.getTestClassName();
String methodName = TestHelper.getTestMethodName();
String clusterName = className + "_" + methodName;
System.out.println("START " + clusterName... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void handleNewSession() throws Exception {
LOG.info(
"Handle new session, instance: " + _instanceName + ", type: " + _instanceType);
waitUntilConnected();
/**
* stop all timer tasks, reset all handlers, make sure cleanup completed fo... | #vulnerable code
@Override
public void handleNewSession() throws Exception {
LOG.info(
"Handle new session, instance: " + _instanceName + ", type: " + _instanceType);
waitUntilConnected();
/**
* stop all timer tasks, reset all handlers, make sure cleanup comple... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap,
CurrentStateOutput currentStateOutput) {
ClusterDataCache cache = event.getAttribute(AttributeName.ClusterDataCache.name());
BestPossibleStateOutput output = new BestPos... | #vulnerable code
private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap,
CurrentStateOutput currentStateOutput) {
ClusterDataCache cache = event.getAttribute(AttributeName.ClusterDataCache.name());
BestPossibleStateOutput output = new B... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap,
CurrentStateOutput currentStateOutput) {
ClusterDataCache cache = event.getAttribute(AttributeName.ClusterDataCache.name());
// After compute all workflows and jobs, the... | #vulnerable code
private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap,
CurrentStateOutput currentStateOutput) {
ClusterDataCache cache = event.getAttribute(AttributeName.ClusterDataCache.name());
// After compute all workflows and job... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
void startRebalancingTimer(long period, HelixManager manager) {
if (period != _timerPeriod) {
logger.info("Controller starting timer at period " + period);
if (_rebalanceTimer != null) {
_rebalanceTimer.cancel();
}
_rebalanceTimer = new Timer... | #vulnerable code
void stopRebalancingTimer() {
if (_rebalanceTimer != null) {
_rebalanceTimer.cancel();
_rebalanceTimer = null;
}
_timerPeriod = Integer.MAX_VALUE;
}
#location 3
#vulnerability type THREAD_... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void onControllerChange(NotificationContext changeContext) {
logger.info("START: GenericClusterController.onControllerChange() for cluster " + _clusterName);
_cache.requireFullRefresh();
_taskCache.requireFullRefresh();
if (changeContext != nu... | #vulnerable code
@Override
public void onControllerChange(NotificationContext changeContext) {
logger.info("START: GenericClusterController.onControllerChange() for cluster " + _clusterName);
_cache.requireFullRefresh();
if (changeContext != null && changeContext.getType() =... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public boolean getExistsLiveInstanceOrCurrentStateChange() {
return _existsLiveInstanceOrCurrentStateChange;
} | #vulnerable code
public boolean getExistsLiveInstanceOrCurrentStateChange() {
boolean change = _existsLiveInstanceOrCurrentStateChange;
_existsLiveInstanceOrCurrentStateChange = false;
return change;
}
#location 3
#vu... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
Map<String, ResourceGroup> resourceGroupMap = event
.getAttribute(AttributeName.RESOURCE_GROUPS.toString());
MessageGene... | #vulnerable code
@Override
public void process(ClusterEvent event) throws Exception
{
// ClusterManager manager = event.getAttribute("clustermanager");
// if (manager == null)
// {
// throw new StageException("ClusterManager attribute value is null");
// }
Cluster... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private boolean tryUpdateController(ClusterManager manager)
{
try
{
String instanceName = manager.getInstanceName();
String clusterName = manager.getClusterName();
final ZNRecord leaderRecord = new ZNRecord(ControllerPropertyType.LEADER.toString());
leaderRecord... | #vulnerable code
private boolean tryUpdateController(ClusterManager manager)
{
try
{
String instanceName = manager.getInstanceName();
String clusterName = manager.getClusterName();
final ZNRecord leaderRecord = new ZNRecord(ControllerPropertyType.LEADER.toString());
leader... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private Map<String, Resource> computeResourceBestPossibleStateWithWagedRebalancer(
ResourceControllerDataProvider cache, CurrentStateOutput currentStateOutput,
HelixManager helixManager, Map<String, Resource> resourceMap, BestPossibleStateOutput output,
List<S... | #vulnerable code
private Map<String, Resource> computeResourceBestPossibleStateWithWagedRebalancer(
ResourceControllerDataProvider cache, CurrentStateOutput currentStateOutput,
HelixManager helixManager, Map<String, Resource> resourceMap, BestPossibleStateOutput output,
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap,
CurrentStateOutput currentStateOutput) {
ClusterDataCache cache = event.getAttribute(AttributeName.ClusterDataCache.name());
BestPossibleStateOutput output = new BestPos... | #vulnerable code
private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap,
CurrentStateOutput currentStateOutput) {
ClusterDataCache cache = event.getAttribute(AttributeName.ClusterDataCache.name());
BestPossibleStateOutput output = new B... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected void handleNewSession()
{
boolean isConnected = _zkClient.waitUntilConnected(CONNECTIONTIMEOUT, TimeUnit.MILLISECONDS);
while (!isConnected)
{
logger.error("Could NOT connect to zk server in " + CONNECTIONTIMEOUT + "ms. zkServer: "
+ _zkC... | #vulnerable code
protected void handleNewSession()
{
boolean isConnected = _zkClient.waitUntilConnected(CONNECTIONTIMEOUT, TimeUnit.MILLISECONDS);
while (!isConnected)
{
logger.error("Could NOT connect to zk server in " + CONNECTIONTIMEOUT + "ms. zkServer: "
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testStateTransitionTimeOut() throws Exception {
_setupTool.addResourceToCluster(CLUSTER_NAME, TEST_DB, _PARTITIONS, STATE_MODEL);
_setupTool.getClusterManagementTool().enableResource(CLUSTER_NAME, TEST_DB, false);
_setupTool.rebalanceStorageClust... | #vulnerable code
@Test
public void testStateTransitionTimeOut() throws Exception {
Map<String, SleepStateModelFactory> factories = new HashMap<String, SleepStateModelFactory>();
IdealState idealState =
_setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_N... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
if (bytes == null || bytes.length == 0) {
LOG.error("ZNode is empty.");
return null;
}
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ZNRecord record = nu... | #vulnerable code
@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
if (bytes == null || bytes.length == 0) {
LOG.error("ZNode is empty.");
return null;
}
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ZNRecord record... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static void main(String[] args) throws Exception
{
ExecutorService pool = Executors.newFixedThreadPool(MAX_PARALLEL_TASKS);
Future<CMTaskResult> future;
// pool.shutdown();
// pool.awaitTermination(5, TimeUnit.SECONDS);
future = pool.submit(new Call... | #vulnerable code
public static void main(String[] args) throws Exception
{
ExecutorService pool = Executors.newFixedThreadPool(MAX_PARALLEL_TASKS);
Future<CMTaskResult> future;
// pool.shutdown();
// pool.awaitTermination(5, TimeUnit.SECONDS);
future = pool.submit(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void handleStateChanged(Watcher.Event.KeeperState state) {
if (_zkClientForRoutingDataListener == null || _zkClientForRoutingDataListener.isClosed()) {
return;
}
// Resubscribe
_zkClientForRoutingDataListener.unsubscribeAll();
_zkCli... | #vulnerable code
@Override
public void handleStateChanged(Watcher.Event.KeeperState state) {
if (_zkClientForListener == null || _zkClientForListener.isClosed()) {
return;
}
// Resubscribe
_zkClientForListener.unsubscribeAll();
_zkClientForListener.subscribeRou... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
void sendData()
{
ConcurrentHashMap<String, ZNRecordUpdate> updateCache = null;
synchronized(_dataBufferRef)
{
updateCache = _dataBufferRef.getAndSet(new ConcurrentHashMap<String, ZNRecordUpdate>());
}
if(updateCache != null)
{
L... | #vulnerable code
void sendData()
{
ConcurrentHashMap<String, ZNRecordUpdate> updateCache = null;
synchronized(_dataBufferRef)
{
updateCache = _dataBufferRef.getAndSet(new ConcurrentHashMap<String, ZNRecordUpdate>());
}
if(updateCache != null)
{
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterManager manager = event.getAttribute("clustermanager");
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
Map<String, ResourceGroup> resourceGroupMap = event
.getA... | #vulnerable code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterManager manager = event.getAttribute("clustermanager");
if (manager == null)
{
throw new StageException("ClusterManager attribute value is null");
}
ClusterDataCache ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap,
CurrentStateOutput currentStateOutput) {
ClusterDataCache cache = event.getAttribute(AttributeName.ClusterDataCache.name());
Map<String, Resource> restOfResources = new ... | #vulnerable code
private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap,
CurrentStateOutput currentStateOutput) {
ClusterDataCache cache = event.getAttribute(AttributeName.ClusterDataCache.name());
BestPossibleStateOutput output = new B... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public int send(final Criteria recipientCriteria, final Message message,
AsyncCallback callbackOnReply)
{
Map<InstanceType, List<Message>> generateMessage = generateMessage(
recipientCriteria, message);
int totalMessageCount = 0;
String ... | #vulnerable code
@Override
public int send(final Criteria recipientCriteria, final Message message,
AsyncCallback callbackOnReply)
{
Map<InstanceType, List<Message>> generateMessage = generateMessage(
recipientCriteria, message);
int totalMessageCount = 0;
S... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testCreateFailZkCacheBaseDataAccessor() {
String className = TestHelper.getTestClassName();
String methodName = TestHelper.getTestMethodName();
String clusterName = className + "_" + methodName;
System.out.println("START " + clusterName + " a... | #vulnerable code
@Test
public void testCreateFailZkCacheBaseDataAccessor() {
String className = TestHelper.getTestClassName();
String methodName = TestHelper.getTestMethodName();
String clusterName = className + "_" + methodName;
System.out.println("START " + clusterName... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override public void process(ClusterEvent event) throws Exception {
LOG.info("START PersistAssignmentStage.process()");
long startTime = System.currentTimeMillis();
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
ClusterConfig clusterConfig = ... | #vulnerable code
@Override public void process(ClusterEvent event) throws Exception {
LOG.info("START PersistAssignmentStage.process()");
long startTime = System.currentTimeMillis();
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
ClusterConfig clusterCon... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testZkClientMonitor() throws Exception {
final String TEST_TAG = "test_monitor";
final String TEST_KEY = "test_key";
final String TEST_DATA = "testData";
final String TEST_ROOT = "/my_cluster/IDEALSTATES";
final String TEST_NODE = "/test_... | #vulnerable code
@Test
public void testZkClientMonitor() throws Exception {
final String TEST_TAG = "test_monitor";
final String TEST_KEY = "test_key";
final String TEST_DATA = "testData";
final String TEST_ROOT = "/my_cluster/IDEALSTATES";
final String TEST_NODE = "... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void close() {
if (_zkClient != null) {
_zkClient.close();
}
} | #vulnerable code
@Override
public void close() {
if (_zkclient != null) {
_zkclient.close();
}
}
#location 4
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void setState(String partitionName, String state) {
setProperty(partitionName, CurrentStateProperty.CURRENT_STATE, state);
} | #vulnerable code
public void setState(String partitionName, String state) {
Map<String, Map<String, String>> mapFields = _record.getMapFields();
if (mapFields.get(partitionName) == null) {
mapFields.put(partitionName, new TreeMap<String, String>());
}
mapFields.get(p... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void handleSessionEstablishmentError(Throwable error) {
if (_zkClientForRoutingDataListener == null || _zkClientForRoutingDataListener.isClosed()) {
return;
}
// Resubscribe
_zkClientForRoutingDataListener.unsubscribeAll();
_zkClient... | #vulnerable code
@Override
public void handleSessionEstablishmentError(Throwable error) {
if (_zkClientForListener == null || _zkClientForListener.isClosed()) {
return;
}
// Resubscribe
_zkClientForListener.unsubscribeAll();
_zkClientForListener.subscribeRoutin... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
if (bytes == null || bytes.length == 0) {
LOG.error("ZNode is empty.");
return null;
}
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ZNRecord record = nu... | #vulnerable code
@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
if (bytes == null || bytes.length == 0) {
LOG.error("ZNode is empty.");
return null;
}
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ZNRecord record... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override public void process(ClusterEvent event) throws Exception {
LOG.info("START PersistAssignmentStage.process()");
long startTime = System.currentTimeMillis();
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
ClusterConfig clusterConfig = ... | #vulnerable code
@Override public void process(ClusterEvent event) throws Exception {
LOG.info("START PersistAssignmentStage.process()");
long startTime = System.currentTimeMillis();
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
ClusterConfig clusterCon... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void close() {
if (_zkClient != null) {
_zkClient.close();
}
if (_zkMetadataStoreDirectory != null) {
_zkMetadataStoreDirectory.close();
}
if (_zkClientForRoutingDataListener != null) {
_zkClientForRoutingDataListener.close();
}
... | #vulnerable code
public void close() {
if (_zkClient != null) {
_zkClient.close();
}
if (_zkMetadataStoreDirectory != null) {
_zkMetadataStoreDirectory.close();
}
if (_zkClientForListener != null) {
_zkClientForListener.close();
}
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void process(ClusterEvent event) throws Exception {
long startTime = System.currentTimeMillis();
LOG.info("START ExternalViewComputeStage.process()");
HelixManager manager = event.getAttribute(AttributeName.helixmanager.name());
Map<String, R... | #vulnerable code
@Override
public void process(ClusterEvent event) throws Exception {
long startTime = System.currentTimeMillis();
LOG.info("START ExternalViewComputeStage.process()");
HelixManager manager = event.getAttribute(AttributeName.helixmanager.name());
Map<Str... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static int numberOfListeners(String zkAddr, String path) throws Exception
{
Map<String, Set<String>> listenerMap = getListenersByZkPath(zkAddr);
if (listenerMap.containsKey(path)) {
return listenerMap.get(path).size();
}
return 0;
} | #vulnerable code
public static int numberOfListeners(String zkAddr, String path) throws Exception
{
int count = 0;
String splits[] = zkAddr.split(":");
Socket sock = new Socket(splits[0], Integer.parseInt(splits[1]));
PrintWriter out = new PrintWriter(sock.getOutputStrea... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterManager manager = event.getAttribute("clustermanager");
if (manager == null)
{
throw new StageException("ClusterManager attribute value is null");
}
log.info("START ExternalViewComputeStag... | #vulnerable code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterManager manager = event.getAttribute("clustermanager");
if (manager == null)
{
throw new StageException("ClusterManager attribute value is null");
}
log.info("START ExternalViewCompu... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void handleDataChange(String dataPath, Object data) {
if (_zkClientForRoutingDataListener == null || _zkClientForRoutingDataListener.isClosed()) {
return;
}
resetZkResources();
} | #vulnerable code
@Override
public void handleDataChange(String dataPath, Object data) {
if (_zkClientForListener == null || _zkClientForListener.isClosed()) {
return;
}
resetZkResources();
}
#location 3
#vulne... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected void handleNewSession()
{
boolean isConnected = _zkClient.waitUntilConnected(CONNECTIONTIMEOUT, TimeUnit.MILLISECONDS);
while (!isConnected)
{
logger.error("Could NOT connect to zk server in " + CONNECTIONTIMEOUT + "ms. zkServer: "
+ _zkC... | #vulnerable code
protected void handleNewSession()
{
boolean isConnected = _zkClient.waitUntilConnected(CONNECTIONTIMEOUT, TimeUnit.MILLISECONDS);
while (!isConnected)
{
logger.error("Could NOT connect to zk server in " + CONNECTIONTIMEOUT + "ms. zkServer: "
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
if (bytes == null || bytes.length == 0) {
LOG.error("ZNode is empty.");
return null;
}
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ZNRecord record = nu... | #vulnerable code
@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
if (bytes == null || bytes.length == 0) {
LOG.error("ZNode is empty.");
return null;
}
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ZNRecord record... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void handleNewSession(String sessionId) {
if (_zkClientForRoutingDataListener == null || _zkClientForRoutingDataListener.isClosed()) {
return;
}
// Resubscribe
_zkClientForRoutingDataListener.unsubscribeAll();
_zkClientForRoutingData... | #vulnerable code
@Override
public void handleNewSession(String sessionId) {
if (_zkClientForListener == null || _zkClientForListener.isClosed()) {
return;
}
// Resubscribe
_zkClientForListener.unsubscribeAll();
_zkClientForListener.subscribeRoutingDataChanges(t... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
void preHandleMessage() throws Exception {
if (!_message.isValid()) {
String errorMessage = "Invalid Message, ensure that message: " + _message
+ " has all the required fields: " + Arrays.toString(Message.Attributes.values());
_statusUpdateUtil.logErr... | #vulnerable code
void preHandleMessage() throws Exception {
if (!_message.isValid()) {
String errorMessage = "Invalid Message, ensure that message: " + _message
+ " has all the required fields: " + Arrays.toString(Message.Attributes.values());
_statusUpdateUtil.... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
DefaultMQPullConsumer consumer = new DefaultMQPullConsumer(MixAll.TOOLS_CONSUMER_GROUP, rpcHook);
try {
String topic = comman... | #vulnerable code
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
DefaultMQPullConsumer consumer = new DefaultMQPullConsumer(MixAll.TOOLS_CONSUMER_GROUP, rpcHook);
try {
String topic = ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void execute(final CommandLine commandLine, final Options options,
RPCHook rpcHook) throws SubCommandException {
String messageId = commandLine.getOptionValue('i').trim();
try {
System.out.printf("ip=%s", MessageClient... | #vulnerable code
@Override
public void execute(final CommandLine commandLine, final Options options,
RPCHook rpcHook) throws SubCommandException {
String messageId = commandLine.getOptionValue('i').trim();
try {
System.out.printf("ip=" + MessageC... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testConsumerStartWithInterval() {
int msgSize = 100;
String originMsgDCName = RandomUtils.getStringByUUID();
String msgBodyDCName = RandomUtils.getStringByUUID();
RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, t... | #vulnerable code
@Test
public void testConsumerStartWithInterval() {
String tag = "jueyin";
int msgSize = 100;
String originMsgDCName = RandomUtils.getStringByUUID();
String msgBodyDCName = RandomUtils.getStringByUUID();
RMQNormalConsumer con... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void executeSendMessageHookBefore(final ChannelHandlerContext ctx, final RemotingCommand request,
SendMessageContext context) {
if (hasSendMessageHook()) {
for (SendMessageHook hook : this.sendMessageHook... | #vulnerable code
public void executeSendMessageHookBefore(final ChannelHandlerContext ctx, final RemotingCommand request,
SendMessageContext context) {
if (hasSendMessageHook()) {
for (SendMessageHook hook : this.sendMessa... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testGetHalfMessageNull() {
when(messageStore
.getMessage(anyString(), anyString(), anyInt(), anyLong(), anyInt(), ArgumentMatchers.nullable(MessageFilter.class)))
.thenReturn(null);
PullResult result = tran... | #vulnerable code
@Test
public void testGetHalfMessageNull() {
when(messageStore
.getMessage(anyString(), anyString(), anyInt(), anyLong(), anyInt(), ArgumentMatchers.nullable(MessageFilter.class)))
.thenReturn(null);
PullResult result ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testGetHalfMessageNull() {
when(messageStore
.getMessage(anyString(), anyString(), anyInt(), anyLong(), anyInt(), ArgumentMatchers.nullable(MessageFilter.class)))
.thenReturn(null);
PullResult result = tran... | #vulnerable code
@Test
public void testGetHalfMessageNull() {
when(messageStore
.getMessage(anyString(), anyString(), anyInt(), anyLong(), anyInt(), ArgumentMatchers.nullable(MessageFilter.class)))
.thenReturn(null);
PullResult result ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static void main0(String[] args, RPCHook rpcHook) {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
//PackageConflictDetect.detectFastjson();
initCommand();
try {
init... | #vulnerable code
public static void main0(String[] args, RPCHook rpcHook) {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
//PackageConflictDetect.detectFastjson();
initCommand();
try {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static NamesrvController main0(String[] args) {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
try {
//PackageConflictDetect.detectFastjson();
Options options = ServerUtil.... | #vulnerable code
public static NamesrvController main0(String[] args) {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
try {
//PackageConflictDetect.detectFastjson();
Options options = Serve... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testRegisterProducer() throws Exception {
producerManager.registerProducer(group, clientInfo);
Map<Channel, ClientChannelInfo> channelMap = producerManager.getGroupChannelTable().get(group);
Channel channel1 = producerManager.find... | #vulnerable code
@Test
public void testRegisterProducer() throws Exception {
producerManager.registerProducer(group, clientInfo);
HashMap<Channel, ClientChannelInfo> channelMap = producerManager.getGroupChannelTable().get(group);
Channel channel1 = producerMa... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void execute(final CommandLine commandLine, final Options options,
RPCHook rpcHook) throws SubCommandException {
String messageId = commandLine.getOptionValue('i').trim();
try {
System.out.printf("ip=%s", MessageClient... | #vulnerable code
@Override
public void execute(final CommandLine commandLine, final Options options,
RPCHook rpcHook) throws SubCommandException {
String messageId = commandLine.getOptionValue('i').trim();
try {
System.out.printf("ip=" + MessageC... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Before
public void init() throws NoSuchFieldException, SecurityException, IOException {
Yaml ymal = new Yaml();
String home = System.getProperty(MixAll.ROCKETMQ_HOME_PROPERTY, System.getenv(MixAll.ROCKETMQ_HOME_ENV));
InputStream fis = null;
... | #vulnerable code
@Before
public void init() throws NoSuchFieldException, SecurityException, IOException {
Yaml ymal = new Yaml();
String home = System.getProperty(MixAll.ROCKETMQ_HOME_PROPERTY, System.getenv(MixAll.ROCKETMQ_HOME_ENV));
InputStream fis=null;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void requestThenAssertResponse() throws Exception {
requestThenAssertResponse(remotingClient);
} | #vulnerable code
private void requestThenAssertResponse() throws Exception {
RemotingCommand response = remotingClient.invokeSync("localhost:8888", createRequest(), 1000 * 3);
assertTrue(response != null);
assertThat(response.getLanguage()).isEqualTo(LanguageCode... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public LocalTransactionState checkLocalTransactionState(MessageExt msg) {
System.out.printf("server checking TrMsg %s%n", msg);
int value = transactionIndex.getAndIncrement();
if ((value % 6) == 0) {
throw new RuntimeExceptio... | #vulnerable code
@Override
public LocalTransactionState checkLocalTransactionState(MessageExt msg) {
System.out.printf("server checking TrMsg " + msg.toString() + "%n");
int value = transactionIndex.getAndIncrement();
if ((value % 6) == 0) {
thro... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void should_get_consume_queue_offset_successfully_when_timestamp_is_skewing() throws InterruptedException {
final int totalCount = 10;
int queueId = 0;
String topic = "FooBar";
AppendMessageResult[] appendMessageResults = putMe... | #vulnerable code
@Test
public void should_get_consume_queue_offset_successfully_when_timestamp_is_skewing() throws InterruptedException {
final int totalCount = 10;
int queueId = 0;
String topic = "FooBar";
AppendMessageResult[] appendMessageResults =... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
DefaultMQPullConsumer consumer = new DefaultMQPullConsumer(MixAll.TOOLS_CONSUMER_GROUP, rpcHook);
try {
String topic = comman... | #vulnerable code
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
DefaultMQPullConsumer consumer = new DefaultMQPullConsumer(MixAll.TOOLS_CONSUMER_GROUP, rpcHook);
try {
String topic = ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void sendMsg(final DefaultMQAdminExt defaultMQAdminExt, final DefaultMQProducer defaultMQProducer,
final String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
try {
MessageExt msg = defaultMQAd... | #vulnerable code
private void sendMsg(final DefaultMQAdminExt defaultMQAdminExt, final DefaultMQProducer defaultMQProducer,
final String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
try {
MessageExt msg = defau... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testIPv6Check() throws UnknownHostException {
InetAddress nonInternal = InetAddress.getByName("2408:4004:0180:8100:3FAA:1DDE:2B3F:898A");
InetAddress internal = InetAddress.getByName("FE80:0000:0000:0000:0000:0000:0000:FFFF");
ass... | #vulnerable code
@Test
public void testIPv6Check() {
byte[] nonInternalIp = UtilAll.string2bytes("24084004018081003FAA1DDE2B3F898A");
byte[] internalIp = UtilAll.string2bytes("FEC0000000000000000000000000FFFF");
assertThat(UtilAll.isInternalV6IP(nonInternalIp... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static NamesrvController main0(String[] args) {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
try {
//PackageConflictDetect.detectFastjson();
Options options = ServerUtil.... | #vulnerable code
public static NamesrvController main0(String[] args) {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
try {
//PackageConflictDetect.detectFastjson();
Options options = Serve... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static void main0(String[] args, RPCHook rpcHook) {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
//PackageConflictDetect.detectFastjson();
initCommand();
try {
init... | #vulnerable code
public static void main0(String[] args, RPCHook rpcHook) {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
//PackageConflictDetect.detectFastjson();
initCommand();
try {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testIPv6Check() throws UnknownHostException {
InetAddress nonInternal = InetAddress.getByName("2408:4004:0180:8100:3FAA:1DDE:2B3F:898A");
InetAddress internal = InetAddress.getByName("FE80:0000:0000:0000:0000:0000:0000:FFFF");
ass... | #vulnerable code
@Test
public void testIPv6Check() {
byte[] nonInternalIp = UtilAll.string2bytes("24084004018081003FAA1DDE2B3F898A");
byte[] internalIp = UtilAll.string2bytes("FEC0000000000000000000000000FFFF");
assertThat(UtilAll.isInternalV6IP(nonInternalIp... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void processRequest_UnRegisterProducer() throws Exception {
brokerController.getProducerManager().registerProducer(group, clientChannelInfo);
Map<Channel, ClientChannelInfo> channelMap = brokerController.getProducerManager().getGroupChannelTab... | #vulnerable code
@Test
public void processRequest_UnRegisterProducer() throws Exception {
brokerController.getProducerManager().registerProducer(group, clientChannelInfo);
HashMap<Channel, ClientChannelInfo> channelMap = brokerController.getProducerManager().getGroup... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static void main(String[] args) throws MQClientException {
DefaultMQPullConsumer consumer = new DefaultMQPullConsumer("please_rename_unique_group_name_5");
consumer.start();
Set<MessageQueue> mqs = consumer.fetchSubscribeMessageQueues("TopicTe... | #vulnerable code
public static void main(String[] args) throws MQClientException {
DefaultMQPullConsumer consumer = new DefaultMQPullConsumer("please_rename_unique_group_name_5");
consumer.start();
Set<MessageQueue> mqs = consumer.fetchSubscribeMessageQueues("T... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeM... | #vulnerable code
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
defaultMQAdminExt.setInstanceName(Long.toString(System.curren... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void sendMsg(final DefaultMQAdminExt defaultMQAdminExt, final DefaultMQProducer defaultMQProducer,
final String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
try {
MessageExt msg = defaultMQAd... | #vulnerable code
private void sendMsg(final DefaultMQAdminExt defaultMQAdminExt, final DefaultMQProducer defaultMQProducer,
final String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
try {
MessageExt msg = defau... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static FiltersrvController createController(String[] args) {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
if (null == System.getProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_SOCKET_SNDBUF_SIZ... | #vulnerable code
public static FiltersrvController createController(String[] args) {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
if (null == System.getProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_SOCKET_SNDB... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void unregisterProducer() throws Exception {
producerManager.registerProducer(group, clientInfo);
Map<Channel, ClientChannelInfo> channelMap = producerManager.getGroupChannelTable().get(group);
assertThat(channelMap).isNotNull();
... | #vulnerable code
@Test
public void unregisterProducer() throws Exception {
producerManager.registerProducer(group, clientInfo);
HashMap<Channel, ClientChannelInfo> channelMap = producerManager.getGroupChannelTable().get(group);
assertThat(channelMap).isNotNul... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMi... | #vulnerable code
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException {
DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
defaultMQAdminExt.setInstanceName(Long.toString(System.current... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static NamesrvController main0(String[] args) {
try {
NamesrvController controller = createNamesrvController(args);
start(controller);
String tip = "The Name Server boot success. serializeType=" + RemotingCommand.getSerializ... | #vulnerable code
public static NamesrvController main0(String[] args) {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
try {
//PackageConflictDetect.detectFastjson();
Options options = Serve... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testTwoConsumerWithSameGroup() {
int msgSize = 20;
String originMsgDCName = RandomUtils.getStringByUUID();
String msgBodyDCName = RandomUtils.getStringByUUID();
RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag,... | #vulnerable code
@Test
public void testTwoConsumerWithSameGroup() {
String tag = "jueyin";
int msgSize = 20;
String originMsgDCName = RandomUtils.getStringByUUID();
String msgBodyDCName = RandomUtils.getStringByUUID();
RMQNormalConsumer consum... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testGetGroupChannelTable() throws Exception {
producerManager.registerProducer(group, clientInfo);
Map<Channel, ClientChannelInfo> oldMap = producerManager.getGroupChannelTable().get(group);
producerManager.unregisterProd... | #vulnerable code
@Test
public void testGetGroupChannelTable() throws Exception {
producerManager.registerProducer(group, clientInfo);
HashMap<Channel, ClientChannelInfo> oldMap = producerManager.getGroupChannelTable().get(group);
producerManager.unre... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testCompose() throws Exception {
Getter<ResultSet, Integer> getter = new Getter<ResultSet, Integer>() {
@Override
public Integer get(ResultSet target) throws Exception {
return 3;
}
};
... | #vulnerable code
@Test
public void testCompose() throws Exception {
Getter<ResultSet, Integer> getter = new Getter<ResultSet, Integer>() {
@Override
public Integer get(ResultSet target) throws Exception {
return 3;
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static void main(String[] args) throws SQLException, Exception {
AllBenchmark.runBenchmark(DbHelper.getConnection(args), DynamicJdbcMapperForEachBenchmark.class);
} | #vulnerable code
public static void main(String[] args) throws SQLException, Exception {
AllBenchmark.runBenchmark(DbHelper.mockDb(), SmallBenchmarkObject.class, DynamicJdbcMapperForEachBenchmark.class, BenchmarkConstants.SINGLE_QUERY_SIZE, BenchmarkConstants.SINGLE_NB_ITERATION);
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public <T> CsvMapperBuilder<T> newBuilder(final Class<T> target) {
ClassMeta<T> classMeta = getClassMeta(target);
CsvMapperBuilder<T> builder = new CsvMapperBuilder<T>(target, classMeta, aliases, customReaders, propertyNameMatcherFactory);
builder.fieldMapperErrorHandler(f... | #vulnerable code
public <T> CsvMapperBuilder<T> newBuilder(final Class<T> target) {
CsvMapperBuilder<T> builder = new CsvMapperBuilder<T>(target, getClassMeta(target), aliases, customReaders, propertyNameMatcherFactory);
builder.fieldMapperErrorHandler(fieldMapperErrorHandler);
build... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public ResultSetMapperBuilder<T> addMapping(String property, String column) {
Setter<T, Object> setter = setterFactory.getSetter(target, property);
addMapping(setter, column);
return this;
} | #vulnerable code
public ResultSetMapperBuilder<T> addMapping(String property, String column) {
Setter<T, Object> setter = setterFactory.getSetter(target, property);
Mapper<ResultSet, T> fieldMapper;
if (setter.getPropertyType().isPrimitive()) {
fieldMapper = primitiveFieldMa... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testComposition() {
CsvColumnDefinition compose = CsvColumnDefinition.dateFormatDefinition("yyyyMM").addRename("blop").addCustomReader(
new CellValueReader<Integer>() {
@Override
public Int... | #vulnerable code
@Test
public void testComposition() {
CsvColumnDefinition compose = CsvColumnDefinition.compose(CsvColumnDefinition.compose(CsvColumnDefinition.dateFormatDefinition("yyyyMM"), CsvColumnDefinition.renameDefinition("blop")),
CsvColumnDefinitio... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public <S, T> Instantiator<S, T> getInstantiator(final Class<S> source, final Class<T> target) throws NoSuchMethodException, SecurityException {
final Constructor<T> constructor = getSmallerConstructor(target);
if (constructor == null) {
throw new NoSuchMethodException... | #vulnerable code
public <S, T> Instantiator<S, T> getInstantiator(final Class<S> source, final Class<T> target) throws NoSuchMethodException, SecurityException {
final Constructor<T> constructor = getSmallerConstructor(target);
Object[] args;
if (constructor.getParameterTypes()... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testArrayElementConstructorInjectionWithIncompatibleConstructorUseIncompatibleOutlay() {
ClassMeta<ObjectWithIncompatibleConstructor[]> classMeta = ReflectionService.newInstance().getRootClassMeta(ObjectWithIncompatibleConstructor[].class);
... | #vulnerable code
@Test
public void testArrayElementConstructorInjectionWithIncompatibleConstructorUseIncompatibleOutlay() {
ClassMeta<ObjectWithIncompatibleConstructor[]> classMeta = ReflectionService.newInstance().getClassMeta(ObjectWithIncompatibleConstructor[].class);
... | 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.