harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Loenko (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-496) Thread unsafe lazy instantiation of static field : javax.crypto
Date Fri, 21 Jul 2006 10:35:15 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-496?page=all ]

Mikhail Loenko closed HARMONY-496.
----------------------------------

    Resolution: Invalid
      Assignee: Mikhail Loenko

in both cases the spec does not require us to be thread-safe

> Thread unsafe lazy instantiation of static field : javax.crypto
> ---------------------------------------------------------------
>
>                 Key: HARMONY-496
>                 URL: http://issues.apache.org/jira/browse/HARMONY-496
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Mikhail Fursov
>         Assigned To: Mikhail Loenko
>            Priority: Minor
>
> In classes 
> javax.crypto.Cypher :
> public final void init(int opmode, Key key) throws InvalidKeyException {
>         if (sec_rand == null) {
>             sec_rand = new SecureRandom();
>         }
>         init(opmode, key, sec_rand);)
> and 
> org.apache.harmony.beans.ArrayPersistenceDelegate:
>  public static PersistenceDelegate getInstance() {
>         if(pd == null) {
>             pd = new ArrayPersistenceDelegate();
>         }
>         return pd;
>     }
> static field initialization is not guarded by synchronization block. So in multithreaded
environment the behaviour of these methods may be wrong.
> I propose to replace lazy instantiation of the 'sec_rand'  variable in javax.crypto.Cypher
with instantiation during class initializer call
> and to use DCL (double checking locking) and synchronization into org.apache.harmony.beans.ArrayPersistenceDelegate
class.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message