You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2009/02/08 16:50:59 UTC
[jira] Commented: (SANDBOX-279) CSVStrategy has modifiable public
static variables
[ https://issues.apache.org/jira/browse/SANDBOX-279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12671631#action_12671631 ]
Sebb commented on SANDBOX-279:
------------------------------
+1
I'm not sure there is a use-case for changing the CSV Strategy once it has been created.
I would make all the fields final, and only allow them to be set via the constructor. This would make the class immutable, and therefore thread-safe.
The deprecated constructor could also be dispensed with.
> CSVStrategy has modifiable public static variables
> --------------------------------------------------
>
> Key: SANDBOX-279
> URL: https://issues.apache.org/jira/browse/SANDBOX-279
> Project: Commons Sandbox
> Issue Type: Improvement
> Components: CSV
> Affects Versions: Nightly Builds
> Reporter: Bob Smith
> Priority: Minor
> Attachments: CSVStrategyAndTests.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.
-
You can reply to this email to add a comment to the issue online.