Index: /trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java	(revision 5421)
+++ /trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java	(revision 5422)
@@ -18,4 +18,5 @@
 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
 import org.openstreetmap.josm.gui.help.HelpUtil;
+import org.openstreetmap.josm.io.OsmApi;
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.OpenBrowser;
@@ -38,5 +39,5 @@
      */
     static public String getBaseBrowseUrl() {
-        String baseUrl = Main.pref.get("osm-server.url", "http://api.openstreetmap.org/api");
+        String baseUrl = Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL);
         Pattern pattern = Pattern.compile("/api/?$");
         String ret =  pattern.matcher(baseUrl).replaceAll("/browse");
@@ -57,5 +58,5 @@
      */
     static public String getBaseUserUrl() {
-        String baseUrl = Main.pref.get("osm-server.url", "http://api.openstreetmap.org/api");
+        String baseUrl = Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL);
         Pattern pattern = Pattern.compile("/api/?$");
         String ret =  pattern.matcher(baseUrl).replaceAll("/user");
Index: /trunk/src/org/openstreetmap/josm/data/oauth/OAuthParameters.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/oauth/OAuthParameters.java	(revision 5421)
+++ /trunk/src/org/openstreetmap/josm/data/oauth/OAuthParameters.java	(revision 5422)
@@ -1,4 +1,7 @@
 // License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.data.oauth;
+
+import java.net.MalformedURLException;
+import java.net.URL;
 
 import oauth.signpost.OAuthConsumer;
@@ -8,16 +11,32 @@
 
 import org.openstreetmap.josm.data.Preferences;
+import org.openstreetmap.josm.io.OsmApi;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 
 /**
  * This class manages a set of OAuth parameters.
- *
+ * @since 2747
  */
 public class OAuthParameters {
 
+    /**
+     * The default JOSM OAuth consumer key.
+     */
     static public final String DEFAULT_JOSM_CONSUMER_KEY = "AdCRxTpvnbmfV8aPqrTLyA";
+    /**
+     * The default JOSM OAuth consumer secret.
+     */
     static public final String DEFAULT_JOSM_CONSUMER_SECRET = "XmYOiGY9hApytcBC3xCec3e28QBqOWz5g6DSb5UpE";
+    /**
+     * The default OSM OAuth request token URL.
+     */
     static public final String DEFAULT_REQUEST_TOKEN_URL = "http://www.openstreetmap.org/oauth/request_token";
+    /**
+     * The default OSM OAuth access token URL.
+     */
     static public final String DEFAULT_ACCESS_TOKEN_URL = "http://www.openstreetmap.org/oauth/access_token";
+    /**
+     * The default OSM OAuth authorize URL.
+     */
     static public final String DEFAULT_AUTHORISE_URL = "http://www.openstreetmap.org/oauth/authorize";
 
@@ -25,15 +44,41 @@
     /**
      * Replies a set of default parameters for a consumer accessing the standard OSM server
-     * at http://api.openstreetmap.org/api
+     * at {@link OsmApi#DEFAULT_API_URL}.
      *
      * @return a set of default parameters
      */
     static public OAuthParameters createDefault() {
+        return createDefault(null);
+    }
+
+    /**
+     * Replies a set of default parameters for a consumer accessing an OSM server
+     * at the given API url. URL parameters are only set if the URL equals {@link OsmApi#DEFAULT_API_URL}
+     * or references the domain "dev.openstreetmap.org", otherwise they may be <code>null</code>.
+     * 
+     * @param apiUrl The API URL for which the OAuth default parameters are created. If null or empty, the default OSM API url is used.
+     * @return a set of default parameters for the given {@code apiUrl}
+     * @since 5422
+     */
+    static public OAuthParameters createDefault(String apiUrl) {
         OAuthParameters parameters = new OAuthParameters();
         parameters.setConsumerKey(DEFAULT_JOSM_CONSUMER_KEY);
         parameters.setConsumerSecret(DEFAULT_JOSM_CONSUMER_SECRET);
-        parameters.setRequestTokenUrl(DEFAULT_REQUEST_TOKEN_URL);
-        parameters.setAccessTokenUrl(DEFAULT_ACCESS_TOKEN_URL);
-        parameters.setAuthoriseUrl(DEFAULT_AUTHORISE_URL);
+        if (apiUrl == null || apiUrl.isEmpty() || apiUrl.equals(OsmApi.DEFAULT_API_URL)) {
+            parameters.setRequestTokenUrl(DEFAULT_REQUEST_TOKEN_URL);
+            parameters.setAccessTokenUrl(DEFAULT_ACCESS_TOKEN_URL);
+            parameters.setAuthoriseUrl(DEFAULT_AUTHORISE_URL);
+        } else {
+            try {
+                String host = new URL(apiUrl).getHost();
+                if (host.endsWith("dev.openstreetmap.org")) {
+                    parameters.setRequestTokenUrl(DEFAULT_REQUEST_TOKEN_URL.replace("www.openstreetmap.org", host));
+                    parameters.setAccessTokenUrl(DEFAULT_ACCESS_TOKEN_URL.replace("www.openstreetmap.org", host));
+                    parameters.setAuthoriseUrl(DEFAULT_AUTHORISE_URL.replace("www.openstreetmap.org", host));
+                }
+            } catch (MalformedURLException e) {
+                // Ignored
+            }
+        }
         return parameters;
     }
@@ -48,5 +93,5 @@
         boolean useDefault = pref.getBoolean("oauth.settings.use-default", true );
         if (useDefault)
-            return createDefault();
+            return createDefault(pref.get("osm-server.url"));
         OAuthParameters parameters = new OAuthParameters();
         parameters.setConsumerKey(pref.get("oauth.settings.consumer-key", ""));
@@ -78,4 +123,10 @@
     private String authoriseUrl;
 
+    /**
+     * Constructs a new, unitialized, {@code OAuthParameters}.
+     * 
+     * @see #createDefault
+     * @see #createFromPreferences
+     */
     public OAuthParameters() {
     }
@@ -96,31 +147,80 @@
     }
 
