Nuxeo java client

Hi Can someone explain me how to differentiate between a user that has an account and a user that does not have an account in Nuxeo java client? I create a NuxeoClient instance using: NuxeoClient nuxeoClient = new NuxeoClient(URL, userName, password); Apperently if the userName or password does not belong to a real account the NuxeoClient does not return null.What i want to do is to distinguish between a userName that does not have an account so i can show a message that the account does not exist.I think i can do this by catching the Exception it throws but i wanted to know if there is another way

0 votes

1 answers

1498 views

ANSWER



Assuming the password is the correct one for a user, the only way to check if a user exists or not is using the NuxeoClient#connect method and catch the NuxeoClientException:

try {
    NuxeoClient nuxeoClient = new NuxeoClient(URL, userName, password);
} catch (NuxeoClientException e) {
    // user does not exist on the Nuxeo Server (or password is incorrect but user exists...)
}
0 votes