output
stringlengths
64
73.2k
input
stringlengths
208
73.3k
instruction
stringclasses
1 value
#fixed code public void testHttpPostsWithExpectationVerification() throws Exception { Job[] jobs = new Job[3]; jobs[0] = new Job("AAAAA", 10); jobs[1] = new Job("AAAAA", 10); jobs[2] = new Job("BBBBB", 20); Queue<Job> queue = new ConcurrentLinkedQu...
#vulnerable code public void testHttpPostsWithExpectationVerification() throws Exception { TestJob[] jobs = new TestJob[3]; jobs[0] = new TestJob("AAAAA", 10); jobs[1] = new TestJob("AAAAA", 10); jobs[2] = new TestJob("BBBBB", 20); Queue<TestJob> ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void run() { HttpResponse response = null; BenchmarkConnection conn = new BenchmarkConnection(this.stats); String scheme = targetHost.getSchemeName(); String hostname = targetHost.getHostName(); int port = targetHost.getPort();...
#vulnerable code public void run() { HttpResponse response = null; BenchmarkConnection conn = new BenchmarkConnection(this.stats); String scheme = targetHost.getSchemeName(); String hostname = targetHost.getHostName(); int port = targetHost.getP...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testInputThrottling() throws Exception { HttpRequestExecutionHandler requestExecutionHandler = new HttpRequestExecutionHandler() { public void initalizeContext(final HttpContext context, final Object attachment) { context.setAt...
#vulnerable code public void testInputThrottling() throws Exception { HttpRequestExecutionHandler requestExecutionHandler = new HttpRequestExecutionHandler() { public void initalizeContext(final HttpContext context, final Object attachment) { context...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEntityWithMultipleContentLength() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.getParams().setBoo...
#vulnerable code @Test public void testEntityWithMultipleContentLength() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.getParams()....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testTooLongChunkHeader() throws IOException { final String input = "5; and some very looooong commend\r\n12345\r\n0\r\n"; final InputStream in1 = new ChunkedInputStream( new SessionInputBufferMock(input, MessageConstraints...
#vulnerable code @Test public void testTooLongChunkHeader() throws IOException { final String input = "5; and some very looooong commend\r\n12345\r\n0\r\n"; final InputStream in1 = new ChunkedInputStream( new SessionInputBufferMock(input, MessageConst...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testWriteBeyondFileSize() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMock( new String[] {"a"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf = new Se...
#vulnerable code @Test public void testWriteBeyondFileSize() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"a"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testWriteBeyondFileSize() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"a"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf = new S...
#vulnerable code public void testWriteBeyondFileSize() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"a"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf =...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void validate(final Set keys) { long currentTime = System.currentTimeMillis(); if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval) { this.lastTimeoutCheck = currentTime; if (keys != null) { ...
#vulnerable code protected void validate(final Set keys) { long currentTime = System.currentTimeMillis(); if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval) { this.lastTimeoutCheck = currentTime; if (keys != null) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public HttpClientConnection create(final HttpHost host) throws IOException { final String scheme = host.getSchemeName(); Socket socket = null; if ("http".equalsIgnoreCase(scheme)) { socket = this.plainfactory != null ? this.plainfactory.cre...
#vulnerable code public HttpClientConnection create(final HttpHost host) throws IOException { final String scheme = host.getSchemeName(); Socket socket = null; if ("http".equalsIgnoreCase(scheme)) { socket = this.plainfactory != null ? this.plainfacto...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEntityWithMultipleContentLengthSomeWrong() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.getParams...
#vulnerable code @Test public void testEntityWithMultipleContentLengthSomeWrong() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.get...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void doShutdown() throws InterruptedIOException { synchronized (this.statusLock) { if (this.status.compareTo(IOReactorStatus.SHUTTING_DOWN) >= 0) { return; } this.status = IOReactorStatus.SHUTTING_DOWN; ...
#vulnerable code protected void doShutdown() throws InterruptedIOException { if (this.status.compareTo(IOReactorStatus.SHUTTING_DOWN) >= 0) { return; } this.status = IOReactorStatus.SHUTTING_DOWN; try { cancelRequests(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testHttpPostsWithExpectationVerification() throws Exception { Job[] jobs = new Job[3]; jobs[0] = new Job("AAAAA", 10); jobs[1] = new Job("AAAAA", 10); jobs[2] = new Job("BBBBB", 20); Queue<Job> queue = new ConcurrentLinkedQu...
#vulnerable code public void testHttpPostsWithExpectationVerification() throws Exception { TestJob[] jobs = new TestJob[3]; jobs[0] = new TestJob("AAAAA", 10); jobs[1] = new TestJob("AAAAA", 10); jobs[2] = new TestJob("BBBBB", 20); Queue<TestJob> ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEntityWithMultipleContentLengthAllWrong() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.getParams(...
#vulnerable code @Test public void testEntityWithMultipleContentLengthAllWrong() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.getP...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEntityWithMultipleContentLength() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.getParams().setBoo...
#vulnerable code @Test public void testEntityWithMultipleContentLength() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.getParams()....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testResponseContentOverwriteHeaders() throws Exception { ResponseContent interceptor = new ResponseContent(true); HttpContext context = new BasicHttpContext(null); HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1...
#vulnerable code @Test public void testResponseContentOverwriteHeaders() throws Exception { ResponseContent interceptor = new ResponseContent(true); HttpContext context = new BasicHttpContext(null); HttpResponse response = new BasicHttpResponse(HttpVersion.HT...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testLoadReleaseConfigDefaultConfigsAndOverrideApp() { long appId = 6666; long versionId = 100; long releaseId = 11111; VersionDTO someVersion = assembleVersion(appId, "1.0", releaseId); ReleaseSnapshotDTO[] someReleaseSnapShots = new Rele...
#vulnerable code @Test public void testLoadReleaseConfigDefaultConfigsAndOverrideApp() { long appId = 6666; long versionId = 100; long releaseId = 11111; VersionDTO someVersion = assembleVersion(appId, "1.0", releaseId); ReleaseSnapshotDTO[] someReleaseSnapShots = ne...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private boolean isServiceUndeployed(int environmentId, int serviceId){ Date latestDeploymentDate = getLatestDeploymentDateByServiceIdInEnvironment(environmentId, serviceId); Date latestUpdatedDate = getLatestDeployableVersionDateByServiceId(serviceId); ...
#vulnerable code private boolean isServiceUndeployed(int environmentId, int serviceId){ Date latestDeploymentDate = getLatestDeploymentDateByServiceIdInEnvironment(environmentId, serviceId); Date latestUpdatedDate = getLatestDeployableVersionDateByServiceId(serviceId); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testLoadReleaseConfigDefaultConfigsAndOverrideCluster() { long appId = 6666; long versionId = 100; long releaseId = 11111; VersionDTO someVersion = assembleVersion(appId, "1.0", releaseId); ReleaseSnapshotDTO[] someReleaseSnapShots = new ...
#vulnerable code @Test public void testLoadReleaseConfigDefaultConfigsAndOverrideCluster() { long appId = 6666; long versionId = 100; long releaseId = 11111; VersionDTO someVersion = assembleVersion(appId, "1.0", releaseId); ReleaseSnapshotDTO[] someReleaseSnapShots ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testBlockByAvailabilityOnAllServices() throws Exception { ApolloTestClient apolloTestClient = Common.signupAndLogin(); ApolloTestAdminClient apolloTestAdminClient = Common.getAndLoginApolloTestAdminClient(); String availability =...
#vulnerable code @Test public void testBlockByAvailabilityOnAllServices() throws Exception { ApolloTestClient apolloTestClient = Common.signupAndLogin(); ApolloTestAdminClient apolloTestAdminClient = Common.getAndLoginApolloTestAdminClient(); String availabi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void onWhenRequested() throws Exception { setup("server.port=0", "spring.cloud.config.discovery.enabled=true", "logging.level.org.springframework.cloud.config.client=DEBUG", "spring.cloud.consul.discovery.test.enabled:true", "spring.application.name=d...
#vulnerable code @Test public void onWhenRequested() throws Exception { setup("server.port=7000", "spring.cloud.config.discovery.enabled=true", "spring.cloud.consul.discovery.port:7001", "spring.cloud.consul.discovery.hostname:foo", "spring.cloud.config.discovery.service-id:...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void propertySourcesFound() throws Exception { String foo = this.environment.getProperty("foo"); assertThat(foo).as("foo was wrong").isEqualTo("bar-app-dev"); String myBaz = this.environment.getProperty("my.baz"); assertThat(myBaz).as("my.baz was wrong").i...
#vulnerable code @Test public void propertySourcesFound() throws Exception { String foo = this.environment.getProperty("foo"); assertThat(foo).as("foo was wrong").isEqualTo("bar-app-dev"); String myBaz = this.environment.getProperty("my.baz"); assertThat(myBaz).as("my.baz was wro...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public <T> T get(Class<? extends T> clazz, long id) throws EntityNotFoundException { // The cast gets rid of "no unique maximal instance exists" compiler error return (T)this.get(new OKey<T>(clazz, id)); }
#vulnerable code @Override public <T> T get(Class<? extends T> clazz, long id) throws EntityNotFoundException { // The cast gets rid of "no unique maximal instance exists" compiler error return (T)this.get(this.factory.createKey(clazz, id)); } #location ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public <T> T get(Class<? extends T> clazz, String name) throws EntityNotFoundException { // The cast gets rid of "no unique maximal instance exists" compiler error return (T)this.get(new OKey<T>(clazz, name)); }
#vulnerable code @Override public <T> T get(Class<? extends T> clazz, String name) throws EntityNotFoundException { // The cast gets rid of "no unique maximal instance exists" compiler error return (T)this.get(this.factory.createKey(clazz, name)); } #loc...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void tooDeeplyNestedObjects() throws IOException { Object root = Boolean.TRUE; for (int i = 0; i < MAX_DEPTH + 1; i++) { root = singletonMap("a", root); } JsonReader reader = new JsonValueReader(root); for (int i = 0; i < MAX_DEPTH; i++) {...
#vulnerable code @Test public void tooDeeplyNestedObjects() throws IOException { Object root = Boolean.TRUE; for (int i = 0; i < 32; i++) { root = singletonMap("a", root); } JsonReader reader = new JsonValueReader(root); for (int i = 0; i < 31; i++) { reade...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerNullValue() throws Exception { JsonReader reader = factory.newReader("{\"null\":1}"); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqualTo("$.null"); assertThat(reader.peek()).isEqualTo(JsonReader....
#vulnerable code @Test public void readerNullValue() throws Exception { JsonReader reader = newReader("{\"null\":1}"); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqualTo("$.null"); assertThat(reader.peek()).isEqualTo(JsonReader.To...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readingDoesNotBuffer() throws IOException { Buffer buffer = new Buffer().writeUtf8("{}{}"); JsonReader reader1 = JsonReader.of(buffer); reader1.beginObject(); reader1.endObject(); assertThat(buffer.size()).isEqualTo(2); JsonReader rea...
#vulnerable code @Test public void readingDoesNotBuffer() throws IOException { Buffer buffer = new Buffer().writeUtf8("{}{}"); JsonReader reader1 = new JsonReader(buffer); reader1.beginObject(); reader1.endObject(); assertThat(buffer.size()).isEqualTo(2); JsonRea...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readObjectSource() throws IOException { Buffer buffer = new Buffer().writeUtf8("{\"a\": \"android\", \"b\": \"banana\"}"); JsonReader reader = JsonReader.of(buffer); reader.beginObject(); assertThat(reader.nextName()).isEqualTo("a"); assert...
#vulnerable code @Test public void readObjectSource() throws IOException { Buffer buffer = new Buffer().writeUtf8("{\"a\": \"android\", \"b\": \"banana\"}"); JsonReader reader = new JsonReader(buffer); reader.beginObject(); assertThat(reader.nextName()).isEqualTo("a"); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerUnusedPromotionDoesntPersist() throws Exception { JsonReader reader = newReader("[{},{\"a\":5}]"); reader.beginArray(); reader.beginObject(); reader.promoteNameToValue(); reader.endObject(); reader.beginObject(); try { r...
#vulnerable code @Test public void readerUnusedPromotionDoesntPersist() throws Exception { JsonReader reader = new JsonReader(new Buffer().writeUtf8("[{},{\"a\":5}]")); reader.beginArray(); reader.beginObject(); reader.promoteNameToValue(); reader.endObject(); read...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerLongValue() throws Exception { JsonReader reader = factory.newReader("{\"5\":1}"); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqualTo("$.5"); assertThat(reader.peek()).isEqualTo(JsonReader.Token....
#vulnerable code @Test public void readerLongValue() throws Exception { JsonReader reader = newReader("{\"5\":1}"); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqualTo("$.5"); assertThat(reader.peek()).isEqualTo(JsonReader.Token.ST...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readObjectBuffer() throws IOException { Buffer buffer = new Buffer().writeUtf8("{\"a\": \"android\", \"b\": \"banana\"}"); JsonReader reader = JsonReader.of(buffer); reader.beginObject(); assertThat(reader.nextName()).isEqualTo("a"); assert...
#vulnerable code @Test public void readObjectBuffer() throws IOException { Buffer buffer = new Buffer().writeUtf8("{\"a\": \"android\", \"b\": \"banana\"}"); JsonReader reader = new JsonReader(buffer); reader.beginObject(); assertThat(reader.nextName()).isEqualTo("a"); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerBooleanValue() throws Exception { JsonReader reader = factory.newReader("{\"true\":1}"); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqualTo("$.true"); assertThat(reader.peek()).isEqualTo(JsonRead...
#vulnerable code @Test public void readerBooleanValue() throws Exception { JsonReader reader = newReader("{\"true\":1}"); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqualTo("$.true"); assertThat(reader.peek()).isEqualTo(JsonReader...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerUnquotedDoubleValue() throws Exception { JsonReader reader = factory.newReader("{5:1}"); reader.setLenient(true); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.nextDouble()).isEqualTo(5d); assertThat(reader....
#vulnerable code @Test public void readerUnquotedDoubleValue() throws Exception { JsonReader reader = newReader("{5:1}"); reader.setLenient(true); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.nextDouble()).isEqualTo(5d); assertThat(reader.ne...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerMultipleValueObject() throws Exception { JsonReader reader = factory.newReader("{\"a\":1,\"b\":2}"); reader.beginObject(); assertThat(reader.nextName()).isEqualTo("a"); assertThat(reader.nextInt()).isEqualTo(1); reader.promoteNameToVa...
#vulnerable code @Test public void readerMultipleValueObject() throws Exception { JsonReader reader = newReader("{\"a\":1,\"b\":2}"); reader.beginObject(); assertThat(reader.nextName()).isEqualTo("a"); assertThat(reader.nextInt()).isEqualTo(1); reader.promoteNameToValu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerUnquotedIntegerValue() throws Exception { JsonReader reader = factory.newReader("{5:1}"); reader.setLenient(true); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.nextInt()).isEqualTo(5); assertThat(reader.nex...
#vulnerable code @Test public void readerUnquotedIntegerValue() throws Exception { JsonReader reader = newReader("{5:1}"); reader.setLenient(true); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.nextInt()).isEqualTo(5); assertThat(reader.nextI...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerStringValue() throws Exception { JsonReader reader = factory.newReader("{\"a\":1}"); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqualTo("$.a"); assertThat(reader.peek()).isEqualTo(JsonReader.Toke...
#vulnerable code @Test public void readerStringValue() throws Exception { JsonReader reader = newReader("{\"a\":1}"); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqualTo("$.a"); assertThat(reader.peek()).isEqualTo(JsonReader.Token....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static JsonWriter of(BufferedSink sink) { return new JsonUtf8Writer(sink); }
#vulnerable code public static JsonWriter of(BufferedSink sink) { return new JsonUt8Writer(sink); } #location 2 #vulnerability type RESOURCE_LEAK
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerEmptyValueObject() throws Exception { JsonReader reader = factory.newReader("{}"); reader.beginObject(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.END_OBJECT); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqu...
#vulnerable code @Test public void readerEmptyValueObject() throws Exception { JsonReader reader = newReader("{}"); reader.beginObject(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.END_OBJECT); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqual...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerUnquotedLongValue() throws Exception { JsonReader reader = factory.newReader("{5:1}"); reader.setLenient(true); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.nextLong()).isEqualTo(5L); assertThat(reader.next...
#vulnerable code @Test public void readerUnquotedLongValue() throws Exception { JsonReader reader = newReader("{5:1}"); reader.setLenient(true); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.nextLong()).isEqualTo(5L); assertThat(reader.nextIn...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerDoubleValue() throws Exception { JsonReader reader = factory.newReader("{\"5.5\":1}"); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqualTo("$.5.5"); assertThat(reader.peek()).isEqualTo(JsonReader....
#vulnerable code @Test public void readerDoubleValue() throws Exception { JsonReader reader = newReader("{\"5.5\":1}"); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqualTo("$.5.5"); assertThat(reader.peek()).isEqualTo(JsonReader.To...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override void promoteNameToValue() throws IOException { if (hasNext()) { String name = nextName(); push(name); } }
#vulnerable code @Override void promoteNameToValue() throws IOException { Map.Entry<?, ?> peeked = require(Map.Entry.class, Token.NAME); push(peeked.getKey()); stack[stackSize - 2] = peeked.getValue(); } #location 4 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerUnusedPromotionDoesntPersist() throws Exception { JsonReader reader = factory.newReader("[{},{\"a\":5}]"); reader.beginArray(); reader.beginObject(); reader.promoteNameToValue(); reader.endObject(); reader.beginObject(); try {...
#vulnerable code @Test public void readerUnusedPromotionDoesntPersist() throws Exception { JsonReader reader = newReader("[{},{\"a\":5}]"); reader.beginArray(); reader.beginObject(); reader.promoteNameToValue(); reader.endObject(); reader.beginObject(); try { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerIntegerValue() throws Exception { JsonReader reader = factory.newReader("{\"5\":1}"); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqualTo("$.5"); assertThat(reader.peek()).isEqualTo(JsonReader.Tok...
#vulnerable code @Test public void readerIntegerValue() throws Exception { JsonReader reader = newReader("{\"5\":1}"); reader.beginObject(); reader.promoteNameToValue(); assertThat(reader.getPath()).isEqualTo("$.5"); assertThat(reader.peek()).isEqualTo(JsonReader.Token...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static JsonReader of(BufferedSource source) { return new JsonUtf8Reader(source); }
#vulnerable code public static JsonReader of(BufferedSource source) { return new BufferedSourceJsonReader(source); } #location 2 #vulnerability type RESOURCE_LEAK
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void readerUnusedPromotionDoesntPersist() throws Exception { JsonReader reader = newReader("[{},{\"a\":5}]"); reader.beginArray(); reader.beginObject(); reader.promoteNameToValue(); reader.endObject(); reader.beginObject(); try { r...
#vulnerable code @Test public void readerUnusedPromotionDoesntPersist() throws Exception { JsonReader reader = new JsonReader(new Buffer().writeUtf8("[{},{\"a\":5}]")); reader.beginArray(); reader.beginObject(); reader.promoteNameToValue(); reader.endObject(); read...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean addOrReplace(byte[] key, V old, V value) { KeyBuffer keyBuffer = keySource(key); byte[] data = value(value); byte[] oldData = value(old); CheckSegment segment = segment(keyBuffer.hash()); return segment.put(keyBuffer...
#vulnerable code public boolean addOrReplace(byte[] key, V old, V value) { KeyBuffer keyBuffer = keySource(key); byte[] data = value(value); byte[] oldData = value(old); if (maxEntrySize > 0L && CheckSegment.sizeOf(keyBuffer, data) > maxEntrySize) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code long getWriteOffset() { return writeOffset; }
#vulnerable code FileChannel getWriteChannel() { return writeChannel; } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testDeleteAndMerge() throws Exception { String directory = "/tmp/HaloDBDeletionTest/testDeleteAndMerge"; HaloDBOptions options = new HaloDBOptions(); options.maxFileSize = 10 * 1024; options.mergeThresholdPerFile = 0.10; ...
#vulnerable code @Test public void testDeleteAndMerge() throws Exception { String directory = "/tmp/HaloDBDeletionTest/testDeleteAndMerge"; HaloDBOptions options = new HaloDBOptions(); options.mergeJobIntervalInSeconds = 1; options.maxFileSize = 10 * ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testMerge() throws Exception { File directory = new File("/tmp/HaloDBTestWithMerge/testMerge"); TestUtils.deleteDirectory(directory); HaloDBOptions options = new HaloDBOptions(); options.maxFileSize = recordsPerFile * rec...
#vulnerable code @Test public void testMerge() throws Exception { File directory = new File("/tmp/HaloDBTestWithMerge/testMerge"); TestUtils.deleteDirectory(directory); HaloDBOptions options = new HaloDBOptions(); options.maxFileSize = recordsPerFile...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean put(byte[] key, V value) { KeyBuffer keyBuffer = keySource(key); byte[] data = value(value); CheckSegment segment = segment(keyBuffer.hash()); return segment.put(keyBuffer, data, false, null); }
#vulnerable code public boolean put(byte[] key, V value) { KeyBuffer keyBuffer = keySource(key); byte[] data = value(value); if (maxEntrySize > 0L && CheckSegment.sizeOf(keyBuffer, data) > maxEntrySize) { remove(key); putFailC...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testDeleteInsertCloseAndOpen() throws IOException { String directory = "/tmp/HaloDBTest/testDeleteInsertCloseAndOpen"; HaloDBOptions options = new HaloDBOptions(); options.isMergeDisabled = true; options.maxFileSize = 10*...
#vulnerable code @Test public void testDeleteInsertCloseAndOpen() throws IOException { String directory = "/tmp/HaloDBTest/testDeleteInsertCloseAndOpen"; HaloDBOptions options = new HaloDBOptions(); options.isMergeDisabled = true; options.maxFileSize...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void close() throws IOException { writeLock.lock(); try { isClosing = true; try { if(!compactionManager.stopCompactionThread()) setIOErrorFlag(); } catch (IOException e) { ...
#vulnerable code void close() throws IOException { isClosing = true; try { if(!compactionManager.stopCompactionThread()) setIOErrorFlag(); } catch (IOException e) { logger.error("Error while stopping compaction thread. Set...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean putIfAbsent(byte[] key, V v) { KeyBuffer keyBuffer = keySource(key); byte[] data = value(v); CheckSegment segment = segment(keyBuffer.hash()); return segment.put(keyBuffer, data, true, null); }
#vulnerable code public boolean putIfAbsent(byte[] key, V v) { KeyBuffer keyBuffer = keySource(key); byte[] data = value(v); if (maxEntrySize > 0L && CheckSegment.sizeOf(keyBuffer, data) > maxEntrySize) { remove(key); putFailC...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void close() throws IOException { writeLock.lock(); try { if (isClosing) { // instance already closed. return; } isClosing = true; try { if(!compactionManager.stop...
#vulnerable code void delete(byte[] key) throws IOException { writeLock.lock(); try { InMemoryIndexMetaData metaData = inMemoryIndex.get(key); if (metaData != null) { //TODO: implement a getAndRemove method in InMemoryIndex. ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code DBMetaData(String dbDirectory) { this.dbDirectory = dbDirectory; }
#vulnerable code long getSequenceNumber() { return sequenceNumber; } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code CompactionManager(HaloDBInternal dbInternal) { this.dbInternal = dbInternal; this.compactionRateLimiter = RateLimiter.create(dbInternal.options.getCompactionJobRate()); this.compactionQueue = new LinkedBlockingQueue<>(); }
#vulnerable code boolean stopCompactionThread() throws IOException { isRunning = false; if (compactionThread != null) { try { // We don't want to call interrupt on compaction thread as it // may interrupt IO operations and leav...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void close() throws IOException { writeLock.lock(); try { if (isClosing) { // instance already closed. return; } isClosing = true; try { if(!compactionManager.stop...
#vulnerable code void mergeTombstoneFiles() throws IOException { if (!options.isCleanUpTombstonesDuringOpen()) { logger.info("CleanUpTombstonesDuringOpen is not enabled, returning"); return; } File[] tombStoneFiles = dbDirectory.listTombs...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReOpenDBAfterMerge() throws IOException, InterruptedException { String directory = "/tmp/HaloDBTestWithMerge/testReOpenDBAfterMerge"; HaloDBOptions options = new HaloDBOptions(); options.maxFileSize = recordsPerFile * recordS...
#vulnerable code @Test public void testReOpenDBAfterMerge() throws IOException, InterruptedException { String directory = "/tmp/HaloDBTestWithMerge/testReOpenDBAfterMerge"; HaloDBOptions options = new HaloDBOptions(); options.maxFileSize = recordsPerFile * r...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testRepairDB() throws IOException { String directory = Paths.get("tmp", "DBRepairTest", "testRepairDB").toString(); HaloDBOptions options = new HaloDBOptions(); options.maxFileSize = 1024 * 1024; HaloDB db = getTestDB(di...
#vulnerable code @Test public void testRepairDB() throws IOException { String directory = Paths.get("tmp", "DBRepairTest", "testRepairDB").toString(); HaloDBOptions options = new HaloDBOptions(); options.maxFileSize = 1024 * 1024; HaloDB db = getTes...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code long getWriteOffset() { return writeOffset; }
#vulnerable code RecordMetaDataForCache writeRecord(Record record) throws IOException { long start = System.nanoTime(); writeToChannel(record.serialize(), writeChannel); int recordSize = record.getRecordSize(); long recordOffset = writeOffset; writeOffset += recordSize; Inde...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code Parser(Parser p, String text) { this.logger = p.logger; this.properties = p.properties; this.infoMap = p.infoMap; this.tokens = new TokenIndexer(infoMap, new Tokenizer(text).tokenize()); this.lineSeparator = p.lineSeparator; }
#vulnerable code String translate(String text) { int namespace = text.lastIndexOf("::"); if (namespace >= 0) { Info info2 = infoMap.getFirst(text.substring(0, namespace)); text = text.substring(namespace + 2); if (info2.pointerTypes !=...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public BytePointer putString(String s) { byte[] bytes = s.getBytes(); return put(bytes).put(bytes.length, (byte)0); }
#vulnerable code public BytePointer putString(String s) { byte[] bytes = s.getBytes(); //capacity(bytes.length+1); asBuffer().put(bytes).put((byte)0); return this; } #location 4 #vulnerability ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean generate(Class<?> ... classes) throws FileNotFoundException { // first pass using a null writer to fill up the LinkedListRegister objects out = new PrintWriter(new Writer() { @Override public void close() { } @Override pu...
#vulnerable code public boolean generate(Class<?> ... classes) throws FileNotFoundException { // first pass using a null writer to fill up the LinkedListRegister objects out = new PrintWriter(new Writer() { @Override public void close() { } @Overr...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) throws Exception { Main main = new Main(); for (int i = 0; i < args.length; i++) { if ("-help".equals(args[i]) || "--help".equals(args[i])) { printHelp(); System.exit(0); ...
#vulnerable code public static void main(String[] args) throws Exception { Main main = new Main(); for (int i = 0; i < args.length; i++) { if ("-help".equals(args[i]) || "--help".equals(args[i])) { printHelp(); System.exit(0); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code Parser(Parser p, String text) { this.logger = p.logger; this.properties = p.properties; this.infoMap = p.infoMap; this.tokens = new TokenIndexer(infoMap, new Tokenizer(text).tokenize()); this.lineSeparator = p.lineSeparator; }
#vulnerable code void parse(File outputFile, Context context, String[] includePath, String ... includes) throws IOException, ParserException { ArrayList<Token> tokenList = new ArrayList<Token>(); for (String include : includes) { File file = null; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean generate(Class<?> ... classes) throws FileNotFoundException { // first pass using a null writer to fill up the LinkedListRegister objects out = new PrintWriter(new Writer() { @Override public void close() { } @Override pu...
#vulnerable code public boolean generate(Class<?> ... classes) throws FileNotFoundException { // first pass using a null writer to fill up the LinkedListRegister objects out = new PrintWriter(new Writer() { @Override public void close() { } @Overr...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code Parser(Parser p, String text) { this.logger = p.logger; this.properties = p.properties; this.infoMap = p.infoMap; this.tokens = new TokenIndexer(infoMap, new Tokenizer(text).tokenize()); this.lineSeparator = p.lineSeparator; }
#vulnerable code void parse(File outputFile, Context context, String[] includePath, String ... includes) throws IOException, ParserException { ArrayList<Token> tokenList = new ArrayList<Token>(); for (String include : includes) { File file = null; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static String load(Class cls, Properties properties, boolean pathsFirst) { if (!isLoadLibraries() || cls == null) { return null; } // Find the top enclosing class, to match the library filename cls = getEnclosingClass(cls); ...
#vulnerable code public static String load(Class cls, Properties properties, boolean pathsFirst) { if (!isLoadLibraries() || cls == null) { return null; } // Find the top enclosing class, to match the library filename cls = getEnclosingClass(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code void init(long allocatedAddress, int allocatedCapacity, long ownerAddress, long deallocatorAddress) { address = allocatedAddress; position = 0; limit = allocatedCapacity; capacity = allocatedCapacity; deallocator(new NativeDeallocator(t...
#vulnerable code void init(long allocatedAddress, int allocatedCapacity, long deallocatorAddress) { address = allocatedAddress; position = 0; limit = allocatedCapacity; capacity = allocatedCapacity; deallocator(new NativeDeallocator(this, dealloca...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean generate(String sourceFilename, String headerFilename, String loadSuffix, String baseLoadSuffix, String classPath, Class<?> ... classes) throws IOException { try { // first pass using a null writer to fill up the IndexedSet objec...
#vulnerable code public boolean generate(String sourceFilename, String headerFilename, String loadSuffix, String baseLoadSuffix, String classPath, Class<?> ... classes) throws IOException { try { // first pass using a null writer to fill up the IndexedSet...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code TokenIndexer(InfoMap infoMap, Token[] array, boolean isCFile) { this.infoMap = infoMap; this.array = array; this.isCFile = isCFile; }
#vulnerable code Token[] expand(Token[] array, int index) { if (index < array.length && infoMap.containsKey(array[index].value)) { // if we hit a token whose info.cppText starts with #define (a macro), expand it int startIndex = index; Info in...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static File cacheResource(URL resourceURL, String target) throws IOException { // Find appropriate subdirectory in cache for the resource ... File urlFile = new File(resourceURL.getPath()); String name = urlFile.getName(); long size, tim...
#vulnerable code public static File cacheResource(URL resourceURL, String target) throws IOException { // Find appropriate subdirectory in cache for the resource ... File urlFile = new File(resourceURL.getPath()); String name = urlFile.getName(); long siz...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public File parse(File outputDirectory, String[] classPath, Class cls) throws IOException, Exception { Loader.ClassProperties allProperties = Loader.loadProperties(cls, properties, true); Loader.ClassProperties clsProperties = Loader.loadProperties(cls, proper...
#vulnerable code public File parse(File outputDirectory, String[] classPath, Class cls) throws IOException, Exception { Loader.ClassProperties allProperties = Loader.loadProperties(cls, properties, true); Loader.ClassProperties clsProperties = Loader.loadProperties(cls, ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static int offsetof(Class<? extends Pointer> type, String member) { // Should we synchronize that? HashMap<String,Integer> offsets = memberOffsets.get(type); while (offsets == null && type.getSuperclass() != null) { type = type.getSu...
#vulnerable code public static int offsetof(Class<? extends Pointer> type, String member) { // Should we synchronize that? return memberOffsets.get(type).get(member); } #location 3 #vulnerability type NULL_DER...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static File extractResource(URL resourceURL, File directory, String prefix, String suffix) throws IOException { InputStream is = resourceURL != null ? resourceURL.openStream() : null; OutputStream os = null; if (is == null) { ...
#vulnerable code public static File extractResource(URL resourceURL, File directory, String prefix, String suffix) throws IOException { InputStream is = resourceURL != null ? resourceURL.openStream() : null; if (is == null) { return null; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public ByteBuffer asByteBuffer() { if (isNull()) { return null; } if (limit > 0 && limit < position) { throw new IllegalArgumentException("limit < position: (" + limit + " < " + position + ")"); } int size = size...
#vulnerable code public ByteBuffer asByteBuffer() { if (isNull()) { return null; } if (limit > 0 && limit < position) { throw new IllegalArgumentException("limit < position: (" + limit + " < " + position + ")"); } int value...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static File cacheResource(URL resourceURL, String target) throws IOException { // Find appropriate subdirectory in cache for the resource ... File urlFile; try { urlFile = new File(new URI(resourceURL.toString().split("#")[0])); ...
#vulnerable code public static File cacheResource(URL resourceURL, String target) throws IOException { // Find appropriate subdirectory in cache for the resource ... File urlFile; try { urlFile = new File(new URI(resourceURL.toString().split("#")[0]))...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static String load(Class cls) { if (!loadLibraries || cls == null) { return null; } // Find the top enclosing class, to match the library filename Properties p = (Properties)getProperties().clone(); String pathSepara...
#vulnerable code public static String load(Class cls) { if (!loadLibraries || cls == null) { return null; } // Find the top enclosing class, to match the library filename Properties p = (Properties)getProperties().clone(); cls = appen...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code boolean classes(boolean handleExceptions, boolean defineAdapters, boolean convertStrings, String loadSuffix, String baseLoadSuffix, String classPath, Class<?> ... classes) { String version = Generator.class.getPackage().getImplementationVersion(); ...
#vulnerable code boolean checkPlatform(Platform platform, String[] defaultNames) { if (platform == null) { return true; } if (defaultNames == null) { defaultNames = new String[0]; } String platform2 = properties.getProperty...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected <P extends Pointer> P deallocator(Deallocator deallocator) { if (this.deallocator != null) { if (logger.isDebugEnabled()) { logger.debug("Predeallocating " + this); } this.deallocator.deallocate(); ...
#vulnerable code protected <P extends Pointer> P deallocator(Deallocator deallocator) { if (this.deallocator != null) { if (logger.isDebugEnabled()) { logger.debug("Predeallocating " + this); } this.deallocator.deallocate(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void execute() throws MojoExecutionException { final Log log = getLog(); try { log.info("Executing JavaCPP Builder"); if (log.isDebugEnabled()) { log.debug("classPath: " + classPath); log...
#vulnerable code @Override public void execute() throws MojoExecutionException { final Log log = getLog(); try { log.info("Executing JavaCPP Builder"); if (log.isDebugEnabled()) { log.debug("classPath: " + classPath); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public boolean generate(String sourceFilename, String headerFilename, String classPath, Class<?> ... classes) throws IOException { // first pass using a null writer to fill up the IndexedSet objects out = new PrintWriter(new Writer() { ...
#vulnerable code public boolean generate(String sourceFilename, String headerFilename, String classPath, Class<?> ... classes) throws FileNotFoundException { // first pass using a null writer to fill up the IndexedSet objects out = new PrintWriter(new Writer(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code TokenIndexer(InfoMap infoMap, Token[] array, boolean isCFile) { this.infoMap = infoMap; this.array = array; this.isCFile = isCFile; }
#vulnerable code Token[] expand(Token[] array, int index) { if (index < array.length && infoMap.containsKey(array[index].value)) { // if we hit a token whose info.cppText starts with #define (a macro), expand it int startIndex = index; Info in...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public BytePointer putString(String s, String charsetName) throws UnsupportedEncodingException { byte[] bytes = s.getBytes(charsetName); //capacity(bytes.length+1); put(bytes).put(bytes.length, (byte)0); return this; }
#vulnerable code public BytePointer putString(String s, String charsetName) throws UnsupportedEncodingException { byte[] bytes = s.getBytes(charsetName); //capacity(bytes.length+1); asBuffer().put(bytes).put((byte)0); return this; } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<Task> assignTasks(TaskTracker taskTracker) throws IOException { HttpHost tracker = new HttpHost(taskTracker.getStatus().getHost(), taskTracker.getStatus().getHttpPort()); if (!mesosTrackers.containsKey(tracker)) { LOG.info("U...
#vulnerable code @Override public List<Task> assignTasks(TaskTracker taskTracker) throws IOException { HttpHost tracker = new HttpHost(taskTracker.getStatus().getHost(), taskTracker.getStatus().getHttpPort()); if (!mesosTrackers.containsKey(tracker)) { LOG.i...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public <T> T get(String claimName, Class<T> requiredType) { Object value = get(claimName); if (value == null) { return null; } if (Claims.EXPIRATION.equals(claimName) || Claims.ISSUED_AT.equals(claimName) || Claim...
#vulnerable code @Override public <T> T get(String claimName, Class<T> requiredType) { Object value = get(claimName); if (value == null) { return null; } if (Claims.EXPIRATION.equals(claimName) || Claims.ISSUED_AT.equals(claimName) || ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected byte[] doDecompress(byte[] compressed) throws IOException { return readAndClose(new GZIPInputStream(new ByteArrayInputStream(compressed))); }
#vulnerable code @Override protected byte[] doDecompress(byte[] compressed) throws IOException { byte[] buffer = new byte[512]; ByteArrayOutputStream outputStream = null; GZIPInputStream gzipInputStream = null; ByteArrayInputStream inputStream = null...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequestMapping(value = "/{id}", method = RequestMethod.PUT) public boolean updateRule(@PathVariable String id, @RequestBody RouteDTO routeDTO, @PathVariable String env) { Route route = routeService.findRoute(id); if (route == null) { throw new...
#vulnerable code @RequestMapping(value = "/{id}", method = RequestMethod.PUT) public boolean updateRule(@PathVariable String id, @RequestBody RouteDTO routeDTO, @PathVariable String env) { Route route = routeService.findRoute(id); if (route == null) { //T...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequestMapping(value = "/{id}", method = RequestMethod.GET) public RouteDTO detailRoute(@PathVariable String id, @PathVariable String env) { Route route = routeService.findRoute(id); if (route == null) { // TODO throw exception } ...
#vulnerable code @RequestMapping(value = "/{id}", method = RequestMethod.GET) public RouteDTO detailRoute(@PathVariable String id, @PathVariable String env) { Route route = routeService.findRoute(id); if (route == null) { // TODO throw exception }...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequestMapping(value = "/{id}", method = RequestMethod.GET) public RouteDTO detailRoute(@PathVariable String id, @PathVariable String env) { Route route = routeService.findRoute(id); if (route == null) { throw new ResourceNotFoundException("Un...
#vulnerable code @RequestMapping(value = "/{id}", method = RequestMethod.GET) public RouteDTO detailRoute(@PathVariable String id, @PathVariable String env) { Route route = routeService.findRoute(id); if (route == null) { // TODO throw exception }...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @RequestMapping(value = "/{id}", method = RequestMethod.GET) public OverrideDTO detailOverride(@PathVariable String id, @PathVariable String env) { Override override = overrideService.findById(id); if (override == null) { throw new ResourceNotF...
#vulnerable code @RequestMapping(value = "/{id}", method = RequestMethod.GET) public OverrideDTO detailOverride(@PathVariable String id, @PathVariable String env) { Override override = overrideService.findById(id); if (override == null) { //TODO throw exc...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void addToWindow(Datum newDatum) { if (window.size() == 0) { // We don't know what weight to use for the first datum, so we wait // until we have the second one to actually process it. window.add(new DatumWithIn...
#vulnerable code @Override public void addToWindow(Datum newDatum) { if (window.size() == 0) { // We don't know what weight to use for the first datum, so we wait // until we have the second one to actually process it. window.add(new Datum...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testDumpSmall() throws Exception { MacroBaseConf conf = new MacroBaseConf(); ArrayList<Integer> attrs = new ArrayList<>(); attrs.add(1); attrs.add(2); OutlierClassifier dummy = new OutlierClassifier() { ...
#vulnerable code @Test public void testDumpSmall() throws Exception { MacroBaseConf conf = new MacroBaseConf(); ArrayList<Integer> attrs = new ArrayList<>(); attrs.add(1); attrs.add(2); OutlierClassifier dummy = new OutlierClassifier() { ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<AnalysisResult> run() throws Exception { final int batchSize = conf.getInt(MacroBaseConf.TUPLE_BATCH_SIZE, MacroBaseDefaults.TUPLE_BATCH_SIZE); Stopwatch sw = Stopwatch.createStarted(); ...
#vulnerable code @Override public List<AnalysisResult> run() throws Exception { final int batchSize = conf.getInt(MacroBaseConf.TUPLE_BATCH_SIZE, MacroBaseDefaults.TUPLE_BATCH_SIZE); Stopwatch sw = Stopwatch.createStarted();...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @POST @Consumes(MediaType.APPLICATION_JSON) public FormattedRowSetResponse getRowsFormatted(RowSetRequest request) { FormattedRowSetResponse response = new FormattedRowSetResponse(); try { conf.set(MacroBaseConf.DB_URL, request.pgUrl); ...
#vulnerable code @POST @Consumes(MediaType.APPLICATION_JSON) public FormattedRowSetResponse getRowsFormatted(RowSetRequest request) { FormattedRowSetResponse response = new FormattedRowSetResponse(); try { conf.set(MacroBaseConf.DB_URL, request.pgUrl...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @POST @Consumes(MediaType.APPLICATION_JSON) public FormattedRowSetResponse getRowsFormatted(RowSetRequest request) { FormattedRowSetResponse response = new FormattedRowSetResponse(); try { conf.set(MacroBaseConf.DB_URL, request.pgUrl); ...
#vulnerable code @POST @Consumes(MediaType.APPLICATION_JSON) public FormattedRowSetResponse getRowsFormatted(RowSetRequest request) { FormattedRowSetResponse response = new FormattedRowSetResponse(); try { conf.set(MacroBaseConf.DB_URL, request.pgUrl...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public AnalysisResult run() throws Exception { long startMs = System.currentTimeMillis(); DataIngester ingester = conf.constructIngester(); List<Datum> data = ingester.getStream().drain(); long loadEndMs = System.currentTimeMillis...
#vulnerable code @Override public AnalysisResult run() throws Exception { long startMs = System.currentTimeMillis(); DataIngester ingester = conf.constructIngester(); List<Datum> data = ingester.getStream().drain(); long loadEndMs = System.currentTime...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void shouldHandleErrorResponse() throws Exception { //given final HttpResponse errorResponse = new HttpResponse(401, "{\n" + " \"error\": {\n" + " \"message\": \"Invalid OAuth access token.\",\n" + ...
#vulnerable code @Test public void shouldHandleErrorResponse() throws Exception { //given final HttpResponse errorResponse = new HttpResponse(401, "{\n" + " \"error\": {\n" + " \"message\": \"Invalid OAuth access token.\",\n" + ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) throws Exception { if (args.length < 1){ System.out.println("usage: <index location> <command> <command args>"); System.exit(1); } String idxLocation = args[0]; ClueApplication app = null; if ...
#vulnerable code public static void main(String[] args) throws Exception { if (args.length < 1){ System.out.println("usage: <index location> <command> <command args>"); System.exit(1); } String idxLocation = args[0]; ClueApplication app = null; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void run() throws IOException { while(true){ System.out.print("> "); String line = ctx.readCommand(); if (line == null || line.isEmpty()) continue; line = line.trim(); String[] parts = line.split("\\s"); if (parts.length > 0){ ...
#vulnerable code public void run() throws IOException { BufferedReader inReader = new BufferedReader(new InputStreamReader(System.in)); while(true){ System.out.print("> "); String line = inReader.readLine(); if (line == null || line.isEmpty()) continue; lin...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public void execute(String[] args, PrintStream out) throws Exception { String field = null; String termVal = null; try{ field = args[0]; } catch(Exception e){ field = null; } if (field != null){ String[] parts = fie...
#vulnerable code @Override public void execute(String[] args, PrintStream out) throws Exception { String field = null; String termVal = null; try{ field = args[0]; } catch(Exception e){ field = null; } if (field != null){ String[] parts...
Below is the vulnerable code, please generate the patch based on the following information.