Index: trunk/src/org/openstreetmap/josm/Main.java
===================================================================
--- trunk/src/org/openstreetmap/josm/Main.java	(revision 7474)
+++ trunk/src/org/openstreetmap/josm/Main.java	(revision 7476)
@@ -548,22 +548,18 @@
         List<Callable<Void>> tasks = new ArrayList<>();
 
-        if (isOffline(OnlineResource.OSM_API)) {
-            Main.warn(tr("{0} not available (offline mode)", tr("OSM API")));
-        } else {
-            tasks.add(new InitializationTask(tr("Initializing OSM API")) {
-
-                @Override
-                public void initialize() throws Exception {
-                    // We try to establish an API connection early, so that any API
-                    // capabilities are already known to the editor instance. However
-                    // if it goes wrong that's not critical at this stage.
-                    try {
-                        OsmApi.getOsmApi().initialize(null, true);
-                    } catch (Exception e) {
-                        Main.warn(getErrorMessage(Utils.getRootCause(e)));
-                    }
+        tasks.add(new InitializationTask(tr("Initializing OSM API")) {
+
+            @Override
+            public void initialize() throws Exception {
+                // We try to establish an API connection early, so that any API
+                // capabilities are already known to the editor instance. However
+                // if it goes wrong that's not critical at this stage.
+                try {
+                    OsmApi.getOsmApi().initialize(null, true);
+                } catch (Exception e) {
+                    Main.warn(getErrorMessage(Utils.getRootCause(e)));
                 }
-            });
-        }
+            }
+        });
 
         tasks.add(new InitializationTask(tr("Initializing validator")) {
Index: trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 7474)
+++ trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 7476)
@@ -24,4 +24,5 @@
 import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.Preferences.pref;
+import org.openstreetmap.josm.io.Capabilities;
 import org.openstreetmap.josm.io.OsmApi;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
@@ -148,5 +149,5 @@
         }
     }
-    
+
     /** name of the imagery entry (gets translated by josm usually) */
     private String name;
@@ -393,11 +394,11 @@
         return true;
     }
-    
+
     /**
      * Check if this object equals another ImageryInfo with respect to the properties
      * that get written to the preference file.
-     * 
+     *
      * The field {@link #pixelPerDegree} is ignored.
-     * 
+     *
      * @param other the ImageryInfo object to compare to
      * @return true if they are equal
@@ -464,5 +465,5 @@
     }
 
-    
+
     @Override
     public int hashCode() {
@@ -679,5 +680,5 @@
     /**
      * Gets the entry id.
-     * 
+     *
      * Id can be null. This gets the configured id as is. Due to a user error,
      * this may not be unique. Use {@link ImageryLayerInfo#getUniqueId} to ensure
@@ -696,5 +697,5 @@
         this.id = id;
     }
-    
+
     public void clearId() {
         if (this.id != null) {
@@ -934,5 +935,6 @@
      */
     public boolean isBlacklisted() {
-        return OsmApi.getOsmApi().getCapabilities().isOnImageryBlacklist(this.url);
+        Capabilities capabilities = OsmApi.getOsmApi().getCapabilities();
+        return capabilities != null && capabilities.isOnImageryBlacklist(this.url);
     }
 }
Index: trunk/src/org/openstreetmap/josm/io/OsmApi.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 7474)
+++ trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 7476)
@@ -203,8 +203,4 @@
         if (initialized)
             return;
-        if (Main.isOffline(OnlineResource.OSM_API)) {
-            // At this point this is an error because all automatic or UI actions requiring OSM API should have been disabled earlier
-            throw new OfflineAccessException(tr("{0} not available (offline mode)", OnlineResource.OSM_API.getLocName()));
-        }
         cancel = false;
         try {
@@ -217,13 +213,20 @@
                 initializeCapabilities(cache.updateForceString());
             }
-            if (capabilities.supportsVersion("0.6")) {
-                version = "0.6";
-            } else {
+            if (capabilities == null) {
+                if (Main.isOffline(OnlineResource.OSM_API)) {
+                    Main.warn(tr("{0} not available (offline mode)", tr("OSM API")));
+                } else {
+                    Main.error(tr("Unable to initialize OSM API."));
+                }
+                return;
+            } else if (!capabilities.supportsVersion("0.6")) {
                 Main.error(tr("This version of JOSM is incompatible with the configured server."));
                 Main.error(tr("It supports protocol version 0.6, while the server says it supports {0} to {1}.",
                         capabilities.get("version", "minimum"), capabilities.get("version", "maximum")));
-                initialized = false; // FIXME gets overridden by next assignment
+                return;
+            } else {
+                version = "0.6";
+                initialized = true;
             }
-            initialized = true;
 
             /* This is an interim solution for openstreetmap.org not currently
@@ -233,6 +236,5 @@
              * http://trac.openstreetmap.org/ticket/5024
              * This list should not be maintained by each OSM editor (see #9210) */
-            if (this.serverUrl.matches(".*openstreetmap.org/api.*") && capabilities.getImageryBlacklist().isEmpty())
-            {
+            if (this.serverUrl.matches(".*openstreetmap.org/api.*") && capabilities.getImageryBlacklist().isEmpty()) {
                 capabilities.put("blacklist", "regex", ".*\\.google\\.com/.*");
                 capabilities.put("blacklist", "regex", ".*209\\.85\\.2\\d\\d.*");
@@ -245,5 +247,5 @@
              * situation - probably only occurs if the user changes the API URL
              * in the preferences menu. Otherwise they would not have been able
-             * to load the layers in the first place becuase they would have
+             * to load the layers in the first place because they would have
              * been disabled! */
             if (Main.isDisplayingMapView()) {
@@ -268,6 +270,8 @@
     }
 
-    private void initializeCapabilities(String xml) throws SAXException, IOException, ParserConfigurationException {
-        capabilities = CapabilitiesParser.parse(new InputSource(new StringReader(xml)));
+    private synchronized void initializeCapabilities(String xml) throws SAXException, IOException, ParserConfigurationException {
+        if (xml != null) {
+            capabilities = CapabilitiesParser.parse(new InputSource(new StringReader(xml)));
+        }
     }
 
@@ -731,5 +735,5 @@
      * @return the API capabilities, or null, if the API is not initialized yet
      */
-    public Capabilities getCapabilities() {
+    public synchronized Capabilities getCapabilities() {
         return capabilities;
     }
