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:03:41 UTC

[jira] [Resolved] (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 resolved CODEC-232.
------------------------
       Resolution: Fixed
    Fix Version/s: 1.11

URL: http://svn.apache.org/viewvc?rev=1789142&view=rev
Log:
CODEC-232 URLCodec is neither immutable nor threadsafe

Modified:
    commons/proper/codec/trunk/src/changes/changes.xml
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/net/URLCodec.java


> 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
>             Fix For: 1.11
>
>
> 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)