output
stringlengths
64
73.2k
input
stringlengths
208
73.3k
instruction
stringclasses
1 value
#fixed code public void testUnicodeEscape() throws Exception { String code = "abc,\\u0070\\u0075\\u0062\\u006C\\u0069\\u0063"; CSVParser parser = new CSVParser(code, CSVFormat.DEFAULT.withUnicodeEscapesInterpreted(true)); final Iterator<String[]> iterator = parser...
#vulnerable code public void testUnicodeEscape() throws Exception { String code = "abc,\\u0070\\u0075\\u0062\\u006C\\u0069\\u0063"; CSVParser parser = new CSVParser(code, CSVFormat.DEFAULT.withUnicodeEscapesInterpreted(true)); String[] data = parser.iterator().ne...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testGetLine() throws IOException { CSVParser parser = new CSVParser(new StringReader(code)); for (String[] re : res) { assertTrue(Arrays.equals(re, parser.getLine())); } assertTrue(parser.getLine() == null); ...
#vulnerable code public void testGetLine() throws IOException { CSVParser parser = new CSVParser(new StringReader(code)); String[] tmp = null; for (int i = 0; i < res.length; i++) { tmp = parser.getLine(); assertTrue(Arrays.equals(res[i], ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testPrinter5() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", "b\nc"); assertEquals("a,\"b\nc\"" + recordSeparato...
#vulnerable code @Test public void testPrinter5() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", "b\nc"); assertEquals("a,\"b\nc\"" + recordSe...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCarriageReturnLineFeedEndings() throws IOException { final String code = "foo\r\nbaar,\r\nhello,world\r\n,kanu"; final CSVParser parser = CSVParser.parseString(code, CSVFormat.DEFAULT); final List<CSVRecord> records = parser.g...
#vulnerable code @Test public void testCarriageReturnLineFeedEndings() throws IOException { final String code = "foo\r\nbaar,\r\nhello,world\r\n,kanu"; final CSVParser parser = new CSVParser(new StringReader(code)); final List<CSVRecord> records = parser.getR...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReadLine() throws Exception { ExtendedBufferedReader br = getBufferedReader(""); assertNull(br.readLine()); br.close(); br = getBufferedReader("\n"); assertEquals("",br.readLine()); assertNull(br.readL...
#vulnerable code @Test public void testReadLine() throws Exception { ExtendedBufferedReader br = getBufferedReader(""); assertNull(br.readLine()); br = getBufferedReader("\n"); assertEquals("",br.readLine()); assertNull(br.readLine()); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCarriageReturnEndings() throws IOException { final String code = "foo\rbaar,\rhello,world\r,kanu"; final CSVParser parser = CSVParser.parse(code, CSVFormat.DEFAULT); final List<CSVRecord> records = parser.getRecords(); ...
#vulnerable code @Test public void testCarriageReturnEndings() throws IOException { final String code = "foo\rbaar,\rhello,world\r,kanu"; final CSVParser parser = CSVParser.parse(code, CSVFormat.DEFAULT); final List<CSVRecord> records = parser.getRecords(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testMutators() { final CSVFormat format = new CSVFormat('!', '!', null, '!', '!', true, true, CRLF, null); assertEquals('?', format.withDelimiter('?').getDelimiter()); assertEquals('?', format.withQuoteChar('?').getQuoteChar().ch...
#vulnerable code @Test public void testMutators() { final CSVFormat format = new CSVFormat('!', '!', null, '!', '!', true, true, CRLF, null); assertEquals('?', format.withDelimiter('?').getDelimiter()); assertEquals('?', format.withEncapsulator('?').getQuote...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testReadLine() throws Exception { ExtendedBufferedReader br = getEBR(""); assertTrue(br.readLine() == null); br = getEBR("\n"); assertTrue(br.readLine().equals("")); assertTrue(br.readLine() == null); br = getEBR("foo\n\nhello"); ...
#vulnerable code public void testReadLine() throws Exception { br = getEBR(""); assertTrue(br.readLine() == null); br = getEBR("\n"); assertTrue(br.readLine().equals("")); assertTrue(br.readLine() == null); br = getEBR("foo\n\nhello"); assertEquals(0,...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testReadLine() throws Exception { ExtendedBufferedReader br = getEBR(""); assertTrue(br.readLine() == null); br = getEBR("\n"); assertTrue(br.readLine().equals("")); assertTrue(br.readLine() == null); br = getEBR("foo\n\nhello"); ...
#vulnerable code public void testReadLine() throws Exception { br = getEBR(""); assertTrue(br.readLine() == null); br = getEBR("\n"); assertTrue(br.readLine().equals("")); assertTrue(br.readLine() == null); br = getEBR("foo\n\nhello"); assertEquals(0,...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testIgnoreEmptyLines() throws IOException { final String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n"; //String code = "world\r\n\n"; //String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n"; final CSVParser parser = CSVPa...
#vulnerable code @Test public void testIgnoreEmptyLines() throws IOException { final String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n"; //String code = "world\r\n\n"; //String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n"; final CSVParser parser =...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testRoundtrip() throws Exception { final StringWriter out = new StringWriter(); final CSVPrinter printer = new CSVPrinter(out, CSVFormat.DEFAULT); final String input = "a,b,c\r\n1,2,3\r\nx,y,z\r\n"; for (final CSVRecord re...
#vulnerable code @Test public void testRoundtrip() throws Exception { final StringWriter out = new StringWriter(); final CSVPrinter printer = new CSVPrinter(out, CSVFormat.DEFAULT); final String input = "a,b,c\r\n1,2,3\r\nx,y,z\r\n"; for (final CSVRec...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testPrinter1() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", "b"); assertEquals("a,b" + recordSeparator, sw.toSt...
#vulnerable code @Test public void testPrinter1() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", "b"); assertEquals("a,b" + recordSeparator, s...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testExcelFormat2() throws Exception { final String code = "foo,baar\r\n\r\nhello,\r\n\r\nworld,\r\n"; final String[][] res = { {"foo", "baar"}, {""}, {"hello", ""}, {""}, ...
#vulnerable code @Test public void testExcelFormat2() throws Exception { final String code = "foo,baar\r\n\r\nhello,\r\n\r\nworld,\r\n"; final String[][] res = { {"foo", "baar"}, {""}, {"hello", ""}, {""...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testConstructors() { ExtendedBufferedReader br = new ExtendedBufferedReader(new StringReader("")); br = new ExtendedBufferedReader(new StringReader(""), 10); }
#vulnerable code public void testConstructors() { br = new ExtendedBufferedReader(new StringReader("")); br = new ExtendedBufferedReader(new StringReader(""), 10); } #location 3 #vulnerability type RESOURCE_LEAK
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testDefaultFormat() throws IOException { final String code = "" + "a,b#\n" // 1) + "\"\n\",\" \",#\n" // 2) + "#,\"\"\n" // 3) + "# Final comment\n"// 4) ...
#vulnerable code @Test public void testDefaultFormat() throws IOException { final String code = "" + "a,b#\n" // 1) + "\"\n\",\" \",#\n" // 2) + "#,\"\"\n" // 3) + "# Final comment\n"// 4) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testGetLine() throws IOException { CSVParser parser = new CSVParser(new StringReader(code)); for (String[] re : res) { assertTrue(Arrays.equals(re, parser.getLine())); } assertTrue(parser.getLine() == null); ...
#vulnerable code public void testGetLine() throws IOException { CSVParser parser = new CSVParser(new StringReader(code)); String[] tmp = null; for (int i = 0; i < res.length; i++) { tmp = parser.getLine(); assertTrue(Arrays.equals(res[i], ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testGetRecords() throws IOException { final CSVParser parser = CSVParser.parse(CSVINPUT, CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true)); final List<CSVRecord> records = parser.getRecords(); assertEquals(RESULT.length, record...
#vulnerable code @Test public void testGetRecords() throws IOException { final CSVParser parser = CSVParser.parse(CSVINPUT, CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true)); final List<CSVRecord> records = parser.getRecords(); assertEquals(RESULT.length, ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCSVUrl() throws Exception { String line = readTestData(); assertNotNull("file must contain config line", line); final String[] split = line.split(" "); assertTrue(testName + " require 1 param", split.length >= 1); ...
#vulnerable code @Test public void testCSVUrl() throws Exception { String line = readTestData(); assertNotNull("file must contain config line", line); final String[] split = line.split(" "); assertTrue(testName + " require 1 param", split.length >= 1)...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testBackslashEscaping() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. final ...
#vulnerable code @Test public void testBackslashEscaping() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testBackslashEscaping() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. String...
#vulnerable code @Test public void testBackslashEscaping() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test // TODO this may lead to strange behavior, throw an exception if iterator() has already been called? public void testMultipleIterators() throws Exception { final CSVParser parser = CSVParser.parse("a,b,c" + CR + "d,e,f", CSVFormat.DEFAULT); final It...
#vulnerable code @Test // TODO this may lead to strange behavior, throw an exception if iterator() has already been called? public void testMultipleIterators() throws Exception { final CSVParser parser = CSVParser.parse("a,b,c" + CR + "d,e,f", CSVFormat.DEFAULT); fi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void doOneRandom(final CSVFormat format) throws Exception { final Random r = new Random(); final int nLines = r.nextInt(4) + 1; final int nCol = r.nextInt(3) + 1; // nLines=1;nCol=2; final String[][] lines = new String[nLines][]...
#vulnerable code public void doOneRandom(final CSVFormat format) throws Exception { final Random r = new Random(); final int nLines = r.nextInt(4) + 1; final int nCol = r.nextInt(3) + 1; // nLines=1;nCol=2; final String[][] lines = new String[nLi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testExcelPrintAllIterableOfArrays() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL); printer.printRecords(Arrays.asList(new String[][] { { "r1c1", "r1...
#vulnerable code @Test public void testExcelPrintAllIterableOfArrays() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL); printer.printRecords(Arrays.asList(new String[][] { { "r1c1...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test @Ignore public void testBackslashEscapingOld() throws IOException { String code = "one,two,three\n" + "on\\\"e,two\n" + "on\"e,two\n" + "one,\"tw\\\"o\"\n" ...
#vulnerable code @Test @Ignore public void testBackslashEscapingOld() throws IOException { String code = "one,two,three\n" + "on\\\"e,two\n" + "on\"e,two\n" + "one,\"tw\\\"o\"\n" ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testPrinter7() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", "b\\c"); assertEquals("a,b\\c" + recordSeparator, s...
#vulnerable code @Test public void testPrinter7() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", "b\\c"); assertEquals("a,b\\c" + recordSepara...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCSV57() throws Exception { final CSVParser parser = CSVParser.parseString("", CSVFormat.DEFAULT); final List<CSVRecord> list = parser.getRecords(); assertNotNull(list); assertEquals(0, list.size()); }
#vulnerable code @Test public void testCSV57() throws Exception { final CSVParser parser = new CSVParser("", CSVFormat.DEFAULT); final List<CSVRecord> list = parser.getRecords(); assertNotNull(list); assertEquals(0, list.size()); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testMutators() { final CSVFormat format = new CSVFormat('!', '!', null, '!', '!', true, true, CRLF, null); assertEquals('?', format.withDelimiter('?').getDelimiter()); assertEquals('?', format.withEncapsulator('?').getQuoteChar()...
#vulnerable code @Test public void testMutators() { final CSVFormat format = new CSVFormat('!', '!', null, '!', '!', true, true, CRLF, null); assertEquals('?', format.withDelimiter('?').getDelimiter()); assertEquals('?', format.withEncapsulator('?').getEncap...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testLineFeedEndings() throws IOException { String code = "foo\nbaar,\nhello,world\n,kanu"; CSVParser parser = new CSVParser(new StringReader(code)); List<CSVRecord> records = parser.getRecords(); assertEquals(4, records.si...
#vulnerable code @Test public void testLineFeedEndings() throws IOException { String code = "foo\nbaar,\nhello,world\n,kanu"; CSVParser parser = new CSVParser(new StringReader(code)); String[][] data = parser.getRecords(); assertEquals(4, data.length)...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEmptyLineBehaviourCSV() throws Exception { final String[] codes = { "hello,\r\n\r\n\r\n", "hello,\n\n\n", "hello,\"\"\r\n\r\n\r\n", "hello,\"\"\n\n\n" }; final St...
#vulnerable code @Test public void testEmptyLineBehaviourCSV() throws Exception { final String[] codes = { "hello,\r\n\r\n\r\n", "hello,\n\n\n", "hello,\"\"\r\n\r\n\r\n", "hello,\"\"\n\n\n" }; fi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testDefaultFormat() throws IOException { final String code = "" + "a,b#\n" // 1) + "\"\n\",\" \",#\n" // 2) + "#,\"\"\n" // 3) + "# Final comment\n"// 4) ...
#vulnerable code @Test public void testDefaultFormat() throws IOException { final String code = "" + "a,b#\n" // 1) + "\"\n\",\" \",#\n" // 2) + "#,\"\"\n" // 3) + "# Final comment\n"// 4) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testExcelPrinter2() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL); printer.printRecord("a,b", "b"); assertEquals("\"a,b\",b" + recordSeparat...
#vulnerable code @Test public void testExcelPrinter2() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL); printer.printRecord("a,b", "b"); assertEquals("\"a,b\",b" + recordS...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testReadLine() throws Exception { ExtendedBufferedReader br = getEBR(""); assertTrue(br.readLine() == null); br = getEBR("\n"); assertTrue(br.readLine().equals("")); assertTrue(br.readLine() == null); br = getEBR("foo\n\nhello"); ...
#vulnerable code public void testReadLine() throws Exception { br = getEBR(""); assertTrue(br.readLine() == null); br = getEBR("\n"); assertTrue(br.readLine().equals("")); assertTrue(br.readLine() == null); br = getEBR("foo\n\nhello"); assertEquals(0,...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testBackslashEscaping() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. final ...
#vulnerable code @Test public void testBackslashEscaping() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void test() throws UnsupportedEncodingException, IOException { InputStream pointsOfReference = getClass().getResourceAsStream("/CSV-198/optd_por_public.csv"); Assert.assertNotNull(pointsOfReference); try (@SuppressWarnings("resource") ...
#vulnerable code @Test public void test() throws UnsupportedEncodingException, IOException { InputStream pointsOfReference = getClass().getResourceAsStream("/CSV-198/optd_por_public.csv"); Assert.assertNotNull(pointsOfReference); CSVParser parser = CSV_FORMAT...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testPrinter6() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", "b\r\nc"); assertEquals("a,\"b\r\nc\"" + recordSepa...
#vulnerable code @Test public void testPrinter6() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", "b\r\nc"); assertEquals("a,\"b\r\nc\"" + reco...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testReadUntil() throws Exception { ExtendedBufferedReader br = getEBR(""); assertTrue(br.readUntil(';').equals("")); br = getEBR("ABCDEF;GHL;;MN"); assertTrue(br.readUntil(';').equals("ABCDEF")); assertTrue(br.readUntil(';').length() == 0); b...
#vulnerable code public void testReadUntil() throws Exception { br = getEBR(""); assertTrue(br.readUntil(';').equals("")); br = getEBR("ABCDEF;GHL;;MN"); assertTrue(br.readUntil(';').equals("ABCDEF")); assertTrue(br.readUntil(';').length() == 0); br.skip(1); as...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testBackslashEscaping() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. final ...
#vulnerable code @Test public void testBackslashEscaping() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testDefaultFormat() throws IOException { final String code = "" + "a,b#\n" // 1) + "\"\n\",\" \",#\n" // 2) + "#,\"\"\n" // 3) + "# Final comment\n"// 4) ...
#vulnerable code @Test public void testDefaultFormat() throws IOException { final String code = "" + "a,b#\n" // 1) + "\"\n\",\" \",#\n" // 2) + "#,\"\"\n" // 3) + "# Final comment\n"// 4) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testReadLookahead2() throws Exception { char[] ref = new char[5]; char[] res = new char[5]; ExtendedBufferedReader br = getBufferedReader("abcdefg"); ref[0] = 'a'; ref[1] = 'b'; ref[2] = 'c'; assertE...
#vulnerable code public void testReadLookahead2() throws Exception { char[] ref = new char[5]; char[] res = new char[5]; ExtendedBufferedReader br = getEBR(""); assertEquals(0, br.read(res, 0, 0)); assertTrue(Arrays.equals(res, ref)); br...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testBackslashEscaping2() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. Strin...
#vulnerable code @Test public void testBackslashEscaping2() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testEndOfFileBehaviourExcel() throws Exception { String[] codes = { "hello,\r\n\r\nworld,\r\n", "hello,\r\n\r\nworld,", "hello,\r\n\r\nworld,\"\"\r\n", "hello,\r\n\r\nworld,\"\"", ...
#vulnerable code public void testEndOfFileBehaviourExcel() throws Exception { String[] codes = { "hello,\r\n\r\nworld,\r\n", "hello,\r\n\r\nworld,", "hello,\r\n\r\nworld,\"\"\r\n", "hello,\r\n\r\nworld,\"\"", ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testIgnoreEmptyLines() throws IOException { String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n"; //String code = "world\r\n\n"; //String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n"; CSVParser parser = new CSVParser(new...
#vulnerable code @Test public void testIgnoreEmptyLines() throws IOException { String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n"; //String code = "world\r\n\n"; //String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n"; CSVParser parser = new CSVPars...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testExcelFormat1() throws IOException { String code = "value1,value2,value3,value4\r\na,b,c,d\r\n x,,," + "\r\n\r\n\"\"\"hello\"\"\",\" \"\"world\"\"\",\"abc\ndef\",\r\n"; String[][] res = { ...
#vulnerable code @Test public void testExcelFormat1() throws IOException { String code = "value1,value2,value3,value4\r\na,b,c,d\r\n x,,," + "\r\n\r\n\"\"\"hello\"\"\",\" \"\"world\"\"\",\"abc\ndef\",\r\n"; String[][] res = {...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testIterator() { Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z"); Iterator<String[]> iterator = CSVFormat.DEFAULT.parse(in).iterator(); assertTrue(iterator.hasNext()); try { iterator.remove(); ...
#vulnerable code public void testIterator() { Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z"); Iterator<String[]> iterator = CSVFormat.DEFAULT.parse(in).iterator(); assertTrue(iterator.hasNext()); iterator.remove(); assertTru...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testIgnoreEmptyLines() throws IOException { final String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n"; //String code = "world\r\n\n"; //String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n"; final CSVParser parser = CSVPa...
#vulnerable code @Test public void testIgnoreEmptyLines() throws IOException { final String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n"; //String code = "world\r\n\n"; //String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n"; final CSVParser parser =...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testQuoteAll() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withQuotePolicy(Quote.ALL).build()); printer.printRecord("a", "b\nc", "d"); ...
#vulnerable code @Test public void testQuoteAll() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withQuotePolicy(Quote.ALL).build()); printer.printRecord("a", "b\nc", "d");...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testExcelPrinter1() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL); printer.printRecord("a", "b"); assertEquals("a,b" + recordSeparator, sw.t...
#vulnerable code @Test public void testExcelPrinter1() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL); printer.printRecord("a", "b"); assertEquals("a,b" + recordSeparator...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void doOneRandom(final CSVFormat format) throws Exception { final Random r = new Random(); final int nLines = r.nextInt(4) + 1; final int nCol = r.nextInt(3) + 1; // nLines=1;nCol=2; final String[][] lines = new String[nLines][...
#vulnerable code private void doOneRandom(final CSVFormat format) throws Exception { final Random r = new Random(); final int nLines = r.nextInt(4) + 1; final int nCol = r.nextInt(3) + 1; // nLines=1;nCol=2; final String[][] lines = new String[nL...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testBackslashEscaping2() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. final...
#vulnerable code @Test public void testBackslashEscaping2() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testIterator() { Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z"); Iterator<String[]> iterator = CSVFormat.DEFAULT.parse(in).iterator(); assertTrue(iterator.hasNext()); iterator.remove(); assertTrue(Arra...
#vulnerable code public void testIterator() { String code = "a,b,c\n1,2,3\nx,y,z"; Iterator<String[]> iterator = new CSVParser(new StringReader(code)).iterator(); assertTrue(iterator.hasNext()); iterator.remove(); assertTrue(Arrays.equals...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testLineFeedEndings() throws IOException { final String code = "foo\nbaar,\nhello,world\n,kanu"; final CSVParser parser = CSVParser.parse(code, CSVFormat.DEFAULT); final List<CSVRecord> records = parser.getRecords(); asser...
#vulnerable code @Test public void testLineFeedEndings() throws IOException { final String code = "foo\nbaar,\nhello,world\n,kanu"; final CSVParser parser = CSVParser.parse(code, CSVFormat.DEFAULT); final List<CSVRecord> records = parser.getRecords(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testSkip0() throws Exception { ExtendedBufferedReader br = getEBR(""); assertEquals(0, br.skip(0)); assertEquals(0, br.skip(1)); br = getEBR(""); assertEquals(0, br.skip(1)); br = getEBR("abcdefg"); assertEquals(0, br.skip(...
#vulnerable code public void testSkip0() throws Exception { br = getEBR(""); assertEquals(0, br.skip(0)); assertEquals(0, br.skip(1)); br = getEBR(""); assertEquals(0, br.skip(1)); br = getEBR("abcdefg"); assertEquals(0, br.skip(0)); assertEq...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEndOfFileBehaviourExcel() throws Exception { String[] codes = { "hello,\r\n\r\nworld,\r\n", "hello,\r\n\r\nworld,", "hello,\r\n\r\nworld,\"\"\r\n", "hello,\r\n\r\nworld,\"\"", ...
#vulnerable code @Test public void testEndOfFileBehaviourExcel() throws Exception { String[] codes = { "hello,\r\n\r\nworld,\r\n", "hello,\r\n\r\nworld,", "hello,\r\n\r\nworld,\"\"\r\n", "hello,\r\n\r\nworld,\"\...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCSV57() throws Exception { final CSVParser parser = CSVParser.parse("", CSVFormat.DEFAULT); final List<CSVRecord> list = parser.getRecords(); assertNotNull(list); assertEquals(0, list.size()); }
#vulnerable code @Test public void testCSV57() throws Exception { final CSVParser parser = CSVParser.parseString("", CSVFormat.DEFAULT); final List<CSVRecord> list = parser.getRecords(); assertNotNull(list); assertEquals(0, list.size()); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEndOfFileBehaviourExcel() throws Exception { final String[] codes = { "hello,\r\n\r\nworld,\r\n", "hello,\r\n\r\nworld,", "hello,\r\n\r\nworld,\"\"\r\n", "hello,\r\n\r\nworld,\"\...
#vulnerable code @Test public void testEndOfFileBehaviourExcel() throws Exception { final String[] codes = { "hello,\r\n\r\nworld,\r\n", "hello,\r\n\r\nworld,", "hello,\r\n\r\nworld,\"\"\r\n", "hello,\r\n\r\nwor...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testDefaultFormat() throws IOException { final String code = "" + "a,b#\n" // 1) + "\"\n\",\" \",#\n" // 2) + "#,\"\"\n" // 3) + "# Final comment\n"// 4) ...
#vulnerable code @Test public void testDefaultFormat() throws IOException { final String code = "" + "a,b#\n" // 1) + "\"\n\",\" \",#\n" // 2) + "#,\"\"\n" // 3) + "# Final comment\n"// 4) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testMultiLineComment() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withCommentStart('#').build()); printer.printComment("This is a comment\n...
#vulnerable code @Test public void testMultiLineComment() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withCommentStart('#').build()); printer.printComment("This is a com...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReadLine() throws Exception { ExtendedBufferedReader br = getBufferedReader(""); assertNull(br.readLine()); br = getBufferedReader("\n"); assertEquals("",br.readLine()); assertNull(br.readLine()); br ...
#vulnerable code @Test public void testReadLine() throws Exception { ExtendedBufferedReader br = getBufferedReader(""); assertTrue(br.readLine() == null); br = getBufferedReader("\n"); assertEquals("",br.readLine()); assertTrue(br.readLine() ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test @Ignore public void testBackslashEscapingOld() throws IOException { final String code = "one,two,three\n" + "on\\\"e,two\n" + "on\"e,two\n" + "one,\"tw\\\"o\"\n" ...
#vulnerable code @Test @Ignore public void testBackslashEscapingOld() throws IOException { final String code = "one,two,three\n" + "on\\\"e,two\n" + "on\"e,two\n" + "one,\"tw\\\"o\"\n...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testNoHeaderMap() throws Exception { final CSVParser parser = CSVParser.parse("a,b,c\n1,2,3\nx,y,z", CSVFormat.DEFAULT); Assert.assertNull(parser.getHeaderMap()); parser.close(); }
#vulnerable code @Test public void testNoHeaderMap() throws Exception { final CSVParser parser = CSVParser.parse("a,b,c\n1,2,3\nx,y,z", CSVFormat.DEFAULT); Assert.assertNull(parser.getHeaderMap()); } #location 4 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testReadLine() throws Exception { ExtendedBufferedReader br = getBufferedReader(""); assertTrue(br.readLine() == null); br = getBufferedReader("\n"); assertTrue(br.readLine().equals("")); assertTrue(br.readLine() == null); ...
#vulnerable code public void testReadLine() throws Exception { ExtendedBufferedReader br = getEBR(""); assertTrue(br.readLine() == null); br = getEBR("\n"); assertTrue(br.readLine().equals("")); assertTrue(br.readLine() == null); br = ge...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testDisabledComment() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printComment("This is a comment"); assertEquals("", sw.toStr...
#vulnerable code @Test public void testDisabledComment() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printComment("This is a comment"); assertEquals("", sw...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test @Ignore public void testBackslashEscapingOld() throws IOException { final String code = "one,two,three\n" + "on\\\"e,two\n" + "on\"e,two\n" + "one,\"tw\\\"o\"\n" ...
#vulnerable code @Test @Ignore public void testBackslashEscapingOld() throws IOException { final String code = "one,two,three\n" + "on\\\"e,two\n" + "on\"e,two\n" + "one,\"tw\\\"o\"\n...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testPrinter3() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a, b", "b "); assertEquals("\"a, b\",\"b \"" + recordSe...
#vulnerable code @Test public void testPrinter3() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a, b", "b "); assertEquals("\"a, b\",\"b \"" + re...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testUnicodeEscape() throws IOException { String code = "abc,\\u0070\\u0075\\u0062\\u006C\\u0069\\u0063"; CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.DEFAULT.withUnicodeEscapesInterpreted(true)); String[] data = parser...
#vulnerable code public void testUnicodeEscape() throws IOException { String code = "abc,\\u0070\\u0075\\u0062\\u006C\\u0069\\u0063"; CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.DEFAULT.withUnicodeEscapesInterpreted(true)); String[] data = ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCarriageReturnEndings() throws IOException { final String code = "foo\rbaar,\rhello,world\r,kanu"; final CSVParser parser = CSVParser.parse(code, CSVFormat.DEFAULT); final List<CSVRecord> records = parser.getRecords(); ...
#vulnerable code @Test public void testCarriageReturnEndings() throws IOException { final String code = "foo\rbaar,\rhello,world\r,kanu"; final CSVParser parser = CSVParser.parseString(code, CSVFormat.DEFAULT); final List<CSVRecord> records = parser.getRecord...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEmptyLineBehaviourExcel() throws Exception { String[] codes = { "hello,\r\n\r\n\r\n", "hello,\n\n\n", "hello,\"\"\r\n\r\n\r\n", "hello,\"\"\n\n\n" }; String[][] r...
#vulnerable code @Test public void testEmptyLineBehaviourExcel() throws Exception { String[] codes = { "hello,\r\n\r\n\r\n", "hello,\n\n\n", "hello,\"\"\r\n\r\n\r\n", "hello,\"\"\n\n\n" }; String...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReadLine() throws Exception { ExtendedBufferedReader br = getBufferedReader(""); assertNull(br.readLine()); br.close(); br = getBufferedReader("\n"); assertEquals("",br.readLine()); assertNull(br.readL...
#vulnerable code @Test public void testReadLine() throws Exception { ExtendedBufferedReader br = getBufferedReader(""); assertNull(br.readLine()); br = getBufferedReader("\n"); assertEquals("",br.readLine()); assertNull(br.readLine()); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testLineFeedEndings() throws IOException { final String code = "foo\nbaar,\nhello,world\n,kanu"; final CSVParser parser = CSVParser.parse(code, CSVFormat.DEFAULT); final List<CSVRecord> records = parser.getRecords(); asser...
#vulnerable code @Test public void testLineFeedEndings() throws IOException { final String code = "foo\nbaar,\nhello,world\n,kanu"; final CSVParser parser = CSVParser.parseString(code, CSVFormat.DEFAULT); final List<CSVRecord> records = parser.getRecords(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEmptyFile() throws Exception { final CSVParser parser = CSVParser.parse("", CSVFormat.DEFAULT); assertNull(parser.nextRecord()); parser.close(); }
#vulnerable code @Test public void testEmptyFile() throws Exception { final CSVParser parser = CSVParser.parse("", CSVFormat.DEFAULT); assertNull(parser.nextRecord()); } #location 4 #vulnerability type RES...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testBackslashEscaping() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. String...
#vulnerable code @Test public void testBackslashEscaping() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testGetRecords() throws IOException { final CSVParser parser = CSVParser.parseString(CSVINPUT, CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true)); final List<CSVRecord> records = parser.getRecords(); assertEquals(RESULT.length, ...
#vulnerable code @Test public void testGetRecords() throws IOException { final CSVParser parser = new CSVParser(new StringReader(CSVINPUT), CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true)); final List<CSVRecord> records = parser.getRecords(); assertEquals...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSingleLineComment() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withCommentStart('#').build()); printer.printComment("This is a comment"...
#vulnerable code @Test public void testSingleLineComment() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withCommentStart('#').build()); printer.printComment("This is a co...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEndOfFileBehaviourExcel() throws Exception { final String[] codes = { "hello,\r\n\r\nworld,\r\n", "hello,\r\n\r\nworld,", "hello,\r\n\r\nworld,\"\"\r\n", "hello,\r\n\r\nworld,\"\...
#vulnerable code @Test public void testEndOfFileBehaviourExcel() throws Exception { final String[] codes = { "hello,\r\n\r\nworld,\r\n", "hello,\r\n\r\nworld,", "hello,\r\n\r\nworld,\"\"\r\n", "hello,\r\n\r\nwor...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReadLine() throws Exception { ExtendedBufferedReader br = getBufferedReader(""); assertNull(br.readLine()); br.close(); br = getBufferedReader("\n"); assertEquals("",br.readLine()); assertNull(br.readL...
#vulnerable code @Test public void testReadLine() throws Exception { ExtendedBufferedReader br = getBufferedReader(""); assertNull(br.readLine()); br = getBufferedReader("\n"); assertEquals("",br.readLine()); assertNull(br.readLine()); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEndOfFileBehaviorCSV() throws Exception { final String[] codes = { "hello,\r\n\r\nworld,\r\n", "hello,\r\n\r\nworld,", "hello,\r\n\r\nworld,\"\"\r\n", "hello,\r\n\r\nworld,\"\"",...
#vulnerable code @Test public void testEndOfFileBehaviorCSV() throws Exception { final String[] codes = { "hello,\r\n\r\nworld,\r\n", "hello,\r\n\r\nworld,", "hello,\r\n\r\nworld,\"\"\r\n", "hello,\r\n\r\nworld,...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testQuoteNonNumeric() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withQuotePolicy(Quote.NON_NUMERIC).build()); printer.printRecord("a", "b\n...
#vulnerable code @Test public void testQuoteNonNumeric() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.newBuilder().withQuotePolicy(Quote.NON_NUMERIC).build()); printer.printRecord("a"...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testReadLookahead1() throws Exception { ExtendedBufferedReader br = getBufferedReader("1\n2\r3\n"); assertEquals('1', br.lookAhead()); assertEquals(ExtendedBufferedReader.UNDEFINED, br.readAgain()); assertEquals('1', br.read()); ...
#vulnerable code public void testReadLookahead1() throws Exception { assertEquals(ExtendedBufferedReader.END_OF_STREAM, getEBR("").read()); ExtendedBufferedReader br = getEBR("1\n2\r3\n"); assertEquals('1', br.lookAhead()); assertEquals(ExtendedBufferedR...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEmptyLineBehaviourCSV() throws Exception { final String[] codes = { "hello,\r\n\r\n\r\n", "hello,\n\n\n", "hello,\"\"\r\n\r\n\r\n", "hello,\"\"\n\n\n" }; final St...
#vulnerable code @Test public void testEmptyLineBehaviourCSV() throws Exception { final String[] codes = { "hello,\r\n\r\n\r\n", "hello,\n\n\n", "hello,\"\"\r\n\r\n\r\n", "hello,\"\"\n\n\n" }; fi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testSkipUntil() throws Exception { ExtendedBufferedReader br = getEBR(""); assertEquals(0, br.skipUntil(';')); br = getEBR("ABCDEF,GHL,,MN"); assertEquals(6, br.skipUntil(',')); assertEquals(0, br.skipUntil(',')); br.skip(1); assertEqu...
#vulnerable code public void testSkipUntil() throws Exception { br = getEBR(""); assertEquals(0, br.skipUntil(';')); br = getEBR("ABCDEF,GHL,,MN"); assertEquals(6, br.skipUntil(',')); assertEquals(0, br.skipUntil(',')); br.skip(1); assertEquals(3, br.skipUnt...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCSV57() throws Exception { final CSVParser parser = CSVParser.parse("", CSVFormat.DEFAULT); final List<CSVRecord> list = parser.getRecords(); assertNotNull(list); assertEquals(0, list.size()); parser.close(); ...
#vulnerable code @Test public void testCSV57() throws Exception { final CSVParser parser = CSVParser.parse("", CSVFormat.DEFAULT); final List<CSVRecord> list = parser.getRecords(); assertNotNull(list); assertEquals(0, list.size()); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testExcelFormat1() throws IOException { final String code = "value1,value2,value3,value4\r\na,b,c,d\r\n x,,," + "\r\n\r\n\"\"\"hello\"\"\",\" \"\"world\"\"\",\"abc\ndef\",\r\n"; final String[][] r...
#vulnerable code @Test public void testExcelFormat1() throws IOException { final String code = "value1,value2,value3,value4\r\na,b,c,d\r\n x,,," + "\r\n\r\n\"\"\"hello\"\"\",\" \"\"world\"\"\",\"abc\ndef\",\r\n"; final String...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEmptyFile() throws Exception { final CSVParser parser = CSVParser.parseString("", CSVFormat.DEFAULT); assertNull(parser.nextRecord()); }
#vulnerable code @Test public void testEmptyFile() throws Exception { final CSVParser parser = new CSVParser("", CSVFormat.DEFAULT); assertNull(parser.nextRecord()); } #location 4 #vulnerability type RESOU...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testPrintNullValues() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", null, "b"); assertEquals("a,,b" + recordSepa...
#vulnerable code @Test public void testPrintNullValues() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); printer.printRecord("a", null, "b"); assertEquals("a,,b" + reco...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCarriageReturnLineFeedEndings() throws IOException { final String code = "foo\r\nbaar,\r\nhello,world\r\n,kanu"; final CSVParser parser = CSVParser.parse(code, CSVFormat.DEFAULT); final List<CSVRecord> records = parser.getReco...
#vulnerable code @Test public void testCarriageReturnLineFeedEndings() throws IOException { final String code = "foo\r\nbaar,\r\nhello,world\r\n,kanu"; final CSVParser parser = CSVParser.parseString(code, CSVFormat.DEFAULT); final List<CSVRecord> records = pa...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testDefaultFormat() throws IOException { final String code = "" + "a,b#\n" // 1) + "\"\n\",\" \",#\n" // 2) + "#,\"\"\n" // 3) + "# Final comment\n"// 4) ...
#vulnerable code @Test public void testDefaultFormat() throws IOException { final String code = "" + "a,b#\n" // 1) + "\"\n\",\" \",#\n" // 2) + "#,\"\"\n" // 3) + "# Final comment\n"// 4) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static void show(final String msg, final Stats s, final long start) { final long elapsed = System.currentTimeMillis() - start; System.out.printf("%-20s: %5dms %d lines %d fields%n", msg, elapsed, s.count, s.fields); elapsedTimes[num] = elapsed;...
#vulnerable code private static void show(final String msg, final Stats s, final long start) { final long elapsed = System.currentTimeMillis() - start; System.out.printf("%-20s: %5dms " + s.count + " lines "+ s.fields + " fields%n",msg,elapsed); elapsedTimes[num+...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEmptyLineBehaviourCSV() throws Exception { String[] codes = { "hello,\r\n\r\n\r\n", "hello,\n\n\n", "hello,\"\"\r\n\r\n\r\n", "hello,\"\"\n\n\n" }; String[][] res...
#vulnerable code @Test public void testEmptyLineBehaviourCSV() throws Exception { String[] codes = { "hello,\r\n\r\n\r\n", "hello,\n\n\n", "hello,\"\"\r\n\r\n\r\n", "hello,\"\"\n\n\n" }; String[]...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testNextToken3Escaping() throws IOException { /* file: a,\,,b * \,, */ final String code = "a,\\,,b\\\\\n\\,,\\\nc,d\\\r\ne"; final CSVFormat format = formatWithEscaping.toBuilder().withIgnoreEmptyLines(false...
#vulnerable code @Test public void testNextToken3Escaping() throws IOException { /* file: a,\,,b * \,, */ final String code = "a,\\,,b\\\\\n\\,,\\\nc,d\\\r\ne"; final CSVFormat format = CSVFormat.newBuilder().withEscape('\\').withIgnoreE...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testExcelFormat1() throws IOException { final String code = "value1,value2,value3,value4\r\na,b,c,d\r\n x,,," + "\r\n\r\n\"\"\"hello\"\"\",\" \"\"world\"\"\",\"abc\ndef\",\r\n"; final String[][] r...
#vulnerable code @Test public void testExcelFormat1() throws IOException { final String code = "value1,value2,value3,value4\r\na,b,c,d\r\n x,,," + "\r\n\r\n\"\"\"hello\"\"\",\" \"\"world\"\"\",\"abc\ndef\",\r\n"; final String...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testIgnoreEmptyLines() throws IOException { final String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n"; //String code = "world\r\n\n"; //String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n"; final CSVParser parser = CSVPa...
#vulnerable code @Test public void testIgnoreEmptyLines() throws IOException { final String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n"; //String code = "world\r\n\n"; //String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n"; final CSVParser parser =...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test @Ignore public void testBackslashEscapingOld() throws IOException { final String code = "one,two,three\n" + "on\\\"e,two\n" + "on\"e,two\n" + "one,\"tw\\\"o\"\n" ...
#vulnerable code @Test @Ignore public void testBackslashEscapingOld() throws IOException { final String code = "one,two,three\n" + "on\\\"e,two\n" + "on\"e,two\n" + "one,\"tw\\\"o\"\n...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testRemoveAndAddColumns() throws IOException { // do: final CSVPrinter printer = new CSVPrinter(new StringBuilder(), CSVFormat.DEFAULT); final Map<String, String> map = recordWithHeader.toMap(); map.remove("OldColumn"); ...
#vulnerable code @Test public void testRemoveAndAddColumns() throws IOException { // do: final CSVPrinter printer = new CSVPrinter(new StringBuilder(), CSVFormat.DEFAULT); final Map<String, String> map = recordWithHeader.toMap(); map.remove("OldColumn...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testBackslashEscaping2() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. final...
#vulnerable code @Test public void testBackslashEscaping2() throws IOException { // To avoid confusion over the need for escaping chars in java code, // We will test with a forward slash as the escape char, and a single // quote as the encapsulator. ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCarriageReturnEndings() throws IOException { String code = "foo\rbaar,\rhello,world\r,kanu"; CSVParser parser = new CSVParser(new StringReader(code)); List<CSVRecord> records = parser.getRecords(); assertEquals(4, reco...
#vulnerable code @Test public void testCarriageReturnEndings() throws IOException { String code = "foo\rbaar,\rhello,world\r,kanu"; CSVParser parser = new CSVParser(new StringReader(code)); String[][] data = parser.getRecords(); assertEquals(4, data.l...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testReadLine() throws Exception { ExtendedBufferedReader br = getEBR(""); assertTrue(br.readLine() == null); br = getEBR("\n"); assertTrue(br.readLine().equals("")); assertTrue(br.readLine() == null); br = getEBR("foo\n\nhello"); ...
#vulnerable code public void testReadLine() throws Exception { br = getEBR(""); assertTrue(br.readLine() == null); br = getEBR("\n"); assertTrue(br.readLine().equals("")); assertTrue(br.readLine() == null); br = getEBR("foo\n\nhello"); assertEquals(0,...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCSVResource() throws Exception { String line = readTestData(); assertNotNull("file must contain config line", line); final String[] split = line.split(" "); assertTrue(testName + " require 1 param", split.length >= 1);...
#vulnerable code @Test public void testCSVResource() throws Exception { String line = readTestData(); assertNotNull("file must contain config line", line); final String[] split = line.split(" "); assertTrue(testName + " require 1 param", split.length ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testReadLookahead2() throws Exception { char[] ref = new char[5]; char[] res = new char[5]; ExtendedBufferedReader br = getBufferedReader("abcdefg"); ref[0] = 'a'; ref[1] = 'b'; ref[2] = 'c'; assertE...
#vulnerable code public void testReadLookahead2() throws Exception { char[] ref = new char[5]; char[] res = new char[5]; ExtendedBufferedReader br = getEBR(""); assertEquals(0, br.read(res, 0, 0)); assertTrue(Arrays.equals(res, ref)); br...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReadLookahead2() throws Exception { final char[] ref = new char[5]; final char[] res = new char[5]; final ExtendedBufferedReader br = getBufferedReader("abcdefg"); ref[0] = 'a'; ref[1] = 'b'; ref[2] = ...
#vulnerable code @Test public void testReadLookahead2() throws Exception { final char[] ref = new char[5]; final char[] res = new char[5]; final ExtendedBufferedReader br = getBufferedReader("abcdefg"); ref[0] = 'a'; ref[1] = 'b'; ref...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testForEach() { List<String[]> records = new ArrayList<String[]>(); Reader in = new StringReader("a,b,c\n1,2,3\nx,y,z"); for (String[] record : CSVFormat.DEFAULT.parse(in)) { records.add(record); } ...
#vulnerable code public void testForEach() { List<String[]> records = new ArrayList<String[]>(); String code = "a,b,c\n1,2,3\nx,y,z"; Reader in = new StringReader(code); for (String[] record : new CSVParser(in)) { records.add...
Below is the vulnerable code, please generate the patch based on the following information.