[ 
https://issues.apache.org/jira/browse/CODEC-55?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Will Pugh updated CODEC-55:
---------------------------


>Findbugs points out:
>* the field RefinedSoundex.US_ENGLISH_MAPPING needs to be private otherwise it 
>can be changed outside the class.
>* the constructor parameter mapping is externally mutable. The data should be 
>copied to private array.
>
>There are similar problems with the Soundex class.

I noticed these from looking at the code, and don't think we should fix them.  
Reasons are:

    1)  People might have existing code using 
RefinedSoundex.US_ENGLISH_MAPPING, changing scope could break them.  Also, this 
is a crazy thing to expect someone to do.  Someone changing this mapping is 
probably going to break single threaded code as well as multi-threaded code.  
    2)  Right now creating new classes is super quick (probably less than 20 
instructions), adding an array copy in there would slow things down 
considerably to protect against a case that I don't think is very likely, and 
definitely a bad idea in either a single or muliti-threaded environment.

In addition, I think I should revert my change that made URLCodec's charset and 
ESCAPE_CHAR members final.  Existing code may be depending on this, and these 
changes don't help much.  They don't help because:
  1)  ESCAPE_CHAR does not seem to be actually used by URLCodec
  2)  When calling createThreadSafeCodec you are getting an instance, so we 
don't have to worry about the instance being sub-classed and having that 
subclass change charset.  In the case that someone already has a subclass of 
URLCodec, they should be allowed to, but they need to be responsible for making 
sure it's thread safe.

> make all "business" method implementations of public API thread safe 
> ---------------------------------------------------------------------
>
>                 Key: CODEC-55
>                 URL: https://issues.apache.org/jira/browse/CODEC-55
>             Project: Commons Codec
>          Issue Type: Wish
>            Reporter: Qingtian Wang
>         Attachments: concurrentCodecs.diff, concurrentQDiff.diff, 
> urlcodec.patch
>
>
> Maybe most of the implementations are already thread safe. Just such that 
> codec can say so in general...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to