Index: core/src/org/openstreetmap/josm/gui/MainApplication.java
===================================================================
--- core/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 5874)
+++ core/src/org/openstreetmap/josm/gui/MainApplication.java	(working copy)
@@ -3,15 +3,23 @@
 
 import static org.openstreetmap.josm.tools.I18n.tr;
 import static org.openstreetmap.josm.tools.I18n.trn;
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
 
 import java.awt.Image;
 import java.awt.Toolkit;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
 import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.net.Authenticator;
 import java.net.ProxySelector;
 import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+import java.net.URLStreamHandlerFactory;
 import java.security.AllPermission;
 import java.security.CodeSource;
 import java.security.PermissionCollection;
@@ -20,6 +28,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -28,9 +37,6 @@
 import javax.swing.RepaintManager;
 import javax.swing.SwingUtilities;
 
-import gnu.getopt.Getopt;
-import gnu.getopt.LongOpt;
-
 import org.jdesktop.swinghelper.debug.CheckThreadViolationRepaintManager;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.AutosaveTask;
@@ -283,6 +289,8 @@
             I18n.set(Main.pref.get("language", null));
         }
         Main.pref.updateSystemProperties();
+        
+        checkHttpUserAgent();
 
         final JFrame mainFrame = new JFrame(tr("Java OpenStreetMap Editor"));
         Main.parent = mainFrame;
@@ -421,4 +429,66 @@
             RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager());
         }
     }
+
+    private static void checkHttpUserAgent() {
+        // Check sun.net.www.protocol.http.HttpURLConnection.userAgent existence and validity.
+        // This public static final User-Agent is initialized after the value of system property "http.agent" we have set before.
+        // But, with Java Web Start, this field is initialized before JOSM main() method, and we cannot change it after
+        try {
+            Field field = Class.forName("sun.net.www.protocol.http.HttpURLConnection").getField("userAgent");
+
+            if (!field.get(null).toString().equals(Version.getInstance().getFullAgentString())) {
+            
+                // Access to internal Java handlers
+                Field handlersField = URL.class.getDeclaredField("handlers");
+                handlersField.setAccessible(true);
+                Hashtable<?,?> handlers = (Hashtable<?,?>) handlersField.get(null);
+
+                // Default protocols supported by the JVM (in package sun.net.www.protocol), except gopher (we don't care)
+                for (String protocol : new String[]{"file","ftp","http","jar","mailto","netdoc"}) {
+                    try {
+                        // Makes Java load the default handler and put it in its handlers hashtable
+                        if (protocol.equals("jar")) {
+                            new URL(protocol+":file://filename.jar!/MANIFEST.MF");
+                        } else {
+                            new URL(protocol+"://localhost");
+                        }
+                        assert handlers.get(protocol) != null;
+                    } catch (Throwable t) {
+                        // If something goes wrong for a protocol, cancel everything
+                        System.err.println(protocol + ": " + t.getMessage());
+                        return;
+                    }
+                }
+                
+                final Map<?,?> javaHandlers = new HashMap<Object, Object>(handlers);
+                
+                // Set our own URL stream handler factory
+                URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory() {
+                    private final URLStreamHandler javaHttpHandler = (URLStreamHandler) javaHandlers.get("http");
+                    private final URLStreamHandler josmHttpHandler = new URLStreamHandler() {
+                        @Override protected URLConnection openConnection(URL url) throws IOException {
+                            try {
+                                Method open = URLStreamHandler.class.getDeclaredMethod("openConnection", URL.class);
+                                open.setAccessible(true);
+                                return Utils.setupURLConnection((URLConnection) open.invoke(javaHttpHandler, url));
+                            } catch (Exception e) {
+                                throw new IOException(e);
+                            }
+                        }
+                    };
+                    @Override
+                    public URLStreamHandler createURLStreamHandler(String protocol) {
+                        if (protocol.equals("http")) {
+                            return josmHttpHandler;
+                        } else {
+                            return (URLStreamHandler) javaHandlers.get(protocol);
+                        }
+                    }
+                });
+            }
+        } catch (Throwable t) {
+            t.printStackTrace();
+        }
+    }
 }
Index: core/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- core/src/org/openstreetmap/josm/tools/Utils.java	(revision 5874)
+++ core/src/org/openstreetmap/josm/tools/Utils.java	(working copy)
@@ -585,11 +585,22 @@
      * @since 5867
      */
     public static InputStream openURL(URL url) throws IOException {
-        URLConnection connection = url.openConnection();
-        connection.setRequestProperty("User-Agent", Version.getInstance().getFullAgentString());
-        connection.setConnectTimeout(Main.pref.getInteger("socket.timeout.connect",15)*1000);
-        connection.setReadTimeout(Main.pref.getInteger("socket.timeout.read",30)*1000);
-        return connection.getInputStream();
+        return setupURLConnection(url.openConnection()).getInputStream();
+    }
+
+    /***
+     * Setups the given URL connection to match JOSM needs by setting its User-Agent and timeout properties.
+     * @param connection The connection to setup
+     * @return {@code connection}, with updated properties
+     * @since
+     */
+    public static URLConnection setupURLConnection(URLConnection connection) {
+        if (connection != null) {
+            connection.setRequestProperty("User-Agent", Version.getInstance().getFullAgentString());
+            connection.setConnectTimeout(Main.pref.getInteger("socket.timeout.connect",15)*1000);
+            connection.setReadTimeout(Main.pref.getInteger("socket.timeout.read",30)*1000);
+        }
+        return connection;
     }
 
     /**