+    /**
+     * Gets the consumer key.
+     * @return The consumer key
+     */
     public String getConsumerKey() {
         return consumerKey;
     }
+    
+    /**
+     * Sets the consumer key.
+     * @param consumerKey The consumer key
+     */
     public void setConsumerKey(String consumerKey) {
         this.consumerKey = consumerKey;
     }
+    
+    /**
+     * Gets the consumer secret. 
+     * @return The consumer secret
+     */
     public String getConsumerSecret() {
         return consumerSecret;
     }
+    
+    /**
+     * Sets the consumer secret.
+     * @param consumerSecret The consumer secret
+     */
     public void setConsumerSecret(String consumerSecret) {
         this.consumerSecret = consumerSecret;
     }
+    
+    /**
+     * Gets the request token URL.
+     * @return The request token URL
+     */
     public String getRequestTokenUrl() {
         return requestTokenUrl;
     }
+    
+    /**
+     * Sets the request token URL.
+     * @param requestTokenUrl the request token URL
+     */
     public void setRequestTokenUrl(String requestTokenUrl) {
         this.requestTokenUrl = requestTokenUrl;
     }
+    
+    /**
+     * Gets the access token URL.
+     * @return The access token URL
+     */
     public String getAccessTokenUrl() {
         return accessTokenUrl;
     }
+    
+    /**
+     * Sets the access token URL.
+     * @param accessTokenUrl The access token URL
+     */
     public void setAccessTokenUrl(String accessTokenUrl) {
         this.accessTokenUrl = accessTokenUrl;
     }
+    
+    /**
+     * Gets the authorise URL.
+     * @return The authorise URL
+     */
     public String getAuthoriseUrl() {
         return authoriseUrl;
     }
