diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java index 6a43c0f96..7cb2bf6c8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java @@ -189,7 +189,8 @@ public static int response(final HttpConnection c) throws IOException { try { return c.getResponseCode(); } catch (ConnectException ce) { - final String host = c.getURL().getHost(); + final URL url = c.getURL(); + final String host = (url == null) ? "" : url.getHost(); // The standard J2SE error message is not very useful. // if ("Connection timed out: connect".equals(ce.getMessage())) //$NON-NLS-1$ @@ -216,7 +217,8 @@ public static int response(final java.net.HttpURLConnection c) try { return c.getResponseCode(); } catch (ConnectException ce) { - final String host = c.getURL().getHost(); + final URL url = c.getURL(); + final String host = (url == null) ? "" : url.getHost(); // The standard J2SE error message is not very useful. // if ("Connection timed out: connect".equals(ce.getMessage())) //$NON-NLS-1$