.setData(encryptedUserProfile).setProtectionKeys(entry.getUserProfile().getProtectionKeys())
.setTTL(entry.getUserProfile().getTimeToLive());
boolean success = dataManager.put(parameters);
if (!success) {
entry.setPutError(new PutFailedException("Put failed."));
} else {
// cache user profile
cachedUserProfile = entry.getUserProfile();
cachedUserProfile.setBasedOnKey(encryptedUserProfile.getBasedOnKey());
cachedUserProfile.setVersionKey(encryptedUserProfile.getVersionKey());
}
} catch (DataLengthException | IllegalStateException | InvalidCipherTextException | IOException e) {
logger.error("Cannot encrypt the user profile. reason = '{}'", e.getMessage());
entry.setPutError(new PutFailedException(String.format("Cannot encrypt the user profile. reason = '%s'",
e.getMessage())));
} finally {
entry.notifyPut();
}
}