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 2017/03/28 14:02:41 UTC
[jira] [Updated] (CODEC-232) URLCodec is neither immutable nor
threadsafe
[ https://issues.apache.org/jira/browse/CODEC-232?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb updated CODEC-232:
-----------------------
Affects Version/s: 1.10
> URLCodec is neither immutable nor threadsafe
> --------------------------------------------
>
> Key: CODEC-232
> URL: https://issues.apache.org/jira/browse/CODEC-232
> Project: Commons Codec
> Issue Type: Bug
> Affects Versions: 1.10
> Reporter: Sebb
>
> URLCodec Javadoc says the class is immutable and threadsafe.
> However it is not immutable, because of the fields:
> protected static final BitSet WWW_FORM_URL;
> protected String charset;
> Nor is it threadsafe, because external code can change the charset field; changes to the field are not safely published across threads.
> (The WWW_FORM_URL field is no longer used internally).
> The class could be made effectively immutable (and threadsafe) by also saving the initial charset name in a private final field and only using the private field.
> Or the charset field could be made volatile.
> This would preserve the behaviour for subclasses that rely on changing the charset field.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)