Index: trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java	(revision 9352)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java	(revision 9353)
@@ -162,5 +162,5 @@
      */
     public void initFromPreferences() {
-        setApiUrl(Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL).trim());
+        setApiUrl(OsmApi.getOsmApi().getServerUrl().trim());
         refreshView();
     }
Index: trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java	(revision 9352)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java	(revision 9353)
@@ -119,5 +119,5 @@
      */
     public void initFromPreferences() {
-        String url =  Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL);
+        String url =  OsmApi.getOsmApi().getServerUrl();
         if (OsmApi.DEFAULT_API_URL.equals(url.trim())) {
             cbUseDefaultServerUrl.setSelected(true);
@@ -134,5 +134,5 @@
      */
     public void saveToPreferences() {
-        String oldUrl = Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL);
+        String oldUrl = OsmApi.getOsmApi().getServerUrl();
         String hmiUrl = getStrippedApiUrl();
         if (cbUseDefaultServerUrl.isSelected()) {
@@ -143,5 +143,5 @@
             Main.pref.put("osm-server.url", hmiUrl);
         }
-        String newUrl = Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL);
+        String newUrl = OsmApi.getOsmApi().getServerUrl();
 
         // When API URL changes, re-initialize API connection so we may adjust
Index: trunk/src/org/openstreetmap/josm/io/CachedFile.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/CachedFile.java	(revision 9352)
+++ trunk/src/org/openstreetmap/josm/io/CachedFile.java	(revision 9353)
@@ -453,5 +453,5 @@
     private static void checkOfflineAccess(String urlString) {
         OnlineResource.JOSM_WEBSITE.checkOfflineAccess(urlString, Main.getJOSMWebsite());
-        OnlineResource.OSM_API.checkOfflineAccess(urlString, Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL));
+        OnlineResource.OSM_API.checkOfflineAccess(urlString, OsmApi.getOsmApi().getServerUrl());
     }
 
Index: trunk/src/org/openstreetmap/josm/io/OsmApi.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 9352)
+++ trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 9353)
@@ -340,4 +340,13 @@
 
     /**
+     * Returns the server URL
+     * @return the server URL
+     * @since 9353
+     */
+    public String getServerUrl() {
+        return serverUrl;
+    }
+
+    /**
      * Creates an OSM primitive on the server. The OsmPrimitive object passed in
      * is modified by giving it the server-assigned id.
Index: trunk/src/org/openstreetmap/josm/io/OsmConnection.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmConnection.java	(revision 9352)
+++ trunk/src/org/openstreetmap/josm/io/OsmConnection.java	(revision 9353)
@@ -127,5 +127,5 @@
     protected void obtainAccessToken(final HttpClient connection) throws MissingOAuthAccessTokenException {
         try {
-            final URL apiUrl = new URL(Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL));
+            final URL apiUrl = new URL(OsmApi.getOsmApi().getServerUrl());
             if (!Objects.equals(apiUrl.getHost(), connection.getURL().getHost())) {
                 throw new MissingOAuthAccessTokenException();
Index: trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmServerReader.java	(revision 9352)
+++ trunk/src/org/openstreetmap/josm/io/OsmServerReader.java	(revision 9353)
@@ -113,5 +113,5 @@
         try {
             OnlineResource.JOSM_WEBSITE.checkOfflineAccess(urlStr, Main.getJOSMWebsite());
-            OnlineResource.OSM_API.checkOfflineAccess(urlStr, Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL));
+            OnlineResource.OSM_API.checkOfflineAccess(urlStr, OsmApi.getOsmApi().getServerUrl());
 
             URL url = null;
Index: trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java	(revision 9352)
+++ trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java	(revision 9353)
@@ -53,5 +53,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", OsmApi.DEFAULT_API_URL));
+                OsmApi.getOsmApi().getServerUrl());
     }
 
@@ -64,5 +64,5 @@
                 + "Please open the Preferences Dialog and generate or enter an Access Token."
                 + "</html>",
-                Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL)
+                OsmApi.getOsmApi().getServerUrl()
         );
     }
