Index: /trunk/src/org/openstreetmap/josm/actions/UploadAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 1690)
+++ /trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 1691)
@@ -79,4 +79,9 @@
         super(tr("Upload to OSM..."), "upload", tr("Upload all changes to the OSM server."),
                 Shortcut.registerShortcut("file:upload", tr("File: {0}", tr("Upload to OSM...")), KeyEvent.VK_U, Shortcut.GROUPS_ALT1+Shortcut.GROUP_HOTKEY), true);
+
+        /**
+         * Checks server capabilities before upload.
+         */
+        uploadHooks.add(new ApiPreconditionChecker());
 
         /**
Index: /trunk/src/org/openstreetmap/josm/io/Capabilities.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/Capabilities.java	(revision 1690)
+++ /trunk/src/org/openstreetmap/josm/io/Capabilities.java	(revision 1691)
@@ -15,5 +15,5 @@
     }
 
-    public boolean isDefind(String element, String attribute) {
+    public boolean isDefined(String element, String attribute) {
         if (! capabilities.containsKey(element)) return false;
         HashMap<String, String> e = capabilities.get(element);
@@ -29,5 +29,14 @@
     }
 
-    public Double getDouble(String element, String attribute) {
+    /**
+     * replies the value of configuration item in the capabilities as
+     * double value
+     * 
+     * @param element  the name of the element
+     * @param attribute the name of the attribute
+     * @return the value; null, if the respective configuration item doesn't exist
+     * @throws NumberFormatException  if the value is not a valid double
+     */
+    public Double getDouble(String element, String attribute) throws NumberFormatException {
         String s = get(element, attribute);
         if (s == null) return null;
Index: /trunk/src/org/openstreetmap/josm/io/OsmApi.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 1690)
+++ /trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 1691)
@@ -327,6 +327,6 @@
 
         String diff = duv.getDocument();
-        String diffresult = sendRequest("POST", "changeset/" + changeset.id + "/upload", diff);
         try {
+            String diffresult = sendRequest("POST", "changeset/" + changeset.id + "/upload", diff);
             DiffResultReader.parseDiffResult(diffresult, list, processed, duv.getNewIdMap(), Main.pleaseWaitDlg);
         } catch(Exception e) {
@@ -496,3 +496,12 @@
         );
     }
+
+    /**
+     * returns the API capabilities; null, if the API is not initialized yet
+     * 
+     * @return the API capabilities
+     */
+    public Capabilities getCapabilities() {
+        return capabilities;
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java	(revision 1690)
+++ /trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java	(revision 1691)
@@ -112,4 +112,5 @@
                     }
                 } catch (Exception ee) {
+                    ee.printStackTrace();
                     // ignore nested exception
                 }
