connection.setRequestMethod("GET");
sign(connection);
connection.connect();
if (connection.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED)
throw new OsmApiException(HttpURLConnection.HTTP_UNAUTHORIZED, tr("Retrieving user details with Access Token Key ''{0}'' was rejected.", token.getKey()), null);
if (connection.getResponseCode() == HttpURLConnection.HTTP_FORBIDDEN)
throw new OsmApiException(HttpURLConnection.HTTP_FORBIDDEN, tr("Retrieving user details with Access Token Key ''{0}'' was forbidden.", token.getKey()), null);
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK)
throw new OsmApiException(connection.getResponseCode(),connection.getHeaderField("Error"), null);
Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(connection.getInputStream());
return OsmServerUserInfoReader.buildFromXML(d);
} catch(SAXException | ParserConfigurationException e) {
throw new XmlParsingException(e);
} catch(IOException e) {