Skip to content

Commit

Permalink
don't create a new buffer for each loop iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
kutzi authored and kohsuke committed Jul 16, 2011
1 parent 3c09a0c commit ff3d287
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/Util.java
Expand Up @@ -521,9 +521,10 @@ public static String getDigestOf(InputStream source) throws IOException {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");

byte[] buffer = new byte[1024];
DigestInputStream in =new DigestInputStream(source,md5);
try {
while(in.read(new byte[1024])>0)
while(in.read(buffer)>0)
; // simply discard the input
} finally {
in.close();
Expand Down

0 comments on commit ff3d287

Please sign in to comment.