Menu

#257 Handling of regex-unsafe separators is broken since version 5.8

v1.0 (example)
closed-fixed
None
5
2025-05-29
2025-04-10
No

The commit at https://sourceforge.net/p/opencsv/source/ci/c20025253285ab42c1032f54c69370fff78b6ea3/ introduced a regression in how regex-unsafe separators are parsed, because it introduced code that confuses separator byte with its regex-escaped string version. Currently this test fails:

    @Test
    public void parseToLineUsesCorrectSeparator() {
        CSVParserBuilder builder = new CSVParserBuilder();
        ICSVParser parser = builder.withSeparator('.').withQuoteChar('\'').build();

        String[] items = {"This", " is", " a", " test."};
        assertEquals("This. is. a.' test.'", parser.parseToLine(items, false));
    }

Fix with test: https://sourceforge.net/p/opencsv/source/merge-requests/37/

Discussion

  • Scott Conway

    Scott Conway - 2025-04-17
    • status: open --> pending
    • assigned_to: Scott Conway
     
  • Scott Conway

    Scott Conway - 2025-04-17

    Hello Piotr - I have merged your fix in and will try to get it deployed this weekend but with the holidays and family coming in it will probably be in May before I can get it out.

    I want to thank you for writing such a good test that perfectly demonstrated the problem. It quickly enabled me to try different configurations (like strict quotes) and the RFC4180Parser to quickly find that this is indeed a problem and went ahead and merged your fix.

    And thank you for running all the integration tests - even the ones that don't normally run. After the release I will go through and clean up those tests. A Lot of the integration tests that don't run were tests I created to test issues or questions raised by developers but got left for lack of response. I will go through the tests to see what is a duplicate or not for issues that I closed and delete those tests.

     
    ❤️
    1
  • Scott Conway

    Scott Conway - 2025-05-29
    • status: pending --> closed-fixed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.