input
stringlengths
205
73.3k
output
stringlengths
64
73.2k
instruction
stringclasses
1 value
#vulnerable code @Test public void testAddAlgorithm() throws EntityStorageException { // Setup HibernateUtil.clear(); AlgorithmServiceImpl finderService = new AlgorithmServiceImpl(); // Execute functionality: add an IND algorithm Algorithm algorithm = new Algorithm...
#fixed code @Test public void testAddAlgorithm() throws EntityStorageException, AlgorithmLoadingException { // Setup HibernateUtil.clear(); AlgorithmServiceImpl finderService = new AlgorithmServiceImpl(); // Execute functionality: add an IND algorithm Algorithm algo...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void executeUniqueColumnCombinationsAlgorithm(String algorithmName, List<InputParameter> parameters) { List<ConfigurationValue> configs = convertInputParameters(parameters); UniqueColumnCombinationResultReceiver resultReceiver = new UniqueColumnCom...
#fixed code @Override public void executeUniqueColumnCombinationsAlgorithm(String algorithmName, List<InputParameter> parameters) { List<ConfigurationValue> configs = convertInputParameters(parameters); UniqueColumnCombinationResultReceiver resultReceiver = new UniqueColumnCombinati...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public List<OperationArgument> buildResolverArguments(ArgumentBuilderParams params) { Method resolverMethod = params.getResolverMethod(); List<OperationArgument> operationArguments = new ArrayList<>(resolverMethod.getParameterCount()); ...
#fixed code @Override public List<OperationArgument> buildResolverArguments(ArgumentBuilderParams params) { Method resolverMethod = params.getResolverMethod(); List<OperationArgument> operationArguments = new ArrayList<>(resolverMethod.getParameterCount()); An...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public List<OperationArgument> buildResolverArguments(ArgumentBuilderParams params) { Method resolverMethod = params.getResolverMethod(); List<OperationArgument> operationArguments = new ArrayList<>(resolverMethod.getParameterCount()); ...
#fixed code @Override public List<OperationArgument> buildResolverArguments(ArgumentBuilderParams params) { Method resolverMethod = params.getResolverMethod(); List<OperationArgument> operationArguments = new ArrayList<>(resolverMethod.getParameterCount()); An...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testConflictingConnections() { try (TestLog log = new TestLog(OperationMapper.class)) { new TestSchemaGenerator() .withOperationsFromSingleton(new ConflictingBookService()) .generate(); ...
#fixed code @Test public void testConflictingConnections() { try (TestLog log = new TestLog(OperationMapper.class)) { new TestSchemaGenerator() .withOperationsFromSingleton(new ConflictingBookService()) .generate(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void startDb() { postgres = (PostgreSQLContainer) new PostgreSQLContainer() .withDatabaseName(TEST_SCHEMA_NAME) .withUsername("SA") .withPassword("pass") .withLogConsumer(new Consumer<OutputFrame>() { ...
#fixed code public void startDb() { postgres = new MyPostgreSQLContainer() .withDatabaseName(TEST_SCHEMA_NAME) .withUsername("SA") .withPassword("pass") .withLogConsumer(new Consumer<OutputFrame>() { @Override ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code static void copyResources(URL resourceUrl, File targetPath) throws IOException, URISyntaxException { if (resourceUrl == null) { return; } URLConnection urlConnection = resourceUrl.openConnection(); /** * Copy resour...
#fixed code static void copyResources(URL resourceUrl, File targetPath) throws IOException, URISyntaxException { if (resourceUrl == null) { return; } URLConnection urlConnection = resourceUrl.openConnection(); /** * Copy resources ei...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku =...
#fixed code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku = new K...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku =...
#fixed code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku = new K...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku =...
#fixed code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku = new K...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { while (this.running) { long st = System.currentTimeMillis(); //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); ...
#fixed code @Override public void run() { while (this.running) { long st = System.currentTimeMillis(); //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); By...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku =...
#fixed code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku = new K...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { while (this.running) { long st = System.currentTimeMillis(); //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); ...
#fixed code @Override public void run() { while (this.running) { long st = System.currentTimeMillis(); //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku =...
#fixed code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku = new K...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { while (running) { if (this.kcp.isClosed()) { this.running = false; continue; } long st = System.currentTimeMillis(); this.kcp.update(); if (this.kcp.needUpdate()) { ...
#fixed code @Override public void run() { while (running) { if (this.kcp.isClosed()) { this.running = false; continue; } this.kcp.update(); if (this.kcp.needUpdate()) { continue; } synchronized (waitLock) ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku =...
#fixed code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku = new K...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku =...
#fixed code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku = new K...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku =...
#fixed code @Override public void run() { while (this.running) { //input while (!this.inputs.isEmpty()) { DatagramPacket dp = this.inputs.remove(); KcpOnUdp ku = this.kcps.get(dp.sender()); if (ku == null) { ku = new K...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static Instances createBootstrapSample(Instances instances) { Random rand = Random.getInstance(); Map<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < instances.size(); i++) { int idx = rand.nextInt(instances.size()); if (!map.containsKey(idx...
#fixed code public static Instances createBootstrapSample(Instances instances) { Random rand = Random.getInstance(); Map<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < instances.size(); i++) { int idx = rand.nextInt(instances.size()); map.put(idx, map.getOrDefault(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(timeout = 60000) public void testCommitFailWhenTSOIsDown() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); clientConfigurati...
#fixed code @Test(timeout = 60000) public void testCommitFailWhenTSOIsDown() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); clientConfiguration.set...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i ...
#fixed code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommittedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i = fir...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testMultiPutSameRow() throws Exception { try{ TransactionManager tm = new TransactionManager(hbaseConf); TransactionalTable table1 = new TransactionalTable(hbaseConf, TEST_TABLE); int num=10; TransactionState t...
#fixed code @Test public void testMultiPutSameRow() throws Exception { try{ TransactionManager tm = new TransactionManager(hbaseConf); TTable table1 = new TTable(hbaseConf, TEST_TABLE); int num=10; TransactionState t=tm.beginTransaction(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void runTestMultiTableConflict() throws Exception { TransactionManager tm = new TransactionManager(hbaseConf); TransactionalTable tt = new TransactionalTable(hbaseConf, TEST_TABLE); String table2 = TEST_TABLE + 2; HBaseAdmin admin...
#fixed code @Test public void runTestMultiTableConflict() throws Exception { TransactionManager tm = new TransactionManager(hbaseConf); TTable tt = new TTable(hbaseConf, TEST_TABLE); String table2 = TEST_TABLE + 2; HBaseAdmin admin = new HBaseAdmin(hbaseConf); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static TSOState getState(TSOServerConfig config){ TSOState returnValue; if(config.getZkServers() == null){ LOG.warn("Logger is disabled"); returnValue = new TSOState(new TimestampOracle()); } else { Book...
#fixed code public static TSOState getState(TSOServerConfig config){ TSOState returnValue; if(!config.isRecoveryEnabled()){ LOG.warn("Logger is disabled"); returnValue = new TSOState(new TimestampOracle()); } else { BookKeeperSt...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void commit(Transaction transaction) throws RollbackException, TransactionException { if (LOG.isTraceEnabled()) { LOG.trace("commit " + transaction); } // Check rollbackOnly status if (transaction.isRollbackOnly()) { ...
#fixed code public void commit(Transaction transaction) throws RollbackException, TransactionException { if (LOG.isTraceEnabled()) { LOG.trace("commit " + transaction); } if (transaction.getStatus() != Status.RUNNING) { throw new IllegalArg...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void runTestWriteWriteConflict() throws Exception { TransactionManager tm = new TransactionManager(hbaseConf); TransactionalTable tt = new TransactionalTable(hbaseConf, TEST_TABLE); TransactionState t1 = tm.beginTransaction(); LOG...
#fixed code @Test public void runTestWriteWriteConflict() throws Exception { TransactionManager tm = new TransactionManager(hbaseConf); TTable tt = new TTable(hbaseConf, TEST_TABLE); TransactionState t1 = tm.beginTransaction(); LOG.info("Transaction created " +...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i ...
#fixed code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i = firs...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testShadowCellIsHealedAfterCommitCrash() throws Exception { CommitTable.Client commitTableClient = spy(getTSO().getCommitTable().getClient().get()); TSOClient client = TSOClient.newBuilder().withConfiguration(getTSO().getClientConf...
#fixed code @Test public void testShadowCellIsHealedAfterCommitCrash() throws Exception { CommitTable.Client commitTableClient = spy(getTSO().getCommitTable().getClient().get()); TSOClient client = TSOClient.newBuilder().withConfiguration(getTSO().getClientConfigurat...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { // *** Start the Netty configuration *** // Start server with Nb of active threads = 2*NB CPU + 1 as maximum. ChannelFactory factory = new NioServerSocketChannelFactory( Executors.newCachedThreadP...
#fixed code @Override public void run() { // *** Start the Netty configuration *** // Start server with Nb of active threads = 2*NB CPU + 1 as maximum. ChannelFactory factory = new NioServerSocketChannelFactory( Executors.newCachedThreadPool(ne...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(timeOut = 30_000) public void runTestInterleaveScanWhenATransactionAborts() throws Exception { TransactionManager tm = newTransactionManager(); TTable tt = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); LOG.in...
#fixed code @Test(timeOut = 30_000) public void runTestInterleaveScanWhenATransactionAborts() throws Exception { TransactionManager tm = newTransactionManager(); TTable tt = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); LOG.info("Tr...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(timeout = 60000) public void testTimestampRequestSucceedWithMultipleTimeouts() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); ...
#fixed code @Test(timeout = 60000) public void testTimestampRequestSucceedWithMultipleTimeouts() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); cli...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testShadowCellsBasics() throws Exception { TransactionManager tm = newTransactionManager(); TTable table = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); // Test shadow cell are created properly ...
#fixed code @Test public void testShadowCellsBasics() throws Exception { TransactionManager tm = newTransactionManager(); TTable table = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); // Test shadow cell are created properly ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i ...
#fixed code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i = firs...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(timeout = 60000) public void testCommitCanSucceedWithMultipleTimeouts() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); clie...
#fixed code @Test(timeout = 60000) public void testCommitCanSucceedWithMultipleTimeouts() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); clientConf...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { // *** Start the Netty configuration *** // Start server with Nb of active threads = 2*NB CPU + 1 as maximum. ChannelFactory factory = new NioServerSocketChannelFactory( Executors.newCachedThreadP...
#fixed code @Override public void run() { // *** Start the Netty configuration *** // Start server with Nb of active threads = 2*NB CPU + 1 as maximum. ChannelFactory factory = new NioServerSocketChannelFactory( Executors.newCachedThreadPool(ne...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testCrashAfterCommit() throws Exception { CommitTable.Client commitTableClient = spy(getTSO().getCommitTable().getClient().get()); TSOClient client = TSOClient.newBuilder().withConfiguration(getTSO().getClientConfiguration()) ...
#fixed code @Test public void testCrashAfterCommit() throws Exception { CommitTable.Client commitTableClient = spy(getTSO().getCommitTable().getClient().get()); TSOClient client = TSOClient.newBuilder().withConfiguration(getTSO().getClientConfiguration()) ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i ...
#fixed code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i = firs...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void stop() { if (clientThread != null) { clientThread.interrupt(); } } #location 3 #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code public void stop() { for (NotificationClient client : clients.values()) { client.stop(); } }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testBasicBehaviour() throws Throwable { HTable table = new HTable(hbaseConf, TEST_TABLE); HBaseCommitTable commitTable = new HBaseCommitTable(table); ListenableFuture<Writer> futureWriter = commitTable.getWriter(); ...
#fixed code @Test public void testBasicBehaviour() throws Throwable { HBaseCommitTable commitTable = new HBaseCommitTable(hbaseConf, TEST_TABLE); ListenableFuture<Writer> futureWriter = commitTable.getWriter(); Writer writer = futureWriter.get(); List...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testShadowCellsBasics() throws Exception { TransactionManager tm = newTransactionManager(); TTable table = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); // Test shadow cell are created properly ...
#fixed code @Test public void testShadowCellsBasics() throws Exception { TransactionManager tm = newTransactionManager(); TTable table = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); // Test shadow cell are created properly ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i ...
#fixed code public Set<Long> raiseLargestDeletedTransaction(long id) { if (firstUncommitedAbsolute > getAbsolutePosition(id)) return Collections.emptySet(); int maxBucket = getRelativePosition(id); Set<Long> aborted = new TreeSet<Long>(); for (int i = firs...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static void main(String[] args) throws Exception { Config config = new Config(); new JCommander(config, args); Configuration hbaseConfig = HBaseConfiguration.create(); HTable commitHTable = new HTable(hbaseConfig, COMMIT_TABLE_DEF...
#fixed code public static void main(String[] args) throws Exception { Config config = new Config(); new JCommander(config, args); Configuration hbaseConfig = HBaseConfiguration.create(); final KeyGenerator keygen; if (config.fullRandomAlgo) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(timeOut = 30_000) public void runTestInterleaveScan() throws Exception { TransactionManager tm = newTransactionManager(); TTable tt = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); LOG.info("Transaction create...
#fixed code @Test(timeOut = 30_000) public void runTestInterleaveScan() throws Exception { TransactionManager tm = newTransactionManager(); TTable tt = new TTable(hbaseConf, TEST_TABLE); Transaction t1 = tm.begin(); LOG.info("Transaction created " + ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public TSOState buildState() throws LoggerException { try{ CountDownLatch latch = new CountDownLatch(1); this.zk = new ZooKeeper(config.getZkServers(), Integer....
#fixed code @Override public TSOState buildState() throws LoggerException { try{ CountDownLatch latch = new CountDownLatch(1); this.zk = new ZooKeeper(config.getZkServers(), Integer.parseI...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public byte[] getChannelConfigurationBytes() throws TransactionException { try { final Block configBlock = getConfigBlock(getShuffledPeers()); Envelope envelopeRet = Envelope.parseFrom(configBlock.getData().getData(0)); Payl...
#fixed code public byte[] getChannelConfigurationBytes() throws InvalidArgumentException, TransactionException { return getChannelConfigurationBytes(client.getUserContext()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private Channel reconstructChannel(String name, HFClient client, SampleOrg sampleOrg) throws Exception { out("Reconstructing %s channel", name); client.setUserContext(sampleOrg.getPeerAdmin()); Channel newChannel; if (BAR_CHANNEL_NAME....
#fixed code private Channel reconstructChannel(String name, HFClient client, SampleOrg sampleOrg) throws Exception { out("Reconstructing %s channel", name); client.setUserContext(sampleOrg.getPeerAdmin()); Channel newChannel; if (BAR_CHANNEL_NAME.equals...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code ExecutorService getChannelExecutorService() { return executorService; } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code Enrollment getEnrollment() { return client.getUserContext().getEnrollment(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code Ab.BroadcastResponse sendTransaction(Common.Envelope transaction) throws Exception { if (shutdown) { throw new TransactionException(format("Orderer %s was shutdown.", name)); } logger.debug(format("Order.sendTransaction name: %s, url...
#fixed code Orderer(String name, String url, Properties properties) throws InvalidArgumentException { if (StringUtil.isNullOrEmpty(name)) { throw new InvalidArgumentException("Invalid name for orderer"); } Exception e = checkGrpcUrl(url); if (...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code ListenableFuture<FabricProposalResponse.ProposalResponse> sendProposalAsync(FabricProposal.SignedProposal proposal) throws PeerException, InvalidArgumentException { checkSendProposal(proposal); logger.debug(format("peer.sendProposalAsync nam...
#fixed code Peer(String name, String grpcURL, Properties properties) throws InvalidArgumentException { Exception e = checkGrpcUrl(grpcURL); if (e != null) { throw new InvalidArgumentException("Bad peer url.", e); } if (StringUtil.isNullOrEmp...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public byte[] getChannelConfigurationBytes() throws TransactionException { try { final Block configBlock = getConfigurationBlock(); Envelope envelopeRet = Envelope.parseFrom(configBlock.getData().getData(0)); Payload payload...
#fixed code public byte[] getChannelConfigurationBytes() throws TransactionException { try { final Block configBlock = getConfigBlock(getRandomPeer()); Envelope envelopeRet = Envelope.parseFrom(configBlock.getData().getData(0)); Payload paylo...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testValidateInvalidCertificate() throws IOException, CertificateException { BufferedInputStream pem = new BufferedInputStream(new ByteArrayInputStream(invalidPemCert)); assertFalse(crypto.validateCertificate(invalidPemCert)); }...
#fixed code @Test public void testValidateInvalidCertificate() throws IOException, CertificateException { assertFalse(crypto.validateCertificate(invalidPemCert)); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void parseConfigBlock() throws TransactionException { try { final Block configBlock = getConfigurationBlock(); logger.debug(format("Channel %s Got config block getting MSP data and anchorPeers data", name)); Enve...
#fixed code protected void parseConfigBlock() throws TransactionException { try { Block parseFrom = getConfigBlock(getRandomPeer()); // final Block configBlock = getConfigurationBlock(); logger.debug(format("Channel %s Got config block gett...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void initiateEventing(TransactionContext transactionContext, PeerOptions peersOptions) throws TransactionException { this.transactionContext = transactionContext.retryTransactionSameContext(); if (peerEventingClient == null) { //PeerEventS...
#fixed code boolean hasConnected() { return connected; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code synchronized boolean connect(final TransactionContext transactionContext) throws EventHubException { if (connected) { logger.warn(format("%s already connected.", toString())); return true; } eventStream = null; fi...
#fixed code synchronized boolean connect(final TransactionContext transactionContext) throws EventHubException { if (connected) { logger.warn(format("%s already connected.", toString())); return true; } eventStream = null; final Co...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void peerVent(TransactionContext transactionContext) throws TransactionException { logger.trace(toString() + "peerVent transaction: " + transactionContext); final Envelope envelope; try { Ab.SeekPosition.Builder start = Ab.SeekPosi...
#fixed code PeerEventServiceClient(Peer peer, Endpoint endpoint, Properties properties, PeerOptions peerOptions) { this.channelBuilder = endpoint.getChannelBuilder(); this.filterBlock = peerOptions.isRegisterEventsForFilteredBlocks(); this.peer = peer; th...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void setTLSCertificateKeyPair(TLSCertificateKeyPair tlsCertificateKeyPair) { properties.put("clientKeyBytes", tlsCertificateKeyPair.getKeyPemBytes()); properties.put("clientCertBytes", tlsCertificateKeyPair.getCertPEMBytes()); Endpoint endpoint ...
#fixed code boolean hasConnected() { return connected; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code DeliverResponse[] sendDeliver(Common.Envelope transaction) throws TransactionException { if (shutdown) { throw new TransactionException(format("Orderer %s was shutdown.", name)); } OrdererClient localOrdererClient = ordererClient; ...
#fixed code Orderer(String name, String url, Properties properties) throws InvalidArgumentException { if (StringUtil.isNullOrEmpty(name)) { throw new InvalidArgumentException("Invalid name for orderer"); } Exception e = checkGrpcUrl(url); if (...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, Orderer orderer, byte[]... signers) throws TransactionException, InvalidArgumentException { checkChannelState(); checkOrderer(orderer); try { ...
#fixed code public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, Orderer orderer, byte[]... signers) throws TransactionException, InvalidArgumentException { updateChannelConfiguration(client.getUserContext(), updateChannelConfiguration, or...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testGetInfo() throws Exception { if (testConfig.isRunningAgainstFabric10()) { HFCAInfo info = client.info(); assertNull(info.getVersion()); } if (!testConfig.isRunningAgainstFabric10()) { ...
#fixed code @Test public void testGetInfo() throws Exception { if (testConfig.isRunningAgainstFabric10()) { HFCAInfo info = client.info(); assertNull(info.getVersion()); } if (!testConfig.isRunningAgainstFabric10()) { HFCA...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void connectEnvelope(Envelope envelope) throws TransactionException { if (shutdown) { logger.warn(format("Peer %s not connecting is shutdown ", peer)); return; } ManagedChannel lmanagedChannel = managedChannel; ...
#fixed code PeerEventServiceClient(Peer peer, Endpoint endpoint, Properties properties, PeerOptions peerOptions) { this.channelBuilder = endpoint.getChannelBuilder(); this.filterBlock = peerOptions.isRegisterEventsForFilteredBlocks(); this.peer = peer; na...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code TBSCertList.CRLEntry[] parseCRL(String crl) throws Exception { Base64.Decoder b64dec = Base64.getDecoder(); final byte[] decode = b64dec.decode(crl.getBytes(UTF_8)); ByteArrayInputStream inStream = new ByteArrayInputStream(decode); ASN1...
#fixed code TBSCertList.CRLEntry[] getRevokes(Date r) throws Exception { String crl = client.generateCRL(admin, r, null, null, null); return parseCRL(crl); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code DeliverResponse[] sendDeliver(Common.Envelope transaction) throws TransactionException { if (shutdown) { throw new TransactionException(format("Orderer %s was shutdown.", name)); } OrdererClient localOrdererClient = ordererClient; ...
#fixed code Orderer(String name, String url, Properties properties) throws InvalidArgumentException { if (StringUtil.isNullOrEmpty(name)) { throw new InvalidArgumentException("Invalid name for orderer"); } Exception e = checkGrpcUrl(url); if (...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, byte[]... signers) throws TransactionException, InvalidArgumentException { updateChannelConfiguration(updateChannelConfiguration, getRandomOrderer(), signers); } ...
#fixed code public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, byte[]... signers) throws TransactionException, InvalidArgumentException { updateChannelConfiguration(client.getUserContext(), updateChannelConfiguration, getRandomOrderer()...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void setTLSCertificateKeyPair(TLSCertificateKeyPair tlsCertificateKeyPair) { properties.put("clientKeyBytes", tlsCertificateKeyPair.getKeyPemBytes()); properties.put("clientCertBytes", tlsCertificateKeyPair.getCertPEMBytes()); Endpoint endpoint ...
#fixed code boolean hasConnected() { return connected; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code TBSCertList.CRLEntry[] getRevokes(Date r) throws Exception { String crl = client.generateCRL(admin, r, null, null, null); Base64.Decoder b64dec = Base64.getDecoder(); final byte[] decode = b64dec.decode(crl.getBytes(UTF_8)); ByteArrayI...
#fixed code TBSCertList.CRLEntry[] getRevokes(Date r) throws Exception { String crl = client.generateCRL(admin, r, null, null, null); return parseCRL(crl); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void setProperties(Properties properties) { this.properties = properties; } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code boolean hasConnected() { return connected; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code Map<String, SDChaindcode> discoverEndorserEndpoints(TransactionContext transactionContext, List<List<ServiceDiscoveryChaincodeCalls>> chaincodeNames) throws ServiceDiscoveryException { if (null == chaincodeNames) { logger.warn("Discover of chaincode ...
#fixed code ServiceDiscovery(Channel channel, Collection<Peer> serviceDiscoveryPeers, TransactionContext transactionContext) { this.serviceDiscoveryPeers = serviceDiscoveryPeers; this.channel = channel; this.channelName = channel.getName(); this.transactio...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code FabricProposalResponse.ProposalResponse sendProposal(FabricProposal.SignedProposal proposal) throws PeerException, InvalidArgumentException { checkSendProposal(proposal); logger.debug(format("peer.sendProposalAsync name: %s, url: %s", name, ...
#fixed code Peer(String name, String grpcURL, Properties properties) throws InvalidArgumentException { Exception e = checkGrpcUrl(grpcURL); if (e != null) { throw new InvalidArgumentException("Bad peer url.", e); } if (StringUtil.isNullOrEmp...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private static final Collection<MapArea> createAreasForSimpleMultipolygon(OsmRelation relation, TLongObjectMap<MapNode> nodeIdMap, OsmEntityProvider db) throws EntityNotFoundException { assert isSimpleMultipolygon(relation, db); OsmEntity tagSource = null; List<...
#fixed code private static final Collection<MapArea> createAreasForSimpleMultipolygon(OsmRelation relation, TLongObjectMap<MapNode> nodeIdMap, OsmEntityProvider db) throws EntityNotFoundException { assert isSimpleMultipolygon(relation, db); OsmEntity tagSource = null; List<MapNod...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static void main(String[] unparsedArgs) { ProgramMode programMode; CLIArguments args = null; /* parse command line arguments */ if (unparsedArgs.length > 0) { try { args = CliFactory.parseArguments(CLIArguments.class, unparsedArgs); } ...
#fixed code public static void main(String[] unparsedArgs) { /* assume --gui if no parameters are given */ if (unparsedArgs.length == 0) { System.out.println("No parameters, running graphical interface.\n" + "If you want to use the command line, use the --help" + ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void addPrimitiveToValueBuffer(BufferT buffer, Primitive primitive) { /* * rearrange the lists of vertices, normals and texture coordinates * to turn triangle strips and triangle fans into separate triangles */ List<VectorXYZ> pr...
#fixed code @Override protected void addPrimitiveToValueBuffer(BufferT buffer, Primitive primitive) { /* * rearrange the lists of vertices, normals and texture coordinates * to turn triangle strips and triangle fans into separate triangles */ List<VectorXYZ> primVert...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static void main(String[] unparsedArgs) { ProgramMode programMode; CLIArguments args = null; if (unparsedArgs.length > 0) { try { args = CliFactory.parseArguments(CLIArguments.class, unparsedArgs); } catch (ArgumentValidationException e) { ...
#fixed code public static void main(String[] unparsedArgs) { ProgramMode programMode; CLIArguments args = null; /* parse command line arguments */ if (unparsedArgs.length > 0) { try { args = CliFactory.parseArguments(CLIArguments.class, unparsedArgs); } catch ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void beginObject(WorldObject object) { /* build the previous object (if it's inside the bounding box) */ boolean isInsideBbox = true; if (currentObject != null && currentObject.getPrimaryMapElement() != null) { MapElement mapElement = current...
#fixed code @Override public void beginObject(WorldObject object) { finishCurrentObject(); /* start a new object */ currentObject = object; currentTriangles = new HashMap<Material, FrontendPbfTarget.TriangleData>(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static final boolean isJOSMGenerated(File file) { try { BufferedReader reader = new BufferedReader(new FileReader(file)); for (int i=0; i<100; i++) { String line = reader.readLine(); if (line != null) { if (line.contains("generator='J...
#fixed code public static final boolean isJOSMGenerated(File file) { try { BufferedReader reader = new BufferedReader(new FileReader(file)); for (int i=0; i<100; i++) { String line = reader.readLine(); if (line != null) { if (line.contains("generator='JOSM'")...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static int createFragmentShader(GL3 gl, String filename) { int fragShader = gl.glCreateShader(GL3.GL_FRAGMENT_SHADER); if (fragShader == 0) return 0; String[] fragCode = new String[1]; fragCode[0] = ""; String line; InputStream stream = loadShaderF...
#fixed code public static int createFragmentShader(GL3 gl, String filename) { int fragShader = gl.glCreateShader(GL3.GL_FRAGMENT_SHADER); if (fragShader == 0) return 0; String[] fragCode = new String[1]; fragCode[0] = ""; String line; InputStream stream = loadShaderFile(fi...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void createComponents(){ for (MapElement element : elements){ switch (element.getTags().getValue("indoor")){ case "wall": walls.add(new IndoorWall(buildingPart, element)); break; ...
#fixed code private void createComponents(){ for (MapElement element : elements){ IndoorObjectData data = new IndoorObjectData(buildingPart, element); switch (element.getTags().getValue("indoor")){ case "wall": wall...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static final boolean isJOSMGenerated(File file) { try { BufferedReader reader = new BufferedReader(new FileReader(file)); for (int i=0; i<100; i++) { String line = reader.readLine(); if (line != null) { if (line.contains("generator='JOSM'")) ...
#fixed code public static final boolean isJOSMGenerated(File file) { try (BufferedReader reader = new BufferedReader(new FileReader(file))) { for (int i=0; i<100; i++) { String line = reader.readLine(); if (line != null) { if (line.contains("generator='JOSM'")) { r...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static int createVertexShader(GL3 gl, String filename) { // get the unique id int vertShader = gl.glCreateShader(GL3.GL_VERTEX_SHADER); if (vertShader == 0) throw new RuntimeException("Unable to create vertex shader."); // create a single String array i...
#fixed code public static int createVertexShader(GL3 gl, String filename) { // get the unique id int vertShader = gl.glCreateShader(GL3.GL_VERTEX_SHADER); if (vertShader == 0) throw new RuntimeException("Unable to create vertex shader."); // create a single String array index t...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static final List<String[]> getUnparsedParameterGroups( File parameterFile) throws IOException { List<String[]> result = new ArrayList<String[]>(); BufferedReader in = new BufferedReader(new FileReader(parameterFile)); String line; while ((line = in.r...
#fixed code public static final List<String[]> getUnparsedParameterGroups( File parameterFile) throws IOException { try (BufferedReader in = new BufferedReader(new FileReader(parameterFile))) { List<String[]> result = new ArrayList<>(); String line; while ((line = in.readL...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static final boolean isJOSMGenerated(File file) { try { BufferedReader reader = new BufferedReader(new FileReader(file)); for (int i=0; i<100; i++) { String line = reader.readLine(); if (line != null) { if (line.contains("generator='JOSM'")) ...
#fixed code public static final boolean isJOSMGenerated(File file) { try (BufferedReader reader = new BufferedReader(new FileReader(file))) { for (int i=0; i<100; i++) { String line = reader.readLine(); if (line != null) { if (line.contains("generator='JOSM'")) { r...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static void main(String[] unparsedArgs) { ProgramMode programMode; CLIArguments args = null; /* parse command line arguments */ if (unparsedArgs.length > 0) { try { args = CliFactory.parseArguments(CLIArguments.class, unparsedArgs); } ...
#fixed code public static void main(String[] unparsedArgs) { ProgramMode programMode; CLIArguments args = null; /* parse command line arguments */ if (unparsedArgs.length > 0) { try { args = CliFactory.parseArguments(CLIArguments.class, unparsedArgs); } catch ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void slaveDown(ClusterSlotRange slotRange, String host, int port) { Collection<RedisPubSubConnection> allPubSubConnections = getEntry(slotRange).slaveDown(host, port); // reattach listeners to other channels for (Entry<String, PubSubCo...
#fixed code protected void slaveDown(ClusterSlotRange slotRange, String host, int port) { MasterSlaveEntry entry = getEntry(slotRange); slaveDown(entry, host, port); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public boolean compareAndSet(long expect, long update) { RedisConnection<String, Object> conn = connectionManager.connection(); try { while (true) { conn.watch(getName()); Long value = (Long) conn...
#fixed code @Override public boolean compareAndSet(long expect, long update) { RedisConnection<String, Object> conn = connectionManager.connection(); try { while (true) { conn.watch(getName()); Long value = ((Number) conn.ge...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public boolean remove(Object o) { RedisConnection<String, Object> connection = connectionManager.connectionWriteOp(); try { return connection.lrem(getName(), 1, o) > 0; } finally { connectionManager.release(c...
#fixed code @Override public boolean remove(Object o) { return remove(o, 1); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testReplaceDepartments(){ List<Department> departments = Departments.defaultDepartments().list(); File tmpDir = Files.createTempDir(); File groups = new File(tmpDir, "departments.csv"); try { PrintWrite...
#fixed code @Test public void testReplaceDepartments(){ List<Department> departments = Departments.defaultDepartments().list(); File tmpDir = Files.createTempDir(); File groups = new File(tmpDir, "departments.csv"); try { PrintWriter grou...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testReplaceUsers(){ List<ReadUser> allUsers = Users.defaultUsers().list(); File tmpDir = Files.createTempDir(); File users = new File(tmpDir, "users.csv"); try { PrintWriter userPrintWriter = new PrintW...
#fixed code @Test public void testReplaceUsers(){ List<ReadUser> allUsers = Users.defaultUsers().list(); File tmpDir = Files.createTempDir(); File users = new File(tmpDir, "users.csv"); try { PrintWriter userPrintWriter = new PrintWriter(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void loadMainDict() { //建立一个主词典实例 _MainDict = new DictSegment((char) 0); //读取主词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getMainDictionary()); if (is == null) { throw new Run...
#fixed code private void loadMainDict() { // 建立一个主词典实例 _MainDict = new DictSegment((char) 0); // 读取主词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getMainDictionary()); if (is == null) { throw new Runtime...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void loadStopWordDict() { //建立一个主词典实例 _StopWordDict = new DictSegment((char) 0); //加载扩展停止词典 List<String> extStopWordDictFiles = cfg.getExtStopWordDictionarys(); if (extStopWordDictFiles != null) { InputStream i...
#fixed code private void loadStopWordDict() { // 建立一个主词典实例 _StopWordDict = new DictSegment((char) 0); // 加载扩展停止词典 List<String> extStopWordDictFiles = cfg.getExtStopWordDictionarys(); if (extStopWordDictFiles != null) { InputStream is; ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code static UpdateKeeper getInstance() { if (singleton == null) { synchronized (UpdateKeeper.class) { if (singleton == null) { singleton = new UpdateKeeper(); return singleton; } ...
#fixed code static UpdateKeeper getInstance() { return UpdateKeeper.Builder.singleton; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void loadExtDict() { //加载扩展词典配置 List<String> extDictFiles = cfg.getExtDictionarys(); if (extDictFiles != null) { InputStream is; for (String extDictName : extDictFiles) { //读取扩展词典文件 ...
#fixed code private void loadExtDict() { // 加载扩展词典配置 List<String> extDictFiles = cfg.getExtDictionarys(); if (extDictFiles != null) { InputStream is; for (String extDictName : extDictFiles) { // 读取扩展词典文件 Syst...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void loadQuantifierDict() { // 建立一个量词典实例 _QuantifierDict = new DictSegment((char) 0); // 读取量词词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getQuantifierDicionary()); if (is == null) { ...
#fixed code private void loadQuantifierDict() { // 建立一个量词典实例 _QuantifierDict = new DictSegment((char) 0); // 读取量词词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getQuantifierDicionary()); if (is == null) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void loadMainDict() { // 建立一个主词典实例 _MainDict = new DictSegment((char) 0); // 读取主词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getMainDictionary()); if (is == null) { throw new R...
#fixed code private void loadMainDict() { // 建立一个主词典实例 _MainDict = new DictSegment((char) 0); // 读取主词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getMainDictionary()); if (is == null) { throw new Runtime...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void loadStopWordDict() { // 建立一个主词典实例 _StopWordDict = new DictSegment((char) 0); // 加载扩展停止词典 List<String> extStopWordDictFiles = cfg.getExtStopWordDictionarys(); if (extStopWordDictFiles != null) { InputStream...
#fixed code private void loadStopWordDict() { // 建立一个主词典实例 _StopWordDict = new DictSegment((char) 0); // 加载扩展停止词典 List<String> extStopWordDictFiles = cfg.getExtStopWordDictionarys(); if (extStopWordDictFiles != null) { InputStream is; ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void loadQuantifierDict() { //建立一个量词典实例 _QuantifierDict = new DictSegment((char) 0); //读取量词词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getQuantifierDicionary()); if (is == null) { ...
#fixed code private void loadQuantifierDict() { // 建立一个量词典实例 _QuantifierDict = new DictSegment((char) 0); // 读取量词词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getQuantifierDicionary()); if (is == null) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void loadExtDict() { // 加载扩展词典配置 List<String> extDictFiles = cfg.getExtDictionarys(); if (extDictFiles != null) { InputStream is; for (String extDictName : extDictFiles) { // 读取扩展词典文件 ...
#fixed code private void loadExtDict() { // 加载扩展词典配置 List<String> extDictFiles = cfg.getExtDictionarys(); if (extDictFiles != null) { InputStream is; for (String extDictName : extDictFiles) { // 读取扩展词典文件 Syst...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static void reloadDic(List<InputStream> inputStreamList) { if (singleton == null) { Configuration cfg = DefaultConfig.getInstance(); initial(cfg); } for (InputStream is : inputStreamList) { try { ...
#fixed code public static void reloadDic(List<InputStream> inputStreamList) { // 如果本类单例尚未实例化,则先进行初始化操作 if (singleton == null) { Configuration cfg = DefaultConfig.getInstance(); initial(cfg); } // 对词典流集合进行循环读取,将读取到的词语加载到主词典中 ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public List<DiscoveryNode> buildDynamicNodes() { if (refreshInterval.millis() != 0) { if (cachedDiscoNodes != null && (refreshInterval.millis() < 0 || (System.currentTimeMillis() - lastRefresh) < refreshInterval.mill...
#fixed code @Override public List<DiscoveryNode> buildDynamicNodes() { if (refreshInterval.millis() != 0) { if (cachedDiscoNodes != null && (refreshInterval.millis() < 0 || (System.currentTimeMillis() - lastRefresh) < refreshInterval.millis()))...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void write(RtpPacket packet, RTPFormat format) { // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { this.format = format; lo...
#fixed code public void write(RtpPacket packet, RTPFormat format) { try { LOCK.lock(); // checking format if (format == null) { logger.warn("No format specified. Packet dropped!"); return; } if (this.format == null || this.format.getID() != format.getID()) { th...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void harvest(IceMediaStream mediaStream, PortManager portManager, Selector selector) throws HarvestException, NoCandidatesGatheredException { // Safe copy of currently registered harvesters Map<CandidateType, CandidateHarvester> copy; synchronized (this.harves...
#fixed code public void harvest(IceMediaStream mediaStream, PortManager portManager, Selector selector) throws HarvestException, NoCandidatesGatheredException { // Ask each harvester to gather candidates for the media stream // HOST candidates take precedence and are mandatory Candida...
Below is the vulnerable code, please generate the patch based on the following information.