instruction
stringclasses
1 value
output
stringlengths
64
69.4k
input
stringlengths
205
32.4k
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @GET @Path("/result_counter/{identifier}") @Produces("application/json") public EnumMap<ResultType, Integer> getCounterResults(@PathParam("identifier") String executionIdentifier) { try { return this.resultCounts.get(executionIdentifier); } catch (Exception ...
#vulnerable code @GET @Path("/result_counter/{identifier}") @Produces("application/json") public EnumMap<ResultType, Integer> getCounterResults(@PathParam("identifier") String executionIdentifier) { try { return AlgorithmExecutionCache.getResultCounter(executionIdentifier)...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testGenerateNewCsvFile() throws SimpleRelationalInputGenerationException, IOException { // Setup SimpleRelationalInput csv = generator.generateNewCopy(); // Check result // The csv should contain both lines and iterate through them with next. asse...
#vulnerable code @Test public void testGenerateNewCsvFile() throws IOException { // Setup SimpleRelationalInput csv = generator.generateNewCsvFile(); // Check result // The csv should contain both lines and iterate through them with next. assertEquals(csvFileFixture.expectedF...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void receiveResult(ColumnCombination columnCombination) { appendToResultFile(columnCombination.toString()); }
#vulnerable code @Override public void receiveResult(ColumnCombination columnCombination) { try { FileWriter writer = new FileWriter(this.file, true); writer.write(columnCombination.toString() + "\n"); writer.close(); } catch (IOException e) { // TODO Auto-generated catch ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected AlgorithmExecutor buildExecutor(String algorithmName) throws FileNotFoundException, UnsupportedEncodingException { LinkedList<ResultPrinter> resultPrinters = new LinkedList<ResultPrinter>(); FunctionalDependencyPrinter fdResultReceiver = new FunctionalDepen...
#vulnerable code protected AlgorithmExecutor buildExecutor(String algorithmName) throws FileNotFoundException, UnsupportedEncodingException { FunctionalDependencyResultReceiver fdResultReceiver = new FunctionalDependencyPrinter(getResultFileName(algorithmName), getResultDirectoryNam...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testAddAlgorithm() throws EntityStorageException, AlgorithmLoadingException { // Setup HibernateUtil.clear(); AlgorithmServiceImpl finderService = new AlgorithmServiceImpl(); // Execute functionality: add an IND algorithm Algorithm algo...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public ConfigurationSettingCsvFile getValues() throws InputValidationException { String selectedValue = this.listbox.getSelectedValue(); if (selectedValue.equals("--")) { throw new InputValidationException("You must choose a CSV file!"); } FileInput curr...
#vulnerable code public ConfigurationSettingCsvFile getValues() { if (this.listbox.getSelectedValue().equals("--")) { this.messageReceiver.addError("You must choose a CSV file!"); return null; } FileInput currentFileInput = this.fileInputs.get( this.listbo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<Result> fetchNewResults(String algorithmName){ List<Result> newResults = new LinkedList<Result>(); //newResults.add(currentResultReceivers.get(algorithmName).getNewResults()); newResults.add(new UniqueColumnCombination(new ColumnIdentifier("table", "col1")))...
#vulnerable code public List<Result> fetchNewResults(String algorithmName){ List<Result> newResults = new LinkedList<Result>(); for (ResultPrinter printer : currentResultPrinters.get(algorithmName)) { // newResults.addAll(printer.getNewResults()); } newResults.add(new UniqueCo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testGenerateNewCsvFile() throws SimpleRelationalInputGenerationException, InputIterationException { // Setup SimpleRelationalInput csv = generator.generateNewCopy(); // Check result // The csv should contain both lines and iterate through them with ...
#vulnerable code @Test public void testGenerateNewCsvFile() throws SimpleRelationalInputGenerationException, IOException { // Setup SimpleRelationalInput csv = generator.generateNewCopy(); // Check result // The csv should contain both lines and iterate through them with next. ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected AlgorithmExecutor buildExecutor(String executionIdentifier) throws FileNotFoundException, UnsupportedEncodingException { ResultPrinter resultPrinter = new ResultPrinter(executionIdentifier); ResultsCache resultsCache = new ResultsCache(); ResultsHub ...
#vulnerable code protected AlgorithmExecutor buildExecutor(String executionIdentifier) throws FileNotFoundException, UnsupportedEncodingException { ResultPrinter resultPrinter = new ResultPrinter(executionIdentifier, "results"); ResultsCache resultsCache = new ResultsCache()...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void executeUniqueColumnCombinationsAlgorithm(String algorithmName, List<InputParameter> parameters) { List<ConfigurationValue> configs = convertInputParameters(parameters); UniqueColumnCombinationResultReceiver resultReceiver = new UniqueColumnCombinati...
#vulnerable code @Override public void executeUniqueColumnCombinationsAlgorithm(String algorithmName, List<InputParameter> parameters) { List<ConfigurationValue> configs = convertInputParameters(parameters); UniqueColumnCombinationResultReceiver resultReceiver = new UniqueColumnCom...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<OperationArgument> buildResolverArguments(ArgumentBuilderParams params) { Method resolverMethod = params.getResolverMethod(); List<OperationArgument> operationArguments = new ArrayList<>(resolverMethod.getParameterCount()); An...
#vulnerable code @Override public List<OperationArgument> buildResolverArguments(ArgumentBuilderParams params) { Method resolverMethod = params.getResolverMethod(); List<OperationArgument> operationArguments = new ArrayList<>(resolverMethod.getParameterCount()); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testConflictingConnections() { try (TestLog log = new TestLog(OperationMapper.class)) { new TestSchemaGenerator() .withOperationsFromSingleton(new ConflictingBookService()) .generate(); ...
#vulnerable 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.
#fixed code public void startDb() { postgres = new MyPostgreSQLContainer() .withDatabaseName(TEST_SCHEMA_NAME) .withUsername("SA") .withPassword("pass") .withLogConsumer(new Consumer<OutputFrame>() { @Override ...
#vulnerable code public void startDb() { postgres = (PostgreSQLContainer) new PostgreSQLContainer() .withDatabaseName(TEST_SCHEMA_NAME) .withUsername("SA") .withPassword("pass") .withLogConsumer(new Consumer<OutputFrame>() { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static void copyResources(URL resourceUrl, File targetPath) throws IOException, URISyntaxException { if (resourceUrl == null) { return; } URLConnection urlConnection = resourceUrl.openConnection(); /** * Copy resources ei...
#vulnerable code static void copyResources(URL resourceUrl, File targetPath) throws IOException, URISyntaxException { if (resourceUrl == null) { return; } URLConnection urlConnection = resourceUrl.openConnection(); /** * Copy resour...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 =...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 =...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 =...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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()); ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 =...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(timeout = 60000) public void testTimestampRequestSucceedWithMultipleTimeouts() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); cli...
#vulnerable code @Test(timeout = 60000) public void testTimestampRequestSucceedWithMultipleTimeouts() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(timeout = 60000) public void testCommitCanSucceedWithMultipleTimeouts() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); clientConf...
#vulnerable code @Test(timeout = 60000) public void testCommitCanSucceedWithMultipleTimeouts() throws Exception { Configuration clientConfiguration = getClientConfiguration(); clientConfiguration.setProperty(TSOClient.REQUEST_TIMEOUT_IN_MS_CONFKEY, 100); clie...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCrashAfterCommit() throws Exception { CommitTable.Client commitTableClient = spy(getTSO().getCommitTable().getClient().get()); TSOClient client = TSOClient.newBuilder().withConfiguration(getTSO().getClientConfiguration()) ...
#vulnerable 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.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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 " + ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code Enrollment getEnrollment() { return client.getUserContext().getEnrollment(); }
#vulnerable code ExecutorService getChannelExecutorService() { return executorService; } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#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 (...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code boolean hasConnected() { return connected; }
#vulnerable code void initiateEventing(TransactionContext transactionContext, PeerOptions peersOptions) throws TransactionException { this.transactionContext = transactionContext.retryTransactionSameContext(); if (peerEventingClient == null) { //PeerEventS...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#vulnerable code synchronized boolean connect(final TransactionContext transactionContext) throws EventHubException { if (connected) { logger.warn(format("%s already connected.", toString())); return true; } eventStream = null; fi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code PeerEventServiceClient(Peer peer, Endpoint endpoint, Properties properties, PeerOptions peerOptions) { this.channelBuilder = endpoint.getChannelBuilder(); this.filterBlock = peerOptions.isRegisterEventsForFilteredBlocks(); this.peer = peer; th...
#vulnerable code void peerVent(TransactionContext transactionContext) throws TransactionException { logger.trace(toString() + "peerVent transaction: " + transactionContext); final Envelope envelope; try { Ab.SeekPosition.Builder start = Ab.SeekPosi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, Orderer orderer, byte[]... signers) throws TransactionException, InvalidArgumentException { updateChannelConfiguration(client.getUserContext(), updateChannelConfiguration, or...
#vulnerable code public void updateChannelConfiguration(UpdateChannelConfiguration updateChannelConfiguration, Orderer orderer, byte[]... signers) throws TransactionException, InvalidArgumentException { checkChannelState(); checkOrderer(orderer); try { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testGetInfo() throws Exception { if (testConfig.isRunningAgainstFabric10()) { HFCAInfo info = client.info(); assertNull(info.getVersion()); } if (!testConfig.isRunningAgainstFabric10()) { HFCA...
#vulnerable code @Test public void testGetInfo() throws Exception { if (testConfig.isRunningAgainstFabric10()) { HFCAInfo info = client.info(); assertNull(info.getVersion()); } if (!testConfig.isRunningAgainstFabric10()) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code PeerEventServiceClient(Peer peer, Endpoint endpoint, Properties properties, PeerOptions peerOptions) { this.channelBuilder = endpoint.getChannelBuilder(); this.filterBlock = peerOptions.isRegisterEventsForFilteredBlocks(); this.peer = peer; na...
#vulnerable code void connectEnvelope(Envelope envelope) throws TransactionException { if (shutdown) { logger.warn(format("Peer %s not connecting is shutdown ", peer)); return; } ManagedChannel lmanagedChannel = managedChannel; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code boolean hasConnected() { return connected; }
#vulnerable code void setTLSCertificateKeyPair(TLSCertificateKeyPair tlsCertificateKeyPair) { properties.put("clientKeyBytes", tlsCertificateKeyPair.getKeyPemBytes()); properties.put("clientCertBytes", tlsCertificateKeyPair.getCertPEMBytes()); Endpoint endpoint ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code TBSCertList.CRLEntry[] getRevokes(Date r) throws Exception { String crl = client.generateCRL(admin, r, null, null, null); return parseCRL(crl); }
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code boolean hasConnected() { return connected; }
#vulnerable code void setProperties(Properties properties) { this.properties = properties; } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#vulnerable code FabricProposalResponse.ProposalResponse sendProposal(FabricProposal.SignedProposal proposal) throws PeerException, InvalidArgumentException { checkSendProposal(proposal); logger.debug(format("peer.sendProposalAsync name: %s, url: %s", name, ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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<...
Below is the vulnerable code, please generate the patch based on the following information.
#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" + ...
#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); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void beginObject(WorldObject object) { finishCurrentObject(); /* start a new object */ currentObject = object; currentTriangles = new HashMap<Material, FrontendPbfTarget.TriangleData>(); }
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void createComponents(){ for (MapElement element : elements){ IndoorObjectData data = new IndoorObjectData(buildingPart, element); switch (element.getTags().getValue("indoor")){ case "wall": wall...
#vulnerable code private void createComponents(){ for (MapElement element : elements){ switch (element.getTags().getValue("indoor")){ case "wall": walls.add(new IndoorWall(buildingPart, element)); break; ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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'")) ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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'")) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void slaveDown(ClusterSlotRange slotRange, String host, int port) { MasterSlaveEntry entry = getEntry(slotRange); slaveDown(entry, host, port); }
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadStopWordDict() { // 建立一个主词典实例 _StopWordDict = new DictSegment((char) 0); // 加载扩展停止词典 List<String> extStopWordDictFiles = cfg.getExtStopWordDictionarys(); if (extStopWordDictFiles != null) { InputStream is; ...
#vulnerable code private void loadStopWordDict() { //建立一个主词典实例 _StopWordDict = new DictSegment((char) 0); //加载扩展停止词典 List<String> extStopWordDictFiles = cfg.getExtStopWordDictionarys(); if (extStopWordDictFiles != null) { InputStream i...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static UpdateKeeper getInstance() { return UpdateKeeper.Builder.singleton; }
#vulnerable code static UpdateKeeper getInstance() { if (singleton == null) { synchronized (UpdateKeeper.class) { if (singleton == null) { singleton = new UpdateKeeper(); return singleton; } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadExtDict() { // 加载扩展词典配置 List<String> extDictFiles = cfg.getExtDictionarys(); if (extDictFiles != null) { InputStream is; for (String extDictName : extDictFiles) { // 读取扩展词典文件 Syst...
#vulnerable code private void loadExtDict() { //加载扩展词典配置 List<String> extDictFiles = cfg.getExtDictionarys(); if (extDictFiles != null) { InputStream is; for (String extDictName : extDictFiles) { //读取扩展词典文件 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadQuantifierDict() { // 建立一个量词典实例 _QuantifierDict = new DictSegment((char) 0); // 读取量词词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getQuantifierDicionary()); if (is == null) { ...
#vulnerable 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.
#fixed code private void loadMainDict() { // 建立一个主词典实例 _MainDict = new DictSegment((char) 0); // 读取主词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getMainDictionary()); if (is == null) { throw new Runtime...
#vulnerable code private void loadMainDict() { // 建立一个主词典实例 _MainDict = new DictSegment((char) 0); // 读取主词典文件 InputStream is = this.getClass().getClassLoader().getResourceAsStream(cfg.getMainDictionary()); if (is == null) { throw new R...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadStopWordDict() { // 建立一个主词典实例 _StopWordDict = new DictSegment((char) 0); // 加载扩展停止词典 List<String> extStopWordDictFiles = cfg.getExtStopWordDictionarys(); if (extStopWordDictFiles != null) { InputStream is; ...
#vulnerable code private void loadStopWordDict() { // 建立一个主词典实例 _StopWordDict = new DictSegment((char) 0); // 加载扩展停止词典 List<String> extStopWordDictFiles = cfg.getExtStopWordDictionarys(); if (extStopWordDictFiles != null) { InputStream...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void loadExtDict() { // 加载扩展词典配置 List<String> extDictFiles = cfg.getExtDictionarys(); if (extDictFiles != null) { InputStream is; for (String extDictName : extDictFiles) { // 读取扩展词典文件 Syst...
#vulnerable code private void loadExtDict() { // 加载扩展词典配置 List<String> extDictFiles = cfg.getExtDictionarys(); if (extDictFiles != null) { InputStream is; for (String extDictName : extDictFiles) { // 读取扩展词典文件 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<DiscoveryNode> buildDynamicNodes() { if (refreshInterval.millis() != 0) { if (cachedDiscoNodes != null && (refreshInterval.millis() < 0 || (System.currentTimeMillis() - lastRefresh) < refreshInterval.millis()))...
#vulnerable code @Override public List<DiscoveryNode> buildDynamicNodes() { if (refreshInterval.millis() != 0) { if (cachedDiscoNodes != null && (refreshInterval.millis() < 0 || (System.currentTimeMillis() - lastRefresh) < refreshInterval.mill...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void leaveRtpSession() { if (this.joined.get()) { this.joined.set(false); /* * When the participant decides to leave the system, tp is reset to tc, the current time, members and pmembers are * initialized to 1,...
#vulnerable code public void leaveRtpSession() { if (this.joined.get()) { this.joined.set(false); /* * When the participant decides to leave the system, tp is reset to tc, the current time, members and pmembers are * initialized...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCodec() throws Exception { boolean testPassed = false; try { OpusJni opus = new OpusJni(); opus.initNative(); final int packetSize = 480; File outputFile = File.createTempFile("opustest", ".tmp"); ...
#vulnerable code @Test public void testCodec() throws Exception { boolean testPassed = false; try { final int packetSize = 480; File outputFile = File.createTempFile("opustest", ".tmp"); FileInputStream inputStream = new FileInputStream("sr...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Frame read(long timestamp) { try { LOCK.lock(); if (queue.size() == 0) { this.ready = false; return null; } //extract packet Frame frame = queue.remove(0); //buffer empty now? - change ready flag. if (queue.size() == 0) { this.read...
#vulnerable code public Frame read(long timestamp) { try { if (queue.size() == 0) { this.ready = false; return null; } //extract packet Frame frame = queue.remove(0); //buffer empty now? - change ready flag. if (queue.size() == 0) { this.ready = false;...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private byte[] processRequest(StunRequest request, InetSocketAddress localPeer, InetSocketAddress remotePeer) throws IOException { // Produce Binding Response TransportAddress transportAddress = new TransportAddress(remotePeer.getAddress(), remote...
#vulnerable code private byte[] processRequest(StunRequest request, InetSocketAddress localPeer, InetSocketAddress remotePeer) throws IOException { // Produce Binding Response TransportAddress transportAddress = new TransportAddress(remotePeer.getAddress(), ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCodec() throws Exception { boolean testPassed = false; try { OpusJni opus = new OpusJni(); opus.initNative(); final int packetSize = 480; File outputFile = File.createTempFile("opustest", ".tmp"); ...
#vulnerable code @Test public void testCodec() throws Exception { boolean testPassed = false; try { final int packetSize = 480; File outputFile = File.createTempFile("opustest", ".tmp"); FileInputStream inputStream = new FileInputStream("sr...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public int count() { return this.count; }
#vulnerable code public int count() { return this.count; } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void train(String dataFile, int maxite, float c) throws IOException { fp = File.createTempFile("train-features", null, new File("./tmp/")); buildInstanceList(dataFile); LabelAlphabet postagAlphabet = factory.buildLabelAlphabet("postag"); SFGenerator generator...
#vulnerable code public void train(String dataFile, int maxite, float c) throws IOException { fp = File.createTempFile("train-features", null, new File("./tmp/")); buildInstanceList(dataFile); LabelAlphabet postagAlphabet = factory.buildLabelAlphabet("postag"); IFeatureAlphabet...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) { try { String ls_1; Process process =null; // File handle = new File("../tmp/ctb_v1/data"); File handle = new File("../tmp/ctb_v6/data/bracketed"); BufferedWriter bout = new BufferedWriter(new OutputStreamWriter( ...
#vulnerable code public static void main(String[] args) { try { String ls_1; Process process =null; File handle = new File("./tmpdata/ctb/data3"); BufferedWriter bout = new BufferedWriter(new OutputStreamWriter( new FileOutputStream("./tmpdata/malt.train"), "UTF-8"));...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private InstanceSet buildInstanceList(String file) throws IOException { System.out.print("生成训练数据 ..."); FNLPReader reader = new FNLPReader(file); FNLPReader preReader = new FNLPReader(file); InstanceSet instset = new InstanceSet(); LabelAlphabet la = factory.Defau...
#vulnerable code private InstanceSet buildInstanceList(String file) throws IOException { System.out.print("生成训练数据 ..."); FNLPReader reader = new FNLPReader(file); InstanceSet instset = new InstanceSet(); LabelAlphabet la = factory.DefaultLabelAlphabet(); int count = 0; whi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void train(String dataFile, int maxite, float c) throws IOException { InstanceSet instset = buildInstanceList(dataFile); SFGenerator generator = new SFGenerator(); LabelAlphabet la = factory.DefaultLabelAlphabet(); int ysize = la.size(); System.out.print...
#vulnerable code public void train(String dataFile, int maxite, float c) throws IOException { InstanceSet instset = buildInstanceList(dataFile); IFeatureAlphabet features = factory.DefaultFeatureAlphabet(); SFGenerator generator = new SFGenerator(); int fsize = features.size()...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void finishSpan_userSuppliedTimestamp() { Span finished = new Span().setName("foo").setTimestamp(1000L); // Set by user state.setCurrentLocalSpan(finished); PowerMockito.when(System.currentTimeMillis()).thenReturn(2L); localT...
#vulnerable code @Test public void finishSpan_userSuppliedTimestamp() { Span finished = new Span().setTimestamp(1000L); // Set by user state.setCurrentLocalSpan(finished); PowerMockito.when(System.currentTimeMillis()).thenReturn(2L); localTracer.fin...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void finishSpan_userSuppliedTimestampAndDuration() { Span finished = new Span().setName("foo").setTimestamp(1000L); // Set by user state.setCurrentLocalSpan(finished); localTracer.finishSpan(500L); verify(mockReporter).report...
#vulnerable code @Test public void finishSpan_userSuppliedTimestampAndDuration() { Span finished = new Span().setTimestamp(1000L); // Set by user state.setCurrentLocalSpan(finished); localTracer.finishSpan(500L); verify(mockCollector).collect(finish...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void finishSpan_lessThanMicrosRoundUp() { Span finished = new Span().setName("foo").setTimestamp(1000L); // set in start span finished.startTick = 500L; // set in start span state.setCurrentLocalSpan(finished); PowerMockito.wh...
#vulnerable code @Test public void finishSpan_lessThanMicrosRoundUp() { Span finished = new Span().setTimestamp(1000L); // set in start span finished.startTick = 500L; // set in start span state.setCurrentLocalSpan(finished); PowerMockito.when(System...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void finishSpan_userSuppliedDuration() { Span finished = new Span().setName("foo").setTimestamp(1000L); // set in start span finished.startTick = 500L; // set in start span state.setCurrentLocalSpan(finished); localTracer.fini...
#vulnerable code @Test public void finishSpan_userSuppliedDuration() { Span finished = new Span().setTimestamp(1000L); // set in start span finished.startTick = 500L; // set in start span state.setCurrentLocalSpan(finished); localTracer.finishSpan(50...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void run() { serverSpanThreadBinder().setCurrentSpan(currentServerSpan()); wrappedRunnable().run(); }
#vulnerable code @Override public void run() { serverSpanThreadBinder().setCurrentSpan(currentServerSpan()); final long start = System.currentTimeMillis(); try { wrappedRunnable().run(); } finally { final long duration = System...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Map<WorkflowInstance, RunState> activeStates() { return states.entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, (entry) -> entry.getValue().runState)); }
#vulnerable code @Override public Map<WorkflowInstance, RunState> activeStates() { final ImmutableMap.Builder<WorkflowInstance, RunState> builder = ImmutableMap.builder(); states.entrySet().forEach(entry -> builder.put(entry.getKey(), entry.getValue().runState)); return buil...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code DatastoreStorage(Datastore datastore, Duration retryBaseDelay) { this.datastore = Objects.requireNonNull(datastore); this.retryBaseDelay = Objects.requireNonNull(retryBaseDelay); this.componentKeyFactory = datastore.newKeyFactory().kind(KIND_COMPONENT); this.gl...
#vulnerable code List<Backfill> getBackfills() { final EntityQuery query = Query.entityQueryBuilder().kind(KIND_BACKFILL).build(); final QueryResults<Entity> results = datastore.run(query); final ImmutableList.Builder<Backfill> resources = ImmutableList.builder(); while (r...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void doRequest(ServletTransaction transaction) throws ServletException { try { HttpServletRequest request = transaction.getServletRequest(); Client client = ClientCatalog .getClient(request.getParameter("use")); String report = request.get...
#vulnerable code @Override protected void doRequest(ServletTransaction transaction) throws ServletException { try { HttpServletRequest request = transaction.getServletRequest(); Client client = ClientCatalog .getClient(request.getParameter("use")); String report = reque...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void deleteUrl(String sUrl) throws SearchLibException { try { targetClient.deleteDocument(sUrl); urlDbClient.deleteDocument(sUrl); } catch (CorruptIndexException e) { throw new SearchLibException(e); } catch (LockObtainFailedException e) { throw new Sear...
#vulnerable code public void deleteUrl(String sUrl) throws SearchLibException { try { client.deleteDocument(sUrl); } catch (CorruptIndexException e) { throw new SearchLibException(e); } catch (LockObtainFailedException e) { throw new SearchLibException(e); } catch (IOExcep...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void onUpload() throws InterruptedException, XPathExpressionException, NoSuchAlgorithmException, ParserConfigurationException, SAXException, IOException, URISyntaxException, SearchLibException, InstantiationException, IllegalAccessException, ClassNotFoundExcep...
#vulnerable code public void onUpload() throws InterruptedException, XPathExpressionException, NoSuchAlgorithmException, ParserConfigurationException, SAXException, IOException, URISyntaxException, SearchLibException, InstantiationException, IllegalAccessException, ClassNotFoun...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void reloadPage() { synchronized (this) { fieldLeft = null; selectedFacet = null; super.reloadPage(); } }
#vulnerable code @Override protected void reloadPage() { fieldLeft = null; selectedFacet = null; super.reloadPage(); } #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 reload(boolean optimize) throws IOException, URISyntaxException, SearchLibException, InstantiationException, IllegalAccessException, ClassNotFoundException { if (optimize) { urlDbClient.reload(null); urlDbClient.getIndex().optimize(null); targetClien...
#vulnerable code public void reload(boolean optimize) throws IOException, URISyntaxException, SearchLibException, InstantiationException, IllegalAccessException, ClassNotFoundException { if (optimize) { client.reload(null); client.getIndex().optimize(null); } client.reloa...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void writeXmlConfig(XmlWriter xmlWriter) throws SAXException, SearchLibException, SecurityException, IOException { xmlWriter.startElement("system"); xmlWriter.startElement("availableProcessors", "value", Integer .toString(getAvailableProcessors())); xmlWrite...
#vulnerable code public void writeXmlConfig(XmlWriter xmlWriter) throws SAXException, SearchLibException { xmlWriter.startElement("system"); xmlWriter.startElement("availableProcessors", "value", Integer .toString(getAvailableProcessors())); xmlWriter.endElement(); xmlWrit...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void reloadPage() { synchronized (this) { selectedSort = null; sortFieldLeft = null; super.reloadPage(); } }
#vulnerable code @Override protected void reloadPage() { selectedSort = null; sortFieldLeft = null; super.reloadPage(); } #location 3 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public long getUrls(SearchRequest searchRequest, Field orderBy, boolean orderAsc, long start, long rows, List<UrlItem> list) throws SearchLibException { searchRequest.setStart((int) start); searchRequest.setRows((int) rows); try { if (orderBy != null) searchRe...
#vulnerable code public long getUrls(SearchRequest searchRequest, Field orderBy, boolean orderAsc, long start, long rows, List<UrlItem> list) throws SearchLibException { searchRequest.setStart((int) start); searchRequest.setRows((int) rows); try { if (orderBy != null) se...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void getOldUrlToFetch(NamedItem host, Date fetchIntervalDate, long limit, List<UrlItem> urlList) throws SearchLibException, ParseException, IOException, SyntaxError, URISyntaxException, ClassNotFoundException, InterruptedException, InstantiationException, Ille...
#vulnerable code public void getOldUrlToFetch(NamedItem host, Date fetchIntervalDate, long limit, List<UrlItem> urlList) throws SearchLibException, ParseException, IOException, SyntaxError, URISyntaxException, ClassNotFoundException, InterruptedException, InstantiationException...