+    
+    /**
+     * Sets the authorise URL.
+     * @param authoriseUrl The authorise URL
+     */
     public void setAuthoriseUrl(String authoriseUrl) {
         this.authoriseUrl = authoriseUrl;
@@ -128,11 +228,10 @@
 
     /**
-     * Builds an {@link OAuthConsumer} based on these parameters
+     * Builds an {@link OAuthConsumer} based on these parameters.
      *
      * @return the consumer
      */
     public OAuthConsumer buildConsumer() {
-        OAuthConsumer consumer = new DefaultOAuthConsumer(consumerKey, consumerSecret);
-        return consumer;
+        return new DefaultOAuthConsumer(consumerKey, consumerSecret);
     }
 
@@ -142,5 +241,5 @@
      * @param consumer the consumer. Must not be null.
      * @return the provider
-     * @throws IllegalArgumentException thrown if consumer is null
+     * @throws IllegalArgumentException if consumer is null
      */
     public OAuthProvider buildProvider(OAuthConsumer consumer) throws IllegalArgumentException {
@@ -153,6 +252,10 @@
     }
 
+    /**
+     * Saves these OAuth parameters to the given {@code Preferences}.
+     * @param pref The Preferences into which are saved these OAuth parameters with the prefix "oauth.settings"
+     */
     public void saveToPreferences(Preferences pref) {
-        if (this.equals(createDefault())) {
+        if (this.equals(createDefault(pref.get("osm-server.url")))) {
             pref.put("oauth.settings.use-default", true );
             clearPreferences(pref);
Index: /trunk/src/org/openstreetmap/josm/gui/oauth/AbstractAuthorizationUI.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/oauth/AbstractAuthorizationUI.java	(revision 5421)
+++ /trunk/src/org/openstreetmap/josm/gui/oauth/AbstractAuthorizationUI.java	(revision 5422)
@@ -11,7 +11,7 @@
  * This is the abstract base class for the three authorisation UIs.
  *
- *
+ * @since 2746
  */
-public abstract class AbstractAuthorizationUI extends VerticallyScrollablePanel{
+public abstract class AbstractAuthorizationUI extends VerticallyScrollablePanel {
     /**
      * The property name for the Access Token property
@@ -20,5 +20,5 @@
 
     private String apiUrl;
-    private AdvancedOAuthPropertiesPanel pnlAdvancedProperties;
+    private final AdvancedOAuthPropertiesPanel pnlAdvancedProperties;
     private OAuthToken accessToken;
 
@@ -27,6 +27,12 @@
     }
 
-    public AbstractAuthorizationUI() {
+    /**
+     * Constructs a new {@code AbstractAuthorizationUI} for the given API URL.
+     * @param apiUrl The OSM API URL
+     * @since 5422
+     */
+    public AbstractAuthorizationUI(String apiUrl) {
         pnlAdvancedProperties = new AdvancedOAuthPropertiesPanel();
+        setApiUrl(apiUrl);
     }
 
@@ -49,4 +55,5 @@
     public void setApiUrl(String apiUrl) {
         this.apiUrl = apiUrl;
+        this.pnlAdvancedProperties.setApiUrl(apiUrl);
     }
 
Index: /trunk/src/org/openstreetmap/josm/gui/oauth/AdvancedOAuthPropertiesPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/oauth/AdvancedOAuthPropertiesPanel.java	(revision 5421)
+++ /trunk/src/org/openstreetmap/josm/gui/oauth/AdvancedOAuthPropertiesPanel.java	(revision 5422)
@@ -27,4 +27,15 @@
 import org.openstreetmap.josm.tools.ImageProvider;
 
+/**
+ * Panel allowing the user to setup advanced OAuth parameters:
+ * <li>Consumer key</li>
+ * <li>Consumer secret</li>
+ * <li>Request token URL</li>
+ * <li>Access token URL</li>
+ * <li>Authorize URL</li>
+ * 
+ * @see OAuthParameters
+ * @since 2746
+ */
 public class AdvancedOAuthPropertiesPanel extends VerticallyScrollablePanel {
 
@@ -36,4 +47,5 @@
     private JTextField tfAuthoriseURL;
     private UseDefaultItemListener ilUseDefault;
+    private String apiUrl;
 
     protected void build() {
@@ -110,10 +122,11 @@
 
     protected boolean hasCustomSettings() {
+        OAuthParameters params = OAuthParameters.createDefault(apiUrl);
         return
-        ! tfConsumerKey.getText().equals( OAuthParameters.DEFAULT_JOSM_CONSUMER_KEY)
-        || ! tfConsumerSecret.getText().equals( OAuthParameters.DEFAULT_JOSM_CONSUMER_SECRET)
-        || ! tfRequestTokenURL.getText().equals( OAuthParameters.DEFAULT_REQUEST_TOKEN_URL)
-        || ! tfAccessTokenURL.getText().equals( OAuthParameters.DEFAULT_ACCESS_TOKEN_URL)
-        || ! tfAuthoriseURL.getText().equals( OAuthParameters.DEFAULT_AUTHORISE_URL);
+           ! tfConsumerKey.getText().equals(params.getConsumerKey())
+        || ! tfConsumerSecret.getText().equals(params.getConsumerSecret())
+        || ! tfRequestTokenURL.getText().equals(params.getRequestTokenUrl())
+        || ! tfAccessTokenURL.getText().equals(params.getAccessTokenUrl())
+        || ! tfAuthoriseURL.getText().equals(params.getAuthoriseUrl());
     }
 
@@ -152,9 +165,10 @@
     protected void resetToDefaultSettings() {
         cbUseDefaults.setSelected(true);
-        tfConsumerKey.setText( OAuthParameters.DEFAULT_JOSM_CONSUMER_KEY);
-        tfConsumerSecret.setText( OAuthParameters.DEFAULT_JOSM_CONSUMER_SECRET);
-        tfRequestTokenURL.setText(OAuthParameters.DEFAULT_REQUEST_TOKEN_URL);
-        tfAccessTokenURL.setText(OAuthParameters.DEFAULT_ACCESS_TOKEN_URL);
-        tfAuthoriseURL.setText(OAuthParameters.DEFAULT_AUTHORISE_URL);
+        OAuthParameters params = OAuthParameters.createDefault(apiUrl);
+        tfConsumerKey.setText(params.getConsumerKey());
+        tfConsumerSecret.setText(params.getConsumerSecret());
+        tfRequestTokenURL.setText(params.getRequestTokenUrl());
+        tfAccessTokenURL.setText(params.getAccessTokenUrl());
+        tfAuthoriseURL.setText(params.getAuthoriseUrl());
 
         setChildComponentsEnabled(false);
@@ -176,5 +190,5 @@
     public OAuthParameters getAdvancedParameters() {
         if (cbUseDefaults.isSelected())
-            return OAuthParameters.createDefault();
+            return OAuthParameters.createDefault(apiUrl);
         OAuthParameters parameters = new OAuthParameters();
         parameters.setConsumerKey(tfConsumerKey.getText());
@@ -194,5 +208,5 @@
     public void setAdvancedParameters(OAuthParameters parameters) throws IllegalArgumentException{
         CheckParameterUtil.ensureParameterNotNull(parameters, "parameters");
-        if (parameters.equals(OAuthParameters.createDefault())) {
+        if (parameters.equals(OAuthParameters.createDefault(apiUrl))) {
             cbUseDefaults.setSelected(true);
             setChildComponentsEnabled(false);
@@ -208,4 +222,7 @@
     }
 
+    /**
+     * Constructs a new {@code AdvancedOAuthPropertiesPanel}.
+     */
     public AdvancedOAuthPropertiesPanel() {
         build();
@@ -218,6 +235,7 @@
      * @throws IllegalArgumentException thrown if pref is null
      */
-    public void initFromPreferences(Preferences pref) throws IllegalArgumentException{
+    public void initFromPreferences(Preferences pref) throws IllegalArgumentException {
         CheckParameterUtil.ensureParameterNotNull(pref, "pref");
+        setApiUrl(pref.get("osm-server-url"));
         boolean useDefault = pref.getBoolean("oauth.settings.use-default", true);
         ilUseDefault.setEnabled(false);
@@ -265,5 +283,5 @@
         public void itemStateChanged(ItemEvent e) {
             if (!enabled) return;
-            switch(e.getStateChange()) {
+            switch (e.getStateChange()) {
             case ItemEvent.SELECTED:
                 if (hasCustomSettings()) {
@@ -285,3 +303,16 @@
         }
     }
+
+    /**
+     * Sets the URL of the OSM API for which this panel is currently displaying OAuth properties.
+     *
+     * @param apiUrl the api URL
+     * @since 5422
+     */
+    public void setApiUrl(String apiUrl) {
+        this.apiUrl = apiUrl;
+        if (cbUseDefaults.isSelected()) {
+            resetToDefaultSettings();
+        }
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java	(revision 5421)
+++ /trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java	(revision 5422)
@@ -54,4 +54,5 @@
  * automatic process.
  *
+ * @since 2746
  */
 public class FullyAutomaticAuthorizationUI extends AbstractAuthorizationUI {
@@ -306,5 +307,11 @@
     }
 
-    public FullyAutomaticAuthorizationUI() {
+    /**
+     * Constructs a new {@code FullyAutomaticAuthorizationUI} for the given API URL.
+     * @param apiUrl The OSM API URL
+     * @since 5422
+     */
+    public FullyAutomaticAuthorizationUI(String apiUrl) {
+        super(apiUrl);
         build();
     }
Index: /trunk/src/org/openstreetmap/josm/gui/oauth/ManualAuthorizationUI.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/oauth/ManualAuthorizationUI.java	(revision 5421)
+++ /trunk/src/org/openstreetmap/josm/gui/oauth/ManualAuthorizationUI.java	(revision 5422)
@@ -33,4 +33,10 @@
 import org.openstreetmap.josm.tools.ImageProvider;
 
+/**
+ * This is an UI which supports a JOSM user to get an OAuth Access Token in a fully
+ * manual process.
+ *
+ * @since 2746
+ */
 public class ManualAuthorizationUI extends AbstractAuthorizationUI{
 
@@ -54,5 +60,5 @@
         gc.gridwidth = 2;
         gc.insets = new Insets(0,0,5,0);
-        pnlMessage= new HtmlPanel();
+        pnlMessage = new HtmlPanel();
         pnlMessage.setText("<html><body>"
                 + tr("Please enter an OAuth Access Token which is authorized to access the OSM server "
@@ -137,10 +143,12 @@
     public void setApiUrl(String apiUrl) {
         super.setApiUrl(apiUrl);
-        pnlMessage.setText(tr("<html><body>"
-                + "Please enter an OAuth Access Token which is authorized to access the OSM server "
-                + "''{0}''."
-                + "</body></html>",
-                getApiUrl()
-        ));
+        if (pnlMessage != null) { 
+            pnlMessage.setText(tr("<html><body>"
+                    + "Please enter an OAuth Access Token which is authorized to access the OSM server "
+                    + "''{0}''."
+                    + "</body></html>",
+                    getApiUrl()
+            ));
+        }
     }
 
@@ -152,5 +160,11 @@
     }
 
-    public ManualAuthorizationUI() {
+    /**
+     * Constructs a new {@code ManualAuthorizationUI} for the given API URL.
+     * @param apiUrl The OSM API URL
+     * @since 5422
+     */
+    public ManualAuthorizationUI(String apiUrl) {
+        super(apiUrl);
         build();
     }
Index: /trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java	(revision 5421)
+++ /trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java	(revision 5422)
@@ -37,4 +37,6 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.CustomConfigurator;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.oauth.OAuthParameters;
 import org.openstreetmap.josm.data.oauth.OAuthToken;
@@ -56,5 +58,5 @@
     private HtmlPanel pnlMessage;
     private boolean canceled;
-    private String apiUrl;
+    private final String apiUrl;
 
     private AuthorizationProcedureComboBox cbAuthorisationProcedure;
@@ -163,12 +165,9 @@
         getContentPane().add(buildHeaderInfoPanel(), BorderLayout.NORTH);
 
-        pnlFullyAutomaticAuthorisationUI = new FullyAutomaticAuthorizationUI();
-        pnlFullyAutomaticAuthorisationUI.setApiUrl(apiUrl);
-
-        pnlSemiAutomaticAuthorisationUI = new SemiAutomaticAuthorizationUI();
-        pnlSemiAutomaticAuthorisationUI.setApiUrl(apiUrl);
-
-        pnlManualAuthorisationUI = new ManualAuthorizationUI();
-        pnlManualAuthorisationUI.setApiUrl(apiUrl);
+        setTitle(tr("Get an Access Token for ''{0}''", apiUrl));
+
+        pnlFullyAutomaticAuthorisationUI = new FullyAutomaticAuthorizationUI(apiUrl);
+        pnlSemiAutomaticAuthorisationUI = new SemiAutomaticAuthorizationUI(apiUrl);
+        pnlManualAuthorisationUI = new ManualAuthorizationUI(apiUrl);
 
         spAuthorisationProcedureUI = new JScrollPane(new JPanel());
@@ -208,8 +207,5 @@
      */
     public OAuthAuthorizationWizard(String apiUrl) throws IllegalArgumentException {
-        super(JOptionPane.getFrameForComponent(Main.parent), ModalityType.DOCUMENT_MODAL);
-        CheckParameterUtil.ensureParameterNotNull(apiUrl, "apiUrl");
-        build();
-        setApiUrl(apiUrl);
+        this(Main.parent, apiUrl);
     }
 
@@ -224,28 +220,6 @@
         super(JOptionPane.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL);
         CheckParameterUtil.ensureParameterNotNull(apiUrl, "apiUrl");
+        this.apiUrl = apiUrl;
         build();
-        setApiUrl(apiUrl);
-    }
-
-    /**
-     * Sets the API URL for the API for which this wizard is generating
-     * an Access Token.
-     *
-     * @param apiUrl the API URL. Must not be null.
-     * @throws IllegalArgumentException thrown if apiUrl is null
-     */
-    public void setApiUrl(String apiUrl) throws IllegalArgumentException{
-        CheckParameterUtil.ensureParameterNotNull(apiUrl, "apiUrl");
-        this.apiUrl = apiUrl;
-        setTitle(tr("Get an Access Token for ''{0}''", apiUrl));
-        if (pnlFullyAutomaticAuthorisationUI != null) {
-            pnlFullyAutomaticAuthorisationUI.setApiUrl(apiUrl);
-        }
-        if (pnlSemiAutomaticAuthorisationUI != null) {
-            pnlSemiAutomaticAuthorisationUI.setApiUrl(apiUrl);
-        }
-        if (pnlManualAuthorisationUI != null) {
-            pnlManualAuthorisationUI.setApiUrl(apiUrl);
-        }
     }
 
@@ -302,7 +276,10 @@
      */
     public void initFromPreferences() {
-        pnlFullyAutomaticAuthorisationUI.initFromPreferences(Main.pref);
-        pnlSemiAutomaticAuthorisationUI.initFromPreferences(Main.pref);
-        pnlManualAuthorisationUI.initFromPreferences(Main.pref);
+        // Copy current JOSM preferences to update API url with the one used in this wizard
+        Preferences copyPref = CustomConfigurator.clonePreferences(Main.pref);
+        copyPref.put("osm-server-url", apiUrl);
+        pnlFullyAutomaticAuthorisationUI.initFromPreferences(copyPref);
+        pnlSemiAutomaticAuthorisationUI.initFromPreferences(copyPref);
+        pnlManualAuthorisationUI.initFromPreferences(copyPref);
     }
 
@@ -388,6 +365,5 @@
         public void hyperlinkUpdate(HyperlinkEvent e) {
             if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
-                String url = e.getDescription();
-                OpenBrowser.displayUrl(url);
+                OpenBrowser.displayUrl(e.getDescription());
             }
         }
Index: /trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java	(revision 5421)
+++ /trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java	(revision 5422)
@@ -39,8 +39,12 @@
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 
+/**
+ * An OAuth 1.0 authorization client. 
+ * @since 2746
+ */
 public class OsmOAuthAuthorizationClient {
-    private OAuthParameters oauthProviderParameters;
-    private OAuthConsumer consumer;
-    private OAuthProvider provider;
+    private final OAuthParameters oauthProviderParameters;
+    private final OAuthConsumer consumer;
+    private final OAuthProvider provider;
     private boolean canceled;
     private HttpURLConnection connection;
@@ -57,5 +61,5 @@
      */
     public OsmOAuthAuthorizationClient() {
-        oauthProviderParameters = OAuthParameters.createDefault();
+        oauthProviderParameters = OAuthParameters.createDefault(Main.pref.get("osm-server.url"));
         consumer = oauthProviderParameters.buildConsumer();
         provider = oauthProviderParameters.buildProvider(consumer);
@@ -66,5 +70,5 @@
      *
      * @param parameters the OAuth parameters. Must not be null.
-     * @throws IllegalArgumentException thrown if parameters is null
+     * @throws IllegalArgumentException if parameters is null
      */
     public OsmOAuthAuthorizationClient(OAuthParameters parameters) throws IllegalArgumentException {
@@ -81,6 +85,6 @@
      * @param parameters the OAuth parameters. Must not be null.
      * @param requestToken the request token. Must not be null.
-     * @throws IllegalArgumentException thrown if parameters is null
-     * @throws IllegalArgumentException thrown if requestToken is null
+     * @throws IllegalArgumentException if parameters is null
+     * @throws IllegalArgumentException if requestToken is null
      */
     public OsmOAuthAuthorizationClient(OAuthParameters parameters, OAuthToken requestToken) throws IllegalArgumentException {
@@ -92,4 +96,7 @@
     }
 
+    /**
+     * Cancels the current OAuth operation.
+     */
     public void cancel() {
         DefaultOAuthProvider p  = (DefaultOAuthProvider)provider;
@@ -127,5 +134,6 @@
      * @param monitor a progress monitor. Defaults to {@link NullProgressMonitor#INSTANCE} if null
      * @return the OAuth Request Token
-     * @throws OsmOAuthAuthorizationException thrown if something goes wrong when retrieving the request token
+     * @throws OsmOAuthAuthorizationException if something goes wrong when retrieving the request token
+     * @throws OsmTransferCanceledException if the user canceled the request
      */
     public OAuthToken getRequestToken(ProgressMonitor monitor) throws OsmOAuthAuthorizationException, OsmTransferCanceledException {
@@ -159,5 +167,6 @@
      * @param monitor a progress monitor. Defaults to {@link NullProgressMonitor#INSTANCE} if null
      * @return the OAuth Access Token
-     * @throws OsmOAuthAuthorizationException thrown if something goes wrong when retrieving the request token
+     * @throws OsmOAuthAuthorizationException if something goes wrong when retrieving the request token
+     * @throws OsmTransferCanceledException if the user canceled the request
      * @see #getRequestToken(ProgressMonitor)
      */
@@ -273,5 +282,5 @@
      *
      * @return the OSM login URL
-     * @throws OsmOAuthAuthorizationException thrown if something went wrong, in particular if the
+     * @throws OsmOAuthAuthorizationException if something went wrong, in particular if the
      * URLs are malformed
      */
@@ -290,5 +299,5 @@
      *
      * @return the OSM logout URL
-     * @throws OsmOAuthAuthorizationException thrown if something went wrong, in particular if the
+     * @throws OsmOAuthAuthorizationException if something went wrong, in particular if the
      * URLs are malformed
      */
@@ -308,5 +317,5 @@
      *
      * @return the session ID structure
-     * @throws OsmOAuthAuthorizationException thrown if something went wrong
+     * @throws OsmOAuthAuthorizationException if something went wrong
      */
     protected SessionId fetchOsmWebsiteSessionId() throws OsmOAuthAuthorizationException {
@@ -340,5 +349,5 @@
      * a hidden parameter.
      *
-     * @throws OsmOAuthAuthorizationException thrown if something went wrong
+     * @throws OsmOAuthAuthorizationException if something went wrong
      */
     protected void fetchOAuthToken(SessionId sessionId, OAuthToken requestToken) throws OsmOAuthAuthorizationException {
@@ -526,10 +535,10 @@
      * @param privileges the set of privileges. Must not be null.
      * @param monitor a progress monitor. Defaults to {@link NullProgressMonitor#INSTANCE} if null
-     * @throws IllegalArgumentException thrown if requestToken is null
-     * @throws IllegalArgumentException thrown if osmUserName is null
-     * @throws IllegalArgumentException thrown if osmPassword is null
-     * @throws IllegalArgumentException thrown if privileges is null
-     * @throws OsmOAuthAuthorizationException thrown if the authorisation fails
-     * @throws OsmTransferCanceledException thrown if the task is canceled by the user
+     * @throws IllegalArgumentException if requestToken is null
+     * @throws IllegalArgumentException if osmUserName is null
+     * @throws IllegalArgumentException if osmPassword is null
+     * @throws IllegalArgumentException if privileges is null
+     * @throws OsmOAuthAuthorizationException if the authorisation fails
+     * @throws OsmTransferCanceledException if the task is canceled by the user
      */
     public void authorise(OAuthToken requestToken, String osmUserName, String osmPassword, OsmPrivileges privileges, ProgressMonitor monitor) throws IllegalArgumentException, OsmOAuthAuthorizationException, OsmTransferCanceledException{
Index: /trunk/src/org/openstreetmap/josm/gui/oauth/SemiAutomaticAuthorizationUI.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/oauth/SemiAutomaticAuthorizationUI.java	(revision 5421)
+++ /trunk/src/org/openstreetmap/josm/gui/oauth/SemiAutomaticAuthorizationUI.java	(revision 5422)
@@ -37,4 +37,6 @@
  * In contrast to the fully-automatic procedure the user is dispatched to an
  * external browser for login and authorisation.
+ * 
+ * @since 2746
  */
 public class SemiAutomaticAuthorizationUI extends AbstractAuthorizationUI {
@@ -58,5 +60,11 @@
     }
 
-    public SemiAutomaticAuthorizationUI() {
+    /**
+     * Constructs a new {@code SemiAutomaticAuthorizationUI} for the given API URL.
+     * @param apiUrl The OSM API URL
+     * @since 5422
+     */
+    public SemiAutomaticAuthorizationUI(String apiUrl) {
+        super(apiUrl);
         build();
     }
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java	(revision 5421)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java	(revision 5422)
@@ -40,5 +40,5 @@
  * user already has an Access Token.
  *
- * For initial authorisation see {@link OAuthAuthorisationWizard}.
+ * For initial authorisation see {@link OAuthAuthorizationWizard}.
  *
  */
@@ -145,6 +145,12 @@
     }
 
+    /**
+     * Sets the URL of the OSM API for which this panel is currently displaying OAuth properties.
+     *
+     * @param apiUrl the api URL
+     */
     public void setApiUrl(String apiUrl) {
         this.apiUrl = apiUrl;
+        pnlAdvancedProperties.setApiUrl(apiUrl);
     }
 
@@ -372,5 +378,5 @@
         if (! evt.getPropertyName().equals(OsmApiUrlInputPanel.API_URL_PROP))
             return;
-        apiUrl = (String)evt.getNewValue();
+        setApiUrl((String)evt.getNewValue());
     }
 }
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java	(revision 5421)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java	(revision 5422)
@@ -38,5 +38,4 @@
     static public final String API_URL_PROP = OsmApiUrlInputPanel.class.getName() + ".apiUrl";
 
-    static public final String defaulturl = "http://api.openstreetmap.org/api";
     private JLabel lblValid;
     private JLabel lblApiUrl;
@@ -61,5 +60,5 @@
         gc.gridx = 1;
         gc.weightx = 1.0;
-        JLabel lbl = new JLabel(tr("<html>Use the default OSM server URL (<strong>{0}</strong>)</html>", defaulturl));
+        JLabel lbl = new JLabel(tr("<html>Use the default OSM server URL (<strong>{0}</strong>)</html>", OsmApi.DEFAULT_API_URL));
         lbl.setFont(lbl.getFont().deriveFont(Font.PLAIN));
         pnl.add(lbl, gc);
@@ -122,8 +121,8 @@
         if (url == null) {
             cbUseDefaultServerUrl.setSelected(true);
-            firePropertyChange(API_URL_PROP, null, defaulturl);
-        } else if (url.trim().equals(defaulturl)) {
+            firePropertyChange(API_URL_PROP, null, OsmApi.DEFAULT_API_URL);
+        } else if (url.trim().equals(OsmApi.DEFAULT_API_URL)) {
             cbUseDefaultServerUrl.setSelected(true);
-            firePropertyChange(API_URL_PROP, null, defaulturl);
+            firePropertyChange(API_URL_PROP, null, OsmApi.DEFAULT_API_URL);
         } else {
             cbUseDefaultServerUrl.setSelected(false);
@@ -140,5 +139,5 @@
         if (cbUseDefaultServerUrl.isSelected()) {
             Main.pref.put("osm-server.url", null);
-        } else if (tfOsmServerUrl.getText().trim().equals(defaulturl)) {
+        } else if (tfOsmServerUrl.getText().trim().equals(OsmApi.DEFAULT_API_URL)) {
             Main.pref.put("osm-server.url", null);
         } else {
@@ -264,5 +263,5 @@
             case ItemEvent.SELECTED:
                 setApiUrlInputEnabled(false);
-                firePropertyChange(API_URL_PROP, null, defaulturl);
+                firePropertyChange(API_URL_PROP, null, OsmApi.DEFAULT_API_URL);
                 break;
             case ItemEvent.DESELECTED:
Index: /trunk/src/org/openstreetmap/josm/io/OsmApi.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 5421)
+++ /trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 5422)
@@ -61,6 +61,13 @@
      * <a href="http://wiki.openstreetmap.org/wiki/API_usage_policy#Technical_Usage_Requirements">
      * OSM API usage policy.</a>
+     * @since 5386
      */
     static public final int MAX_DOWNLOAD_THREADS = 2;
+    
+    /**
+     * Default URL of the standard OSM API. 
+     * @since 5422
+     */
+    static public final String DEFAULT_API_URL = "http://api.openstreetmap.org/api";
 
     // The collection of instantiated OSM APIs
@@ -92,5 +99,5 @@
      */
     static public OsmApi getOsmApi() {
-        String serverUrl = Main.pref.get("osm-server.url", "http://api.openstreetmap.org/api");
+        String serverUrl = Main.pref.get("osm-server.url", DEFAULT_API_URL);
         if (serverUrl == null)
             throw new IllegalStateException(tr("Preference ''{0}'' missing. Cannot initialize OsmApi.", "osm-server.url"));
Index: /trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java	(revision 5421)
+++ /trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java	(revision 5422)
@@ -52,5 +52,5 @@
                 "<html>Failed to initialize communication with the OSM server {0}.<br>"
                 + "Check the server URL in your preferences and your internet connection.", Main.pref.get(
-                        "osm-server.url", "http://api.openstreetmap.org/api"));
+                        "osm-server.url", OsmApi.DEFAULT_API_URL));
         return msg;
     }
@@ -70,5 +70,5 @@
                 + "Please open the Preferences Dialog and generate or enter an Access Token."
                 + "</html>",
-                Main.pref.get("osm-server.url", "http://api.openstreetmap.org/api")
+                Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL)
         );
         return msg;
