Index: trunk/src/org/openstreetmap/josm/actions/ApiPreconditionChecker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/ApiPreconditionChecker.java	(revision 2034)
+++ trunk/src/org/openstreetmap/josm/actions/ApiPreconditionChecker.java	(revision 2035)
@@ -15,4 +15,5 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.ExceptionDialogUtil;
+import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
 import org.openstreetmap.josm.io.OsmApi;
 import org.openstreetmap.josm.io.OsmApiInitializationException;
@@ -24,5 +25,5 @@
         OsmApi api = OsmApi.getOsmApi();
         try {
-            api.initialize();
+            api.initialize(NullProgressMonitor.INSTANCE);
             long maxNodes = 0;
             if (api.getCapabilities().isDefined("waynodes", "maximum")) {
Index: trunk/src/org/openstreetmap/josm/actions/UploadAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 2034)
+++ trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 2035)
@@ -40,4 +40,5 @@
 import org.openstreetmap.josm.io.OsmApiException;
 import org.openstreetmap.josm.io.OsmApiInitializationException;
+import org.openstreetmap.josm.io.OsmChangesetCloseException;
 import org.openstreetmap.josm.io.OsmServerWriter;
 import org.openstreetmap.josm.tools.GBC;
@@ -343,4 +344,8 @@
         }
 
+        if (e instanceof OsmChangesetCloseException) {
+            ExceptionDialogUtil.explainOsmChangesetCloseException((OsmChangesetCloseException)e);
+            return;
+        }
         if (e instanceof OsmApiException) {
             OsmApiException ex = (OsmApiException)e;
@@ -493,5 +498,5 @@
                 );
                 dialog.setButtonIcons(new String[] {"upload.png", "cancel.png"});
-                dialog.setContent(p);
+                dialog.setContent(p, false /* no scroll pane */);
                 dialog.showDialog();
                 int result = dialog.getValue();
Index: trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java	(revision 2034)
+++ trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java	(revision 2035)
@@ -17,4 +17,5 @@
 import org.openstreetmap.josm.io.OsmApiException;
 import org.openstreetmap.josm.io.OsmApiInitializationException;
+import org.openstreetmap.josm.io.OsmChangesetCloseException;
 import org.openstreetmap.josm.io.OsmTransferException;
 
