try {
try {
storeItem(request, is, userAttributes);
}
catch (IOException e) {
throw new LocalStorageException("Could not get the content from the ContentLocator!", e);
}
StorageFileItem storedFile = (StorageFileItem) retrieveItem(false, request);
String sha1Hash = storedFile.getRepositoryItemAttributes().get(DigestCalculatingInspector.DIGEST_SHA1_KEY);
String md5Hash = storedFile.getRepositoryItemAttributes().get(DigestCalculatingInspector.DIGEST_MD5_KEY);
if (!StringUtils.isEmpty(sha1Hash)) {
request.setRequestPath(storedFile.getPath() + ".sha1");
storeItem(false, new DefaultStorageFileItem(this, request, true, true, new StringContentLocator(
sha1Hash)));
}
if (!StringUtils.isEmpty(md5Hash)) {
request.setRequestPath(storedFile.getPath() + ".md5");
storeItem(false, new DefaultStorageFileItem(this, request, true, true, new StringContentLocator(
md5Hash)));
}
}
catch (ItemNotFoundException e) {
throw new LocalStorageException("Storage inconsistency!", e);
}
finally {
request.setRequestPath(originalPath);
}
}