in src/main/java/org/apache/sling/installer/core/impl/FileDataStore.java [236:260]
public static String computeDigest(final File data) throws IOException {
try {
final InputStream is = new FileInputStream(data);
try {
final MessageDigest d = MessageDigest.getInstance("MD5");
final byte[] buffer = new byte[8192];
int count = 0;
while( (count = is.read(buffer, 0, buffer.length)) > 0) {
d.update(buffer, 0, count);
}
final String result = digestToString(d);
log.debug("Digest of {} is {}", safePath(data), result);
return result;
} finally {
is.close();
}
} catch (IOException ioe) {
throw ioe;
} catch (Exception ignore) {
final String result = data.toString();
log.debug("Returning fake digest {} for {} due to {}", result, safePath(data), ignore);
return result;
}
}