InputStream is = openFileForReading(file); try { while (true) { int b = is.read(); if (b < 0) { break; } digest.update((byte) (b & 0xFF)); } } catch (IOException e) { SVNErrorManager.error("svn: I/O error while computing checksum for '" + file + "'"); } finally { closeFile(is);
if (digest == null) { return null;
    public static String computeChecksum(File file) throws SVNException {        if (file == null || !file.exists() || file.isDirectory()) {            return null;        }        MessageDigest digest;        try {            digest = MessageDigest.getInstance("MD5");        } catch (NoSuchAlgorithmException e) {            SVNErrorManager.error("svn: MD5 algorithm implementation not found");            return null;        }        InputStream is = openFileForReading(file);        try {            while (true) {                int b = is.read();                if (b < 0) {                    break;                }                digest.update((byte) (b & 0xFF));            }        } catch (IOException e) {            SVNErrorManager.error("svn: I/O error while computing checksum for '" + file + "'");        } finally {            closeFile(is);        }        return toHexDigest(digest);    }