LdapClient client = null;
try {
// ensure that the email address is valid, update the profile
CredentialPolicy policy = new CredentialPolicy();
policy.validateEmailPolicy(user.getProfile().getEmailAddress());
client = newServiceConnection();
client.getEditFunctions().updateUserProfile(
client.getConnectedContext(),user,false,false);
} finally {
if (client != null) client.close();