* @throws UsersRepositoryException
* If an error occurred
*/
public void updateUser(final User user) throws UsersRepositoryException {
if (user != null && user instanceof JCRUser) {
final JCRUser jcrUser = (JCRUser) user;
final String userName = jcrUser.getUserName();
try {
final Session session = login();
try {
final String name = toSafeName(userName);
final String path = USERS_PATH + "/" + name;
final Node rootNode = session.getRootNode();
try {
final String hashedSaltedPassword = jcrUser.getHashedSaltedPassword();
rootNode.getNode(path).setProperty(PASSWD_PROPERTY, hashedSaltedPassword);
session.save();
} catch (PathNotFoundException e) {
// user not found
getLogger().debug("User not found");