input
stringlengths
205
73.3k
output
stringlengths
64
73.2k
instruction
stringclasses
1 value
#vulnerable code private Map<String, Set<String>> readIndexFiles() { // checking cache if (entries != null) { return entries; } entries = new HashMap<String, Set<String>>(); List<PluginWrapper> plugins = pluginManager.getPlugins(); ...
#fixed code private Map<String, Set<String>> readIndexFiles() { // checking cache if (entries != null) { return entries; } entries = new LinkedHashMap<String, Set<String>>(); readClasspathIndexFiles(); readPluginsIndexFiles();...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void extract() throws IOException { log.debug("Extract content of '{}' to '{}'", source, destination); // delete destination file if exists removeDirectory(destination); ZipInputStream zipInputStream = new ZipInputStream(new FileInp...
#fixed code public void extract() throws IOException { log.debug("Extract content of '{}' to '{}'", source, destination); // delete destination file if exists if (destination.exists() && destination.isDirectory()) { FileUtils.delete(destination.toPath...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected Manifest readManifest(Path pluginPath) throws PluginException { if (FileUtils.isJarFile(pluginPath)) { try { Manifest manifest = new JarFile(pluginPath.toFile()).getManifest(); if (manifest != null) { ...
#fixed code protected Manifest readManifest(Path pluginPath) throws PluginException { if (FileUtils.isJarFile(pluginPath)) { try(JarFile jar = new JarFile(pluginPath.toFile())) { Manifest manifest = jar.getManifest(); if (manifest != nu...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.processingOver()) { return false; } for (Element element : roundEnv.getElementsAnnotatedWith(Extension.class)) { // chec...
#fixed code @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.processingOver()) { return false; } for (Element element : roundEnv.getElementsAnnotatedWith(Extension.class)) { // check i...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public Map<String, Set<String>> readPluginsStorages() { log.debug("Reading extensions storages from plugins"); Map<String, Set<String>> result = new LinkedHashMap<>(); List<PluginWrapper> plugins = pluginManager.getPlugins(); ...
#fixed code @Override public Map<String, Set<String>> readPluginsStorages() { log.debug("Reading extensions storages from plugins"); Map<String, Set<String>> result = new LinkedHashMap<>(); List<PluginWrapper> plugins = pluginManager.getPlugins(); for...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void createEnabledFile() throws IOException { File file = testFolder.newFile("enabled.txt"); file.createNewFile(); try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "utf-8"))) { writer....
#fixed code private void createEnabledFile() throws IOException { List<String> plugins = new ArrayList<>(); plugins.add("plugin-1"); plugins.add("plugin-2"); writeLines(plugins, "enabled.txt"); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public Map<String, Set<String>> readClasspathStorages() { log.debug("Reading extensions storages from classpath"); Map<String, Set<String>> result = new LinkedHashMap<>(); Set<String> bucket = new HashSet<>(); try { ...
#fixed code @Override public Map<String, Set<String>> readClasspathStorages() { log.debug("Reading extensions storages from classpath"); Map<String, Set<String>> result = new LinkedHashMap<>(); Set<String> bucket = new HashSet<>(); try { E...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public String loadPlugin(File pluginArchiveFile) { if (pluginArchiveFile == null || !pluginArchiveFile.exists()) { throw new IllegalArgumentException(String.format("Specified plugin %s does not exist!", pluginArchiveFile)); } File pluginDirectory = nul...
#fixed code @Override public String loadPlugin(File pluginArchiveFile) { if (pluginArchiveFile == null || !pluginArchiveFile.exists()) { throw new IllegalArgumentException(String.format("Specified plugin %s does not exist!", pluginArchiveFile)); } File pluginDirectory = null; t...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public String getTitle() throws IOException, ParseException { if (title != null) { return title; } if (url == null) throw new IOException("URL needs to be present"); return info(url).get("title").toString(); ...
#fixed code public String getTitle() { return title; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean isMod() throws IOException, ParseException { return Boolean.parseBoolean(info().get("is_mod").toString()); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public boolean isMod() throws IOException, ParseException { return Boolean.parseBoolean(getUserInformation().get("is_mod").toString()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public double created() throws IOException, ParseException { return Double.parseDouble(info().get("created").toString()); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public double created() throws IOException, ParseException { return Double.parseDouble(getUserInformation().get("created").toString()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public double createdUTC() throws IOException, ParseException { return Double.parseDouble(info().get("created_utc").toString()); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public double createdUTC() throws IOException, ParseException { return Double.parseDouble(getUserInformation().get("created_utc").toString()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean hasMail() throws IOException, ParseException { return Boolean.parseBoolean(info().get("has_mail").toString()); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public boolean hasMail() throws IOException, ParseException { return Boolean.parseBoolean(getUserInformation().get("has_mail").toString()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean isMod() throws IOException, ParseException { return Boolean.parseBoolean(info().get("is_mod").toString()); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public boolean isMod() throws IOException, ParseException { return Boolean.parseBoolean(getUserInformation().get("is_mod").toString()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public double created() throws IOException, ParseException { return Double.parseDouble(info().get("created").toString()); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public double created() throws IOException, ParseException { return Double.parseDouble(getUserInformation().get("created").toString()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean isGold() throws IOException, ParseException { return Boolean.parseBoolean(info().get("is_gold").toString()); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public boolean isGold() throws IOException, ParseException { return Boolean.parseBoolean(getUserInformation().get("is_gold").toString()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public LinkedList<Submission> getSubmissions(String redditName, Popularity type, Page frontpage, User user) throws IOException, ParseException { LinkedList<Submission> submissions = new LinkedList<Submission>(); String urlString =...
#fixed code public LinkedList<Submission> getSubmissions(String redditName, Popularity type, Page frontpage, User user) throws IOException, ParseException { LinkedList<Submission> submissions = new LinkedList<Submission>(); String urlString = "/r/"...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public String id() throws IOException, ParseException { return info().get("id").toString(); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public String id() throws IOException, ParseException { return getUserInformation().get("id").toString(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void parseRecursive(List<Comment> comments, JSONObject object) throws RetrievalFailedException, RedditError { assert comments != null : "List of comments must be instantiated."; assert object != null : "JSON Object must be instantiated."; ...
#fixed code protected void parseRecursive(List<Comment> comments, JSONObject object) throws RetrievalFailedException, RedditError { assert comments != null : "List of comments must be instantiated."; assert object != null : "JSON Object must be instantiated."; // Get...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public String getSubreddit() throws IOException, ParseException { if (subreddit != null) { return subreddit; } if (url == null) throw new IOException("URL needs to be present"); return info(url).get("subreddit").t...
#fixed code public String getSubreddit() { return subreddit; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean hasModMail() throws IOException, ParseException { return Boolean.parseBoolean(info().get("has_mod_mail").toString()); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public boolean hasModMail() throws IOException, ParseException { return Boolean.parseBoolean(getUserInformation().get("has_mod_mail").toString()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public int linkKarma() throws IOException, ParseException { return Integer.parseInt(Utils.toString(info().get("link_karma"))); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public int linkKarma() throws IOException, ParseException { return Integer.parseInt(Utils.toString(getUserInformation().get("link_karma"))); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public List<Subreddit> parse(String url) throws RetrievalFailedException, RedditError { // Determine cookie String cookie = (user == null) ? null : user.getCookie(); // List of subreddits List<Subreddit> subreddits = new LinkedList<Sub...
#fixed code public List<Subreddit> parse(String url) throws RetrievalFailedException, RedditError { // Determine cookie String cookie = (user == null) ? null : user.getCookie(); // List of subreddits List<Subreddit> subreddits = new LinkedList<Subreddit...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public String getAuthor() throws IOException, ParseException { if (author != null) { return author; } if (url == null) throw new IOException("URL needs to be present"); return info(url).get("author").toString(); ...
#fixed code public String getAuthor() { return author; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public String id() throws IOException, ParseException { return info().get("id").toString(); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public String id() throws IOException, ParseException { return getUserInformation().get("id").toString(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static LinkedList<Submission> getSubmissions(String redditName, Popularity type, Page frontpage, User user) throws IOException, ParseException { LinkedList<Submission> submissions = new LinkedList<Submission>(); String urlS...
#fixed code public static LinkedList<Submission> getSubmissions(String redditName, Popularity type, Page frontpage, User user) throws IOException, ParseException { LinkedList<Submission> submissions = new LinkedList<Submission>(); String urlString ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean isGold() throws IOException, ParseException { return Boolean.parseBoolean(info().get("is_gold").toString()); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public boolean isGold() throws IOException, ParseException { return Boolean.parseBoolean(getUserInformation().get("is_gold").toString()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public List<Submission> parse(String url) throws RetrievalFailedException, RedditError { // Determine cookie String cookie = (user == null) ? null : user.getCookie(); // List of submissions List<Submission> submissions = new LinkedList...
#fixed code public List<Submission> parse(String url) throws RetrievalFailedException, RedditError { // Determine cookie String cookie = (user == null) ? null : user.getCookie(); // List of submissions List<Submission> submissions = new LinkedList<Submi...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public double createdUTC() throws IOException, ParseException { return Double.parseDouble(info().get("created_utc").toString()); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public double createdUTC() throws IOException, ParseException { return Double.parseDouble(getUserInformation().get("created_utc").toString()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public LinkedList<Submission> getSubmissions(String redditName, Popularity type, Page frontpage, User user) throws IOException, ParseException { LinkedList<Submission> submissions = new LinkedList<Submission>(); String urlString =...
#fixed code public LinkedList<Submission> getSubmissions(String redditName, Popularity type, Page frontpage, User user) throws IOException, ParseException { LinkedList<Submission> submissions = new LinkedList<Submission>(); String urlString = "/r/"...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean hasModMail() throws IOException, ParseException { return Boolean.parseBoolean(info().get("has_mod_mail").toString()); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public boolean hasModMail() throws IOException, ParseException { return Boolean.parseBoolean(getUserInformation().get("has_mod_mail").toString()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public int commentKarma() throws IOException, ParseException { return Integer.parseInt(Utils.toString(info().get("comment_karma"))); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public int commentKarma() throws IOException, ParseException { return Integer.parseInt(Utils.toString(getUserInformation().get("comment_karma"))); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public LinkedList<Submission> getSubmissions(String redditName, Popularity type, Page frontpage, User user) throws IOException, ParseException { LinkedList<Submission> submissions = new LinkedList<Submission>(); String urlString =...
#fixed code public LinkedList<Submission> getSubmissions(String redditName, Popularity type, Page frontpage, User user) throws IOException, ParseException { LinkedList<Submission> submissions = new LinkedList<Submission>(); String urlString = "/r/"...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public double getCreatedUTC() throws IOException, ParseException { createdUTC = Double.parseDouble(info(url).get("created_utc").toString()); return createdUTC; } #location 2 #vulnerability typ...
#fixed code public double getCreatedUTC() { return createdUTC; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean hasMail() throws IOException, ParseException { return Boolean.parseBoolean(info().get("has_mail").toString()); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public boolean hasMail() throws IOException, ParseException { return Boolean.parseBoolean(getUserInformation().get("has_mail").toString()); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testWriteBeyondFileSize() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"a"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf =...
#fixed code public void testWriteBeyondFileSize() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"a"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf = new S...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void processEvents(int readyCount) throws IOReactorException { processSessionRequests(); if (readyCount > 0) { Set<SelectionKey> selectedKeys = this.selector.selectedKeys(); for (Iterator<Selection...
#fixed code @Override protected void processEvents(int readyCount) throws IOReactorException { processSessionRequests(); if (readyCount > 0) { Set<SelectionKey> selectedKeys = this.selector.selectedKeys(); for (Iterator<SelectionKey> i...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testInvalidInput() throws Exception { String s = "stuff"; ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {s}, "US-ASCII"); HttpParams params = new BasicHttpParams(); Sessio...
#fixed code @Test public void testInvalidInput() throws Exception { String s = "stuff"; ReadableByteChannel channel = new ReadableByteChannelMock( new String[] {s}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBu...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testEntityWithMultipleContentLength() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.getParams()....
#fixed code @Test public void testEntityWithMultipleContentLength() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.getParams().setBoo...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public DefaultNHttpServerConnection createConnection(final IOSession iosession) { final SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslcontext, this.sslHandler); CharsetDecoder chardecoder = null; CharsetEncoder charencoder = n...
#fixed code public DefaultNHttpServerConnection createConnection(final IOSession iosession) { final SSLIOSession ssliosession = createSSLIOSession(iosession, this.sslcontext, this.sslHandler); return new DefaultNHttpServerConnection(ssliosession, this.ccon...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testMalformedChunkSizeDecoding() throws Exception { String s = "5\r\n01234\r\n5zz\r\n56789\r\n6\r\nabcdef\r\n0\r\n\r\n"; ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {s}, "US-ASCII"); ...
#fixed code @Test public void testMalformedChunkSizeDecoding() throws Exception { String s = "5\r\n01234\r\n5zz\r\n56789\r\n6\r\nabcdef\r\n0\r\n\r\n"; ReadableByteChannel channel = new ReadableByteChannelMock( new String[] {s}, "US-ASCII"); Htt...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void requestReceived(final NHttpServerConnection conn) { HttpContext context = conn.getContext(); HttpRequest request = conn.getHttpRequest(); HttpVersion ver = request.getRequestLine().getHttpVersion(); if (!ver.lessEquals(HttpVe...
#fixed code public void requestReceived(final NHttpServerConnection conn) { HttpContext context = conn.getContext(); HttpRequest request = conn.getHttpRequest(); final ServerConnState connState = (ServerConnState) context.getAttribute(CONN_STATE); connSt...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void inputReady(final NHttpServerConnection conn, final ContentDecoder decoder) { HttpContext context = conn.getContext(); HttpRequest request = conn.getHttpRequest(); ServerConnState connState = (ServerConnState) context.getAttribute(CON...
#fixed code public void inputReady(final NHttpServerConnection conn, final ContentDecoder decoder) { HttpContext context = conn.getContext(); HttpRequest request = conn.getHttpRequest(); ServerConnState connState = (ServerConnState) context.getAttribute(CONN_STAT...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testEntityWithMultipleContentLengthSomeWrong() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.get...
#fixed code @Test public void testEntityWithMultipleContentLengthSomeWrong() 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.
#vulnerable code @Test public void testConstructors() throws Exception { new IdentityOutputStream(new SessionOutputBufferMock()); try { new IdentityOutputStream(null); Assert.fail("IllegalArgumentException should have been thrown"); } ...
#fixed code @Test public void testConstructors() throws Exception { new IdentityOutputStream(new SessionOutputBufferMock()).close(); try { new IdentityOutputStream(null); Assert.fail("IllegalArgumentException should have been thrown"); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testBasicDecodingFile() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"stuff; ", "more stuff; ", "a lot more stuff!!!"}, "US-ASCII"); HttpParams params = new BasicHttpP...
#fixed code @Test public void testBasicDecodingFile() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMock( new String[] {"stuff; ", "more stuff; ", "a lot more stuff!!!"}, "US-ASCII"); HttpParams params = new BasicHttpParams();...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testEntityWithInvalidContentLength() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.getParams().s...
#fixed code @Test public void testEntityWithInvalidContentLength() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.getParams().setBool...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void validate(final Set keys) { long currentTime = System.currentTimeMillis(); if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval) { this.lastTimeoutCheck = currentTime; if (keys != null) { ...
#fixed 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.
#vulnerable code @Test public void testChunkedConsistence() throws IOException { String input = "76126;27823abcd;:q38a-\nkjc\rk%1ad\tkh/asdui\r\njkh+?\\suweb"; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); OutputStream out = new ChunkedOutputStr...
#fixed code @Test public void testChunkedConsistence() throws IOException { String input = "76126;27823abcd;:q38a-\nkjc\rk%1ad\tkh/asdui\r\njkh+?\\suweb"; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); OutputStream out = new ChunkedOutputStream(20...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void processEvents(int readyCount) throws IOReactorException { processSessionRequests(); if (readyCount > 0) { Set<SelectionKey> selectedKeys = this.selector.selectedKeys(); for (Iterator<Selection...
#fixed code @Override protected void processEvents(int readyCount) throws IOReactorException { processSessionRequests(); if (readyCount > 0) { Set<SelectionKey> selectedKeys = this.selector.selectedKeys(); for (Iterator<SelectionKey> i...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testAvailable() throws IOException { final InputStream in = new ContentLengthInputStream( new SessionInputBufferMock(new byte[] {1, 2, 3}), 10L); Assert.assertEquals(0, in.available()); in.read(); Ass...
#fixed code @Test public void testAvailable() throws IOException { final InputStream in = new ContentLengthInputStream( new SessionInputBufferMock(new byte[] {1, 2, 3}), 3L); Assert.assertEquals(0, in.available()); in.read(); Assert.ass...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testCorruptChunkedInputStreamInvalidSize() throws IOException { final String s = "whatever\r\n01234\r\n5\r\n56789\r\n0\r\n"; final InputStream in = new ChunkedInputStream( new SessionInputBufferMock( ...
#fixed code @Test public void testCorruptChunkedInputStreamInvalidSize() throws IOException { final String s = "whatever\r\n01234\r\n5\r\n56789\r\n0\r\n"; final InputStream in = new ChunkedInputStream( new SessionInputBufferMock( ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testRequestExpectContinueGenerated() throws Exception { HttpContext context = new BasicHttpContext(null); BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/"); String s = "whatever"; ...
#fixed code @Test public void testRequestExpectContinueGenerated() throws Exception { HttpContext context = new BasicHttpContext(null); BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/"); String s = "whatever"; S...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testSimpleHttpPostsHTTP10() throws Exception { HttpRequestExecutionHandler requestExecutionHandler = new TestRequestExecutionHandler() { @Override protected HttpRequest generateRequest(TestJob testjob) { Strin...
#fixed code public void testSimpleHttpPostsHTTP10() throws Exception { HttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() { @Override protected HttpRequest generateRequest(Job testjob) { String s = testjob....
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testBasicWrite() throws Exception { final SessionOutputBufferMock transmitter = new SessionOutputBufferMock(); final IdentityOutputStream outstream = new IdentityOutputStream(transmitter); outstream.write(new byte[] {'a', 'b...
#fixed code @Test public void testBasicWrite() throws Exception { final SessionOutputBufferMock transmitter = new SessionOutputBufferMock(); final IdentityOutputStream outstream = new IdentityOutputStream(transmitter); outstream.write(new byte[] {'a', 'b'}, 0,...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public Future<BasicNIOPoolEntry> lease( final HttpHost route, final Object state, final FutureCallback<BasicNIOPoolEntry> callback) { int connectTimeout = Config.getInt(params, CoreConnectionPNames.CONNECTION_TIM...
#fixed code @Override public Future<BasicNIOPoolEntry> lease( final HttpHost route, final Object state, final FutureCallback<BasicNIOPoolEntry> callback) { return super.lease(route, state, this.connectTimeout, this.tunit, callback); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testEndOfStreamConditionReadingFooters() throws Exception { String s = "10\r\n1234567890123456\r\n" + "5\r\n12345\r\n5\r\n12345\r\n0\r\n"; ReadableByteChannel channel = new ReadableByteChannelMockup( ...
#fixed code @Test public void testEndOfStreamConditionReadingFooters() throws Exception { String s = "10\r\n1234567890123456\r\n" + "5\r\n12345\r\n5\r\n12345\r\n0\r\n"; ReadableByteChannel channel = new ReadableByteChannelMock( new Stri...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testSimpleHttpPostsChunked() throws Exception { HttpRequestExecutionHandler requestExecutionHandler = new TestRequestExecutionHandler() { @Override protected HttpRequest generateRequest(TestJob testjob) { Stri...
#fixed code public void testSimpleHttpPostsChunked() throws Exception { HttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() { @Override protected HttpRequest generateRequest(Job testjob) { String s = testjob...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testZeroLengthDecoding() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"stuff"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inb...
#fixed code @Test public void testZeroLengthDecoding() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMock( new String[] {"stuff"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf = new...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void onResponseReceived(final HttpResponse response) throws IOException { this.response = response; HttpEntity entity = this.response.getEntity(); if (entity != null) { long len = entity.getContentLength(); ...
#fixed code @Override protected void onResponseReceived(final HttpResponse response) throws IOException { this.response = response; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testIncompleteChunkDecoding() throws Exception { String[] chunks = { "10;", "key=\"value\"\r", "\n123456789012345", "6\r\n5\r\n12", "345\r\n6\r", ...
#fixed code @Test public void testIncompleteChunkDecoding() throws Exception { String[] chunks = { "10;", "key=\"value\"\r", "\n123456789012345", "6\r\n5\r\n12", "345\r\n6\r", "\na...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testSimpleHttpHeads() throws Exception { int connNo = 3; int reqNo = 20; TestJob[] jobs = new TestJob[connNo * reqNo]; for (int i = 0; i < jobs.length; i++) { jobs[i] = new TestJob(); } Queue<TestJo...
#fixed code public void testSimpleHttpHeads() throws Exception { int connNo = 3; int reqNo = 20; Job[] jobs = new Job[connNo * reqNo]; for (int i = 0; i < jobs.length; i++) { jobs[i] = new Job(); } Queue<Job> queue = new Concurr...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void onResponseReceived(final HttpResponse response) throws IOException { this.response = response; HttpEntity entity = this.response.getEntity(); if (entity != null) { long len = entity.getContentLength(); ...
#fixed code @Override protected void onResponseReceived(final HttpResponse response) throws IOException { this.response = response; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testCorruptChunkedInputStreamInvalidFooter() throws IOException { final String s = "1\r\n0\r\n0\r\nstuff\r\n"; final InputStream in = new ChunkedInputStream( new SessionInputBufferMock( Encodi...
#fixed code @Test public void testCorruptChunkedInputStreamInvalidFooter() throws IOException { final String s = "1\r\n0\r\n0\r\nstuff\r\n"; final InputStream in = new ChunkedInputStream( new SessionInputBufferMock( EncodingUtil...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testWriteBeyondFileSize() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"a"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void processResponse( final NHttpClientConnection conn, final ClientConnState connState) throws IOException, HttpException { HttpContext context = conn.getContext(); HttpResponse response = connState.getResponse(); ...
#fixed code private void processResponse( final NHttpClientConnection conn, final ClientConnState connState) throws IOException, HttpException { HttpContext context = conn.getContext(); HttpResponse response = connState.getResponse(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testMalformedChunkEndingDecoding() throws Exception { String s = "5\r\n01234\r\n5\r\n56789\n\r6\r\nabcdef\r\n0\r\n\r\n"; ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {s}, "US-ASCII"); ...
#fixed code @Test public void testMalformedChunkEndingDecoding() throws Exception { String s = "5\r\n01234\r\n5\r\n56789\n\r6\r\nabcdef\r\n0\r\n\r\n"; ReadableByteChannel channel = new ReadableByteChannelMock( new String[] {s}, "US-ASCII"); Htt...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testZeroLengthDecoding() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"stuff"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inb...
#fixed code @Test public void testZeroLengthDecoding() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMock( new String[] {"stuff"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf = new...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testCodingBeyondContentLimitFile() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] { "stuff;", "more stuff; and a lot more stuff"}, "US-ASCI...
#fixed code public void testCodingBeyondContentLimitFile() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] { "stuff;", "more stuff; and a lot more stuff"}, "US-ASCII"); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testConstructors() throws Exception { new ContentLengthOutputStream(new SessionOutputBufferMock(), 10L); try { new ContentLengthOutputStream(null, 10L); Assert.fail("IllegalArgumentException should have been ...
#fixed code @Test public void testConstructors() throws Exception { final ContentLengthOutputStream in = new ContentLengthOutputStream( new SessionOutputBufferMock(), 10L); in.close(); try { new ContentLengthOutputStream(null, 10L);...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(expected=MalformedChunkCodingException.class) public void testCorruptChunkedInputStreamMissingLF() throws IOException { final String s = "5\r01234\r\n5\r\n56789\r\n0\r\n"; final InputStream in = new ChunkedInputStream( new Sessi...
#fixed code @Test(expected=MalformedChunkCodingException.class) public void testCorruptChunkedInputStreamMissingLF() throws IOException { final String s = "5\r01234\r\n5\r\n56789\r\n0\r\n"; final InputStream in = new ChunkedInputStream( new SessionInpu...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testCodingBeyondContentLimitFile() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] { "stuff;", "more stuff; and a lot more stuff"}, "US-ASCI...
#fixed code public void testCodingBeyondContentLimitFile() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] { "stuff;", "more stuff; and a lot more stuff"}, "US-ASCII"); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testHttpPostsWithExpectContinue() throws Exception { HttpRequestExecutionHandler requestExecutionHandler = new TestRequestExecutionHandler() { @Override protected HttpRequest generateRequest(TestJob testjob) { ...
#fixed code public void testHttpPostsWithExpectContinue() throws Exception { HttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() { @Override protected HttpRequest generateRequest(Job testjob) { String s = te...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void processEvents(int readyCount) throws IOReactorException { processSessionRequests(); if (readyCount > 0) { Set<SelectionKey> selectedKeys = this.selector.selectedKeys(); for (Iterator<Selection...
#fixed code @Override protected void processEvents(int readyCount) throws IOReactorException { processSessionRequests(); if (readyCount > 0) { Set<SelectionKey> selectedKeys = this.selector.selectedKeys(); for (Iterator<SelectionKey> i...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testSimpleHttpPostsContentNotConsumed() throws Exception { HttpRequestHandler requestHandler = new HttpRequestHandler() { public void handle( final HttpRequest request, final HttpResponse response,...
#fixed code public void testSimpleHttpPostsContentNotConsumed() throws Exception { HttpRequestHandler requestHandler = new HttpRequestHandler() { public void handle( final HttpRequest request, final HttpResponse response, ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testWriteBeyondFileSize() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"a"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf =...
#fixed code public void testWriteBeyondFileSize() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"a"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf = new S...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testWriteBeyondFileSize() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"a"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf =...
#fixed code public void testWriteBeyondFileSize() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"a"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf = new S...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testEntityWithMultipleContentLengthSomeWrong() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.get...
#fixed code @Test public void testEntityWithMultipleContentLengthSomeWrong() 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.
#vulnerable code @Test public void testWriteBeyondFileSize() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMock( new String[] {"a"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf = ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testBasicDecodingFile() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, "US-ASCII"); HttpParams params = new BasicHttpPar...
#fixed code @Test public void testBasicDecodingFile() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMock( new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testMalformedChunkTruncatedChunk() throws Exception { String s = "3\r\n12"; ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {s}, "US-ASCII"); HttpParams params = new BasicHttpParams(...
#fixed code @Test public void testMalformedChunkTruncatedChunk() throws Exception { String s = "3\r\n12"; ReadableByteChannel channel = new ReadableByteChannelMock( new String[] {s}, "US-ASCII"); HttpParams params = new BasicHttpParams(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void connected(final IOSession session) { SSLIOSession sslSession = new SSLIOSession( session, this.sslcontext, this.sslHandler); NHttpServerIOTarget conn = createConnection( ...
#fixed code public void connected(final IOSession session) { SSLIOSession sslSession = createSSLIOSession( session, this.sslcontext, this.sslHandler); NHttpServerIOTarget conn = createConnection( ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testResponseContentNoEntity() throws Exception { HttpContext context = new HttpExecutionContext(null); HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK"); ResponseContent interceptor = new Resp...
#fixed code public void testResponseContentNoEntity() throws Exception { HttpContext context = new BasicHttpContext(null); HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK"); ResponseContent interceptor = new ResponseConten...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void doShutdown() throws InterruptedIOException { if (this.status.compareTo(IOReactorStatus.SHUTTING_DOWN) >= 0) { return; } this.status = IOReactorStatus.SHUTTING_DOWN; try { cancelRequests(); ...
#fixed code protected void doShutdown() throws InterruptedIOException { synchronized (this.statusLock) { if (this.status.compareTo(IOReactorStatus.SHUTTING_DOWN) >= 0) { return; } this.status = IOReactorStatus.SHUTTING_DOWN; ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(expected = MalformedChunkCodingException.class) public void testCorruptChunkedInputStreamInvalidFooter() throws IOException { final String s = "1\r\n0\r\n0\r\nstuff\r\n"; final InputStream in = new ChunkedInputStream( new Sessio...
#fixed code @Test(expected = MalformedChunkCodingException.class) public void testCorruptChunkedInputStreamInvalidFooter() throws IOException { final String s = "1\r\n0\r\n0\r\nstuff\r\n"; final InputStream in = new ChunkedInputStream( new SessionInput...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testAvailable() throws IOException { final String s = "5\r\n12345\r\n0\r\n"; final ChunkedInputStream in = new ChunkedInputStream( new SessionInputBufferMock( EncodingUtils.getBytes(s, CONTENT...
#fixed code @Test public void testAvailable() throws IOException { final String s = "5\r\n12345\r\n0\r\n"; final ChunkedInputStream in = new ChunkedInputStream( new SessionInputBufferMock( EncodingUtils.getBytes(s, CONTENT_CHARS...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testEntityWithInvalidContentLength() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.getParams().s...
#fixed code @Test public void testEntityWithInvalidContentLength() throws Exception { SessionInputBuffer inbuffer = new SessionInputBufferMock(new byte[] {'0'}); HttpMessage message = new DummyHttpMessage(); // lenient mode message.getParams().setBool...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testEmptyChunkedInputStream() throws IOException { final String input = "0\r\n"; final InputStream in = new ChunkedInputStream( new SessionInputBufferMock( EncodingUtils.getBytes(input, CONTEN...
#fixed code @Test public void testEmptyChunkedInputStream() throws IOException { final String input = "0\r\n"; final InputStream in = new ChunkedInputStream( new SessionInputBufferMock( EncodingUtils.getBytes(input, CONTENT_CHAR...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testInvalidInput() throws Exception { String s = "stuff"; ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {s}, "US-ASCII"); HttpParams params = new BasicHttpParams(); Sessio...
#fixed code @Test public void testInvalidInput() throws Exception { String s = "stuff"; ReadableByteChannel channel = new ReadableByteChannelMock( new String[] {s}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBu...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testInputThrottling() throws Exception { HttpRequestExecutionHandler requestExecutionHandler = new HttpRequestExecutionHandler() { public void initalizeContext(final HttpContext context, final Object attachment) { context...
#fixed code public void testInputThrottling() throws Exception { HttpRequestExecutionHandler requestExecutionHandler = new HttpRequestExecutionHandler() { public void initalizeContext(final HttpContext context, final Object attachment) { context.setAt...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testCorruptChunkedInputStreamMissingLF() throws IOException { final String s = "5\r01234\r\n5\r\n56789\r\n0\r\n"; final InputStream in = new ChunkedInputStream( new SessionInputBufferMock( Enc...
#fixed code @Test public void testCorruptChunkedInputStreamMissingLF() throws IOException { final String s = "5\r01234\r\n5\r\n56789\r\n0\r\n"; final InputStream in = new ChunkedInputStream( new SessionInputBufferMock( EncodingU...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void doShutdown() throws InterruptedIOException { if (this.status.compareTo(IOReactorStatus.SHUTTING_DOWN) >= 0) { return; } this.status = IOReactorStatus.SHUTTING_DOWN; try { cancelRequests(); ...
#fixed 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.
#vulnerable code @Test public void testMalformedFooters() throws Exception { String s = "10;key=\"value\"\r\n1234567890123456\r\n" + "5\r\n12345\r\n5\r\n12345\r\n0\r\nFooter1 abcde\r\n\r\n"; ReadableByteChannel channel = new ReadableByteChannelMockup(...
#fixed code @Test public void testMalformedFooters() throws Exception { String s = "10;key=\"value\"\r\n1234567890123456\r\n" + "5\r\n12345\r\n5\r\n12345\r\n0\r\nFooter1 abcde\r\n\r\n"; ReadableByteChannel channel = new ReadableByteChannelMock( ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void onResponseReceived(final HttpResponse response) throws IOException { this.response = response; HttpEntity entity = this.response.getEntity(); if (entity != null) { long len = entity.getContentLength(); ...
#fixed code @Override protected void onResponseReceived(final HttpResponse response) throws IOException { this.response = response; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testWriteBeyondFileSize() throws Exception { ReadableByteChannel channel = new ReadableByteChannelMockup( new String[] {"a"}, "US-ASCII"); HttpParams params = new BasicHttpParams(); SessionInputBuffer inbuf ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void processEvents(int readyCount) throws IOReactorException { processSessionRequests(); if (readyCount > 0) { Set<SelectionKey> selectedKeys = this.selector.selectedKeys(); for (Iterator<Selection...
#fixed code @Override protected void processEvents(int readyCount) throws IOReactorException { processSessionRequests(); if (readyCount > 0) { Set<SelectionKey> selectedKeys = this.selector.selectedKeys(); for (Iterator<SelectionKey> i...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testBasics() throws IOException { final String correct = "1234567890123456"; final InputStream in = new ContentLengthInputStream(new SessionInputBufferMock( EncodingUtils.getBytes(correct, CONTENT_CHARSET)), 10L); ...
#fixed code @Test public void testBasics() throws IOException { final String correct = "1234567890123456"; final InputStream in = new ContentLengthInputStream(new SessionInputBufferMock( EncodingUtils.getBytes(correct, CONTENT_CHARSET)), 10L); fina...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void testSimpleHttpGets() throws Exception { HttpRequestExecutionHandler requestExecutionHandler = new TestRequestExecutionHandler() { @Override protected HttpRequest generateRequest(TestJob testjob) { String s = t...
#fixed code public void testSimpleHttpGets() throws Exception { HttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() { @Override protected HttpRequest generateRequest(Job testjob) { String s = testjob.getPatt...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testBasicRead() throws Exception { final byte[] input = new byte[] {'a', 'b', 'c'}; final SessionInputBufferMock receiver = new SessionInputBufferMock(input); final IdentityInputStream instream = new IdentityInputStream(rece...
#fixed code @Test public void testBasicRead() throws Exception { final byte[] input = new byte[] {'a', 'b', 'c'}; final SessionInputBufferMock receiver = new SessionInputBufferMock(input); final IdentityInputStream instream = new IdentityInputStream(receiver);...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(expected = MalformedChunkCodingException.class) public void testCorruptChunkedInputStreamInvalidSize() throws IOException { final String s = "whatever\r\n01234\r\n5\r\n56789\r\n0\r\n"; final InputStream in = new ChunkedInputStream( ...
#fixed code @Test(expected = MalformedChunkCodingException.class) public void testCorruptChunkedInputStreamInvalidSize() throws IOException { final String s = "whatever\r\n01234\r\n5\r\n56789\r\n0\r\n"; final InputStream in = new ChunkedInputStream( ne...
Below is the vulnerable code, please generate the patch based on the following information.