On Tue, Apr 14, 2009 at 7:41 PM, <saces at freenetproject.org> wrote: > Author: saces > Date: 2009-04-14 11:41:51 +0000 (Tue, 14 Apr 2009) > New Revision: 26781 > > Modified: > ? trunk/freenet/src/freenet/pluginmanager/PluginManager.java > Log: > grab SHA-256 digest from pool
You should return it to pool after use. > > Modified: trunk/freenet/src/freenet/pluginmanager/PluginManager.java > =================================================================== > --- trunk/freenet/src/freenet/pluginmanager/PluginManager.java ?2009-04-14 > 11:16:26 UTC (rev 26780) > +++ trunk/freenet/src/freenet/pluginmanager/PluginManager.java ?2009-04-14 > 11:41:51 UTC (rev 26781) > @@ -32,6 +32,7 @@ > ?import freenet.config.Config; > ?import freenet.config.InvalidConfigValueException; > ?import freenet.config.SubConfig; > +import freenet.crypt.SHA256; > ?import freenet.keys.FreenetURI; > ?import freenet.l10n.L10n; > ?import freenet.l10n.L10n.LANGUAGE; > @@ -984,7 +985,11 @@ > ? ? ? ? ? ? ? ?BufferedInputStream bis = null; > > ? ? ? ? ? ? ? ?try { > - ? ? ? ? ? ? ? ? ? ? ? hash = MessageDigest.getInstance(digest); > + ? ? ? ? ? ? ? ? ? ? ? if ("SHA-256".equals(digest)) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? hash = SHA256.getMessageDigest(); // grab > digest from pool > + ? ? ? ? ? ? ? ? ? ? ? } else { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? hash = MessageDigest.getInstance(digest); > + ? ? ? ? ? ? ? ? ? ? ? } > ? ? ? ? ? ? ? ? ? ? ? ?// We compute the hash > ? ? ? ? ? ? ? ? ? ? ? ?// > http://java.sun.com/developer/TechTips/1998/tt0915.html#tip2 > ? ? ? ? ? ? ? ? ? ? ? ?fis = new FileInputStream(file); > @@ -995,7 +1000,7 @@ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?hash.update(buffer, 0, len); > ? ? ? ? ? ? ? ? ? ? ? ?} > ? ? ? ? ? ? ? ?} catch(Exception e) { > - ? ? ? ? ? ? ? ? ? ? ? throw new PluginNotFoundException("Error while > computing sha1 hash of the downloaded plugin: " + e, e); > + ? ? ? ? ? ? ? ? ? ? ? throw new PluginNotFoundException("Error while > computing hash '"+digest+"' of the downloaded plugin: " + e, e); > ? ? ? ? ? ? ? ?} finally { > ? ? ? ? ? ? ? ? ? ? ? ?Closer.close(bis); > ? ? ? ? ? ? ? ? ? ? ? ?Closer.close(fis); > > _______________________________________________ > cvs mailing list > cvs at freenetproject.org > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs >