Aryan Ganjoo created CSV-331:
--------------------------------

             Summary: CSVFormat ignores trim when printing a Reader value
                 Key: CSV-331
                 URL: https://issues.apache.org/jira/browse/CSV-331
             Project: Commons CSV
          Issue Type: Bug
    Affects Versions: 1.14.1
            Reporter: Aryan Ganjoo


CSVFormat.print(Object, Appendable, boolean) documents that values are trimmed 
when trim is enabled, but Reader values bypass that step.

Reproduced on 1.14.1 and current master (584a79a0):

{code:java}
StringBuilder out = new StringBuilder();
CSVFormat.ORACLE.print(new StringReader("  Alice  "), out, true);
System.out.println(out);
// Actual:   "  Alice  "
// Expected: "Alice"
{code}

ORACLE has trim enabled. Passing the same content as a String trims it; passing 
a Reader retains both spaces. The quotes themselves are expected for Reader 
values.

Happy to help with a fix and regression tests. Is trimming Reader values here 
the intended behavior?

Prepared with AI assistance.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to