@@ -39,6 +40,26 @@
         JOptionPane.showMessageDialog(
                 Main.parent,
-                tr(   "Failed to initialize communication with the OSM server {0}.\n"
-                        + "Check the server URL in your preferences and your internet connection.",
+                tr(   "<html>Failed to initialize communication with the OSM server {0}.<br>"
+                        + "Check the server URL in your preferences and your internet connection.</html>",
+                        Main.pref.get("osm-server.url", "http://api.openstreetmap.org/api")
+                ),
+                tr("Error"),
+                JOptionPane.ERROR_MESSAGE
+        );
+    }
+
+    /**
+     * handles an exception caught during OSM API initialization
+     *
+     * @param e the exception
+     */
+    public static void explainOsmChangesetCloseException(OsmChangesetCloseException e) {
+        e.printStackTrace();
+        String changsetId = e.getChangeset() == null ? tr("unknown") : Long.toString(e.getChangeset().getId());
+        JOptionPane.showMessageDialog(
+                Main.parent,
+                tr(   "<html>Failed to close changeset ''{0}'' on the OSM server ''{1}''.<br>"
+                        + "The changeset will automatically be closed by the server after a timeout.</html>",
+                        changsetId,
                         Main.pref.get("osm-server.url", "http://api.openstreetmap.org/api")
                 ),
@@ -275,4 +296,9 @@
             return;
         }
+        if (e instanceof OsmChangesetCloseException){
+            explainOsmChangesetCloseException((OsmChangesetCloseException)e);
+            return;
+        }
+
         if (e instanceof OsmApiException) {
             OsmApiException oae = (OsmApiException)e;
Index: trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java	(revision 2034)
+++ trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java	(revision 2035)
@@ -4,4 +4,5 @@
 
 import java.awt.Component;
+import java.awt.Container;
 import java.awt.Dimension;
 import java.awt.Frame;
@@ -40,4 +41,9 @@
     private final String[] bTexts;
     private String[] bIcons;
+    /**
+     * set to true if the content of the extended dialog should
+     * be placed in a {@see JScrollPane}
+     */
+    private boolean placeContentInScrollPane;
 
     // For easy access when inherited
@@ -136,5 +142,20 @@
      */
     public void setContent(Component content) {
+        setContent(content, true);
+    }
+
+    /**
+     * Sets the content that will be displayed in the message dialog.
+     * 
+     * Note that depending on your other settings more UI elements may appear.
+     * The content is played on top of the other elements though.
+     * 
+     * @param content Any element that can be displayed in the message dialog
+     * @param placeContentInScrollPane if  true, places  the content in a JScrollPane
+     * 
+     */
+    public void setContent(Component content, boolean placeContentInScrollPane) {
         this.content = content;
+        this.placeContentInScrollPane = placeContentInScrollPane;
     }
 
@@ -149,8 +170,6 @@
      */
     public void setContent(String message) {
-        setContent(string2label(message));
-    }
-
-
+        setContent(string2label(message), true);
+    }
 
     /**
@@ -222,9 +241,11 @@
 
         cp.add(buttonsPanel, GBC.eol().anchor(GBC.CENTER).insets(5,5,5,5));
-
-        JScrollPane pane = new JScrollPane(cp);
-        pane.setBorder(null);
-        setContentPane(pane);
-
+        if (placeContentInScrollPane) {
+            JScrollPane pane = new JScrollPane(cp);
+            pane.setBorder(null);
+            setContentPane(pane);
+        } else {
+            setContentPane(cp);
+        }
         pack();
 
Index: trunk/src/org/openstreetmap/josm/io/OsmApi.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 2034)
+++ trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 2035)
@@ -157,10 +157,10 @@
      * @exception OsmApiInitializationException thrown, if an exception occurs
      */
-    public void initialize() throws OsmApiInitializationException {
+    public void initialize(ProgressMonitor monitor) throws OsmApiInitializationException {
         if (initialized)
             return;
         initAuthentication();
         try {
-            String s = sendRequest("GET", "capabilities", null);
+            String s = sendRequest("GET", "capabilities", null,monitor);
             InputSource inputSource = new InputSource(new StringReader(s));
             SAXParserFactory.newInstance().newSAXParser().parse(inputSource, new CapabilitiesParser());
@@ -227,9 +227,9 @@
      * @throws OsmTransferException if something goes wrong
      */
-    public void createPrimitive(OsmPrimitive osm) throws OsmTransferException {
-        initialize();
+    public void createPrimitive(OsmPrimitive osm, ProgressMonitor monitor) throws OsmTransferException {
+        initialize(monitor);
         String ret = "";
         try {
-            ret = sendRequest("PUT", OsmPrimitiveType.from(osm).getAPIName()+"/create", toXml(osm, true));
+            ret = sendRequest("PUT", OsmPrimitiveType.from(osm).getAPIName()+"/create", toXml(osm, true),monitor);
             osm.id = Long.parseLong(ret.trim());
             osm.version = 1;
@@ -247,14 +247,14 @@
      * @throws OsmTransferException if something goes wrong
      */
-    public void modifyPrimitive(OsmPrimitive osm) throws OsmTransferException {
-        initialize();
+    public void modifyPrimitive(OsmPrimitive osm, ProgressMonitor monitor) throws OsmTransferException {
+        initialize(monitor);
         if (version.equals("0.5")) {
             // legacy mode does not return the new object version.
-            sendRequest("PUT", OsmPrimitiveType.from(osm).getAPIName()+"/" + osm.getId(), toXml(osm, true));
+            sendRequest("PUT", OsmPrimitiveType.from(osm).getAPIName()+"/" + osm.getId(), toXml(osm, true),monitor);
         } else {
             String ret = null;
             // normal mode (0.6 and up) returns new object version.
             try {
-                ret = sendRequest("PUT", OsmPrimitiveType.from(osm).getAPIName()+"/" + osm.getId(), toXml(osm, true));
+                ret = sendRequest("PUT", OsmPrimitiveType.from(osm).getAPIName()+"/" + osm.getId(), toXml(osm, true), monitor);
                 osm.version = Integer.parseInt(ret.trim());
             } catch(NumberFormatException e) {
@@ -270,5 +270,5 @@
      */
     public void deletePrimitive(OsmPrimitive osm, ProgressMonitor monitor) throws OsmTransferException {
-        initialize();
+        initialize(monitor);
         // can't use a the individual DELETE method in the 0.6 API. Java doesn't allow
         // submitting a DELETE request with content, the 0.6 API requires it, however. Falling back
@@ -291,5 +291,5 @@
             changeset.put("created_by", (ua == null) ? "JOSM" : ua.toString());
             changeset.put("comment", comment);
-            createPrimitive(changeset);
+            createPrimitive(changeset, progressMonitor);
         } finally {
             progressMonitor.finishTask();
@@ -305,6 +305,6 @@
         progressMonitor.beginTask(tr("Closing changeset {0}...", changeset.getId()));
         try {
-            initialize();
-            sendRequest("PUT", "changeset" + "/" + changeset.getId() + "/close", null);
+            initialize(progressMonitor);
+            sendRequest("PUT", "changeset" + "/" + changeset.getId() + "/close", null, progressMonitor);
             changeset = null;
         } finally {
@@ -327,5 +327,5 @@
                 throw new OsmTransferException(tr("No changeset present for diff upload"));
 
-            initialize();
+            initialize(progressMonitor);
             final ArrayList<OsmPrimitive> processed = new ArrayList<OsmPrimitive>();
 
@@ -341,5 +341,5 @@
             String diff = duv.getDocument();
             try {
-                String diffresult = sendRequest("POST", "changeset/" + changeset.getId() + "/upload", diff);
+                String diffresult = sendRequest("POST", "changeset/" + changeset.getId() + "/upload", diff,progressMonitor);
                 DiffResultReader.parseDiffResult(diffresult, list, processed, duv.getNewIdMap(),
                         progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
@@ -358,7 +358,10 @@
 
 
-    private void sleepAndListen() throws OsmTransferCancelledException {
+    private void sleepAndListen(int retry, ProgressMonitor monitor) throws OsmTransferCancelledException {
         System.out.print(tr("Waiting 10 seconds ... "));
         for(int i=0; i < 10; i++) {
+            if (monitor != null) {
+                monitor.setCustomText(tr("Starting retry {0} of {1} in {2} seconds ...", getMaxRetries() - retry,getMaxRetries(), 10-i));
+            }
             if (cancel || isAuthCancelled())
                 throw new OsmTransferCancelledException();
@@ -395,6 +398,5 @@
      *    been exhausted), or rewrapping a Java exception.
      */
-    private String sendRequest(String requestMethod, String urlSuffix,
-            String requestBody) throws OsmTransferException {
+    private String sendRequest(String requestMethod, String urlSuffix,String requestBody, ProgressMonitor monitor) throws OsmTransferException {
 
         StringBuffer responseBody = new StringBuffer();
@@ -436,7 +438,6 @@
                 if (retCode >= 500) {
                     if (retries-- > 0) {
-                        sleepAndListen();
-                        int maxRetries = getMaxRetries();
-                        System.out.println(tr("Starting retry {0} of {1}.", maxRetries - retries,maxRetries));
+                        sleepAndListen(retries, monitor);
+                        System.out.println(tr("Starting retry {0} of {1}.", getMaxRetries() - retries,getMaxRetries()));
                         continue;
                     }
Index: trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmServerReader.java	(revision 2034)
+++ trunk/src/org/openstreetmap/josm/io/OsmServerReader.java	(revision 2035)
@@ -40,5 +40,5 @@
     protected InputStream getInputStream(String urlStr, ProgressMonitor progressMonitor) throws OsmTransferException  {
         try {
-            api.initialize();
+            api.initialize(progressMonitor);
             urlStr = api.getBaseUrl() + urlStr;
             return getInputStreamRaw(urlStr, progressMonitor);
Index: trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java	(revision 2034)
+++ trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java	(revision 2035)
@@ -125,8 +125,7 @@
                 }
             } catch(Exception e) {
-                Changeset changeset = api.getCurrentChangeset();
-                String changesetId = (changeset == null ? tr("unknown") : Long.toString(changeset.getId()));
-                logger.warning(tr("Failed to close changeset {0}, will be closed by server after timeout. Exception was: {1}",
-                        changesetId, e.toString()));
+                OsmChangesetCloseException closeException = new OsmChangesetCloseException(e);
+                closeException.setChangeset(api.getCurrentChangeset());
+                throw closeException;
             }
         }
@@ -154,8 +153,7 @@
                 api.stopChangeset(progressMonitor.createSubTaskMonitor(0, false));
             } catch (Exception ee) {
-                Changeset changeset = api.getCurrentChangeset();
-                String changesetId = (changeset == null ? tr("unknown") : Long.toString(changeset.getId()));
-                logger.warning(tr("Failed to close changeset {0}, will be closed by server after timeout. Exception was: {1}",
-                        changesetId, ee.toString()));
+                OsmChangesetCloseException closeException = new OsmChangesetCloseException(ee);
+                closeException.setChangeset(api.getCurrentChangeset());
+                throw closeException;
             }
         }
@@ -171,5 +169,5 @@
         processed = new LinkedList<OsmPrimitive>();
 
-        api.initialize();
+        api.initialize(progressMonitor);
 
         try {
@@ -199,7 +197,7 @@
             api.deletePrimitive(osm, progressMonitor);
         } else if (osm.getId() == 0) {
-            api.createPrimitive(osm);
+            api.createPrimitive(osm, progressMonitor);
         } else {
-            api.modifyPrimitive(osm);
+            api.modifyPrimitive(osm,progressMonitor);
         }
     }
