* Refreshes the user info from the server. This is necessary if we don't know
* the users id yet.
*
*/
protected void refreshUserIdentity(){
JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();
try {
OsmServerUserInfoReader infoReader = new OsmServerUserInfoReader();
UserInfo info = infoReader.fetchUserInfo(getProgressMonitor().createSubTaskMonitor(1, false));
im.setFullyIdentified(info.getDisplayName(), info);
} catch(OsmTransferException e) {
// retrieving the user info can fail if the current user is not authorised to
// retrieve it, i.e. if he is working with an OAuth Access Token which doesn't
// have the respective privileges or if he didn't or he can't authenticate with
// a username/password-pair.
//
// Downgrade your knowlege about its identity if we've assumed that he was fully
// identified. Otherwise, if he is anonymous or partially identified, keep our level
// of knowlege.
//
if (im.isFullyIdentified()) {
im.setPartiallyIdentified(im.getUserName());
}
Main.warn(tr("Failed to retrieve user infos for the current JOSM user. Exception was: {0}", e.toString()));
}
}