Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0
    • Component/s: Printer
    • Labels:
      None

      Description

      CSVPrinter has a lot of problems to fix, from efficiency, to not producing well-formed CSV.

      1. SANDBOX-322.patch
        34 kB
        Yonik Seeley

        Activity

        Hide
        Yonik Seeley added a comment -

        committed.

        Show
        Yonik Seeley added a comment - committed.
        Hide
        Yonik Seeley added a comment -

        Patch attached. Overview of changes:

        • CSVPrinter no longer wraps the provided writer in a PrintWriter... the reason is that the passed writer can often be more efficient than PrintWriter.
        • CSVPrinter no longer flushes all of the time - that should be up to the user
        • users have access to the lowest level if desired... ability to pass a char[] + length/offset
        • rewrote the output methods: writing no longer uses a StringBuffer, and writes are done in big chunks, not character-by-character
        • removed the use of the system property "line.separator" - local specific behavior should normally be avoided. A printerNewline was added to the strategy instead.
        • in CSVParser, only throw away leading whitespace if the strategy calls for it
        • added round-trip testing with random strings to ensure that encapsulation and escaping strategies can be both correctly encoded and then decoded with no loss of information.

        During testing, I hit an issue where the tests ran fine in my IDE, but failed for "mvn test". I tracked this down to the fact that many tests were actually changing the default strategy object. This test code was changed to make a clone if they were going to change it.

        Show
        Yonik Seeley added a comment - Patch attached. Overview of changes: CSVPrinter no longer wraps the provided writer in a PrintWriter... the reason is that the passed writer can often be more efficient than PrintWriter. CSVPrinter no longer flushes all of the time - that should be up to the user users have access to the lowest level if desired... ability to pass a char[] + length/offset rewrote the output methods: writing no longer uses a StringBuffer, and writes are done in big chunks, not character-by-character removed the use of the system property "line.separator" - local specific behavior should normally be avoided. A printerNewline was added to the strategy instead. in CSVParser, only throw away leading whitespace if the strategy calls for it added round-trip testing with random strings to ensure that encapsulation and escaping strategies can be both correctly encoded and then decoded with no loss of information. During testing, I hit an issue where the tests ran fine in my IDE, but failed for "mvn test". I tracked this down to the fact that many tests were actually changing the default strategy object. This test code was changed to make a clone if they were going to change it.

          People

          • Assignee:
            Unassigned
            Reporter:
            Yonik Seeley
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development