file.getName(),
fileResp.getFileLength()));
} finally {
fileStream.close();
}
FileEnd fileEnd = protocol.read(channel, Protocol.FileEnd.class);
/* Check that the read is successful. */
if (!Arrays.equals(messageDigest.digest(), fileEnd.getDigestSHA1())) {
logger.warning("digest mismatch on file: " + file);
throw new DigestException();
}
/* Now that we know it's good, move the file into place. */