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 e21d66e4 Quote value starting with comment marker in minimal quote
mode (#610).
e21d66e4 is described below
commit e21d66e410cdafca2e822361de5eb6b2596291f2
Author: Gary Gregory <[email protected]>
AuthorDate: Tue Jun 16 21:20:03 2026 +0000
Quote value starting with comment marker in minimal quote mode (#610).
Extract to local variable.
---
src/changes/changes.xml | 1 +
src/test/java/org/apache/commons/csv/CSVPrinterTest.java | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 41b1a038..431da6b5 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -56,6 +56,7 @@
<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">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 -->
<action type="add" dev="ggregory" due-to="Gary Gregory, Indy, Sylvia van
Os" issue="CSV-307">Add an "Android Compatibility" section to the web
site.</action>
<action type="add" dev="ggregory" due-to="Ruiqi Dong, Gary Gregory"
issue="CSV-325">Add CSVParser.Builder.setByteOffset(long) (#604).</action>
diff --git a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
index f4f3c85b..e68d4c24 100644
--- a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
@@ -1842,11 +1842,12 @@ class CSVPrinterTest {
// The marker past the first character does not start a comment,
so only the leading-marker value is quoted.
printer.printRecord("a;b", ";c");
}
+ final String string = sw.toString();
assertEquals("; a real comment" + RECORD_SEPARATOR +
"\";comment-like\",b" + RECORD_SEPARATOR +
- "a;b,\";c\"" + RECORD_SEPARATOR, sw.toString());
+ "a;b,\";c\"" + RECORD_SEPARATOR, string);
// The comment is dropped on read; both data records survive intact.
- try (CSVParser parser = CSVParser.parse(sw.toString(), format)) {
+ try (CSVParser parser = CSVParser.parse(string, format)) {
final List<CSVRecord> records = parser.getRecords();
assertEquals(2, records.size());
assertEquals(col1, records.get(0).get(0));