commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (Resolved) (JIRA)" <>
Subject [jira] [Resolved] (SANDBOX-279) CSVStrategy has modifiable public static variables
Date Wed, 09 Nov 2011 16:27:51 GMT


Emmanuel Bourg resolved SANDBOX-279.

       Resolution: Fixed
    Fix Version/s: CSV 1.0

The static fields are now final and the class is immutable. I followed the suggestion of Stephen
Colebourne to use chained withXXX setters cloning the instance on the fly.
> CSVStrategy has modifiable public static variables
> --------------------------------------------------
>                 Key: SANDBOX-279
>                 URL:
>             Project: Commons Sandbox
>          Issue Type: Improvement
>          Components: CSV
>    Affects Versions: Nightly Builds
>            Reporter: Bob Smith
>            Priority: Minor
>             Fix For: CSV 1.0
>         Attachments: CSVStrategyAndTests.patch, CSVStrategy_Immutable.patch
> 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).

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message