hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clinton Nielsen (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCLIENT-1245) org.apache.http.impl.client.cache.memcached.SHA256KeyHashingScheme use of MessageDigest should be synchronized
Date Thu, 04 Oct 2012 20:53:47 GMT
Clinton Nielsen created HTTPCLIENT-1245:
-------------------------------------------

             Summary: org.apache.http.impl.client.cache.memcached.SHA256KeyHashingScheme use
of MessageDigest should be synchronized
                 Key: HTTPCLIENT-1245
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1245
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: Cache
    Affects Versions: 4.2.1
            Reporter: Clinton Nielsen


Function:

    public String hash(String key) {
        MessageDigest md = getDigest();
        md.update(key.getBytes());
        return Hex.encodeHexString(md.digest());
    }


Should be rewritten to synchronize access to the MessageDigest object:

	public String hash(String key) {
        MessageDigest md = getDigest();
        byte[] digest = null;
        synchronized(md) {
        	md.update(key.getBytes());
        	digest = md.digest();
        }
        return Hex.encodeHexString(digest);
    }



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message