This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git
The following commit(s) were added to refs/heads/master by this push:
new ed8dbf25 Clear escape delimiter buffer before peek in
Lexer.isEscapeDelimiter() (#608, #611).
ed8dbf25 is described below
commit ed8dbf25ad73856cfa10cba4f5e9855fdcae0d88
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Jun 17 12:08:58 2026 +0000
Clear escape delimiter buffer before peek in Lexer.isEscapeDelimiter()
(#608, #611).
Refactor magic strings in tests
---
src/changes/changes.xml | 2 +-
src/test/java/org/apache/commons/csv/CSVParserTest.java | 5 +++--
src/test/java/org/apache/commons/csv/LexerTest.java | 5 +++--
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 431da6b5..66073c9d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -54,7 +54,7 @@
<action type="fix" dev="ggregory" due-to="Ruiqi Dong, Gary Gregory"
issue="CSV-326">CSVPrinter Reader printing with quote and escape can emit CSV
that its parser cannot read back.</action>
<action type="fix" dev="ggregory" due-to="Ruiqi Dong, Gary Gregory"
issue="CSV-327">CSVParser applies maxRows to record numbers instead of rows
produced when setRecordNumber(...) is used.</action>
<action type="fix" dev="ggregory" due-to="OldTruckDriver, Gary Gregory"
issue="CSV-326">Escape Reader values with quote and escape (#606).</action>
- <action type="fix" dev="ggregory" due-to="Dexter.k, Gary Gregory">Clear
escape delimiter buffer before peek in isEscapeDelimiter (#608).</action>
+ <action type="fix" dev="ggregory" due-to="Dexter.k, Gary Gregory">Clear
escape delimiter buffer before peek in Lexer.isEscapeDelimiter() (#608,
#611).</action>
<action type="fix" dev="ggregory" due-to="Dexter.k, Gary Gregory">Escape
quote char in printWithEscapes when QuoteMode is NONE (#609).</action>
<action type="fix" dev="ggregory" due-to="Dexter.k, Gary Gregory">Quote
value starting with comment marker in minimal quote mode (#610)..</action>
<!-- ADD -->
diff --git a/src/test/java/org/apache/commons/csv/CSVParserTest.java
b/src/test/java/org/apache/commons/csv/CSVParserTest.java
index c1ca3d7a..5bece571 100644
--- a/src/test/java/org/apache/commons/csv/CSVParserTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVParserTest.java
@@ -1704,9 +1704,10 @@ class CSVParserTest {
void testPartialMultiCharacterDelimiterAtEOFAfterMismatch() throws
IOException {
final CSVFormat format =
CSVFormat.DEFAULT.builder().setDelimiter("[|]").get();
// The "[a]" peek leaves ']' in the look-ahead buffer; the trailing
"[|" must not match "[|]".
- try (CSVParser parser = format.parse(new StringReader("x[a][|"))) {
+ final String recordString = "x[a][|";
+ try (CSVParser parser = format.parse(new StringReader(recordString))) {
final CSVRecord record = parser.nextRecord();
- assertEquals("x[a][|", record.get(0));
+ assertEquals(recordString, record.get(0));
assertEquals(1, record.size());
}
}
diff --git a/src/test/java/org/apache/commons/csv/LexerTest.java
b/src/test/java/org/apache/commons/csv/LexerTest.java
index e5f831fb..db1ab3a6 100644
--- a/src/test/java/org/apache/commons/csv/LexerTest.java
+++ b/src/test/java/org/apache/commons/csv/LexerTest.java
@@ -441,8 +441,9 @@ class LexerTest {
void testPartialMultiCharacterDelimiterAtEOFAfterMismatch() throws
IOException {
final CSVFormat format =
CSVFormat.DEFAULT.builder().setDelimiter("[|]").get();
// The "[a]" peek leaves ']' in the look-ahead buffer; the trailing
"[|" must not match "[|]".
- try (Lexer lexer = createLexer("x[a][|", format)) {
- assertNextToken(EOF, "x[a][|", lexer);
+ final String recordString = "x[a][|";
+ try (Lexer lexer = createLexer(recordString, format)) {
+ assertNextToken(EOF, recordString, lexer);
}
}