Commons CSV
  1. Commons CSV
  2. CSV-49

CSVStrategy has modifiable public static variables

    Details

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

      Description

      The public static variables in CSVStrategy are not final and DEFAULT_STRATEGY, EXCEL_STRATEGY, and TDF_STRATEGY can be modified using setter methods. I would recommend making them all final and using an unmodifiable subclass for the CSVStrategy variables.

      For this change to work, the main CSVStrategy constructor would have to be changed to set the class fields directly instead of using the setters since the unmodifiable subclass will have overwritten all of the setters to thrown UnsupportedOperationExceptions. And I think a copy constructor would also be a good addition to allow easily copying one of these (or any) CSVStrategy objects if any modifications have to be made to them (as an alternative to the clone method).

      1. CSVStrategy_Immutable.patch
        19 kB
        Bob Smith
      2. CSVStrategyAndTests.patch
        11 kB
        Bob Smith

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Bob Smith
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development