aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2016-04-27 09:47:28 +0200
committerChristian Halstrick <christian.halstrick@sap.com>2016-04-27 10:07:51 +0200
commitddc0e9e84abf88701c32c1947fe536050a0b1043 (patch)
treed2081b520bd32f27833b93a75258c0fc4298f4eb
parent22d7ec2971edf8d375c4fc9ef9d92526bad73626 (diff)
downloadjgit-ddc0e9e84abf88701c32c1947fe536050a0b1043.tar.gz
jgit-ddc0e9e84abf88701c32c1947fe536050a0b1043.zip
Fix possible NPEs when reporting transport errors
There was a bug in JGit which caused NPEs being thrown when Transport errors should be reported. Avoid the NPE to let the original error show up. Change-Id: I9e1e2b0195bd61b7e531a09d0fc7bce109bd6515
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java6
1 files changed, 4 insertions, 2 deletions
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 6a43c0f963..7cb2bf6c87 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 class HttpSupport {
try {
return c.getResponseCode();
} catch (ConnectException ce) {
- final String host = c.getURL().getHost();
+ final URL url = c.getURL();
+ final String host = (url == null) ? "<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 class HttpSupport {
try {
return c.getResponseCode();
} catch (ConnectException ce) {
- final String host = c.getURL().getHost();
+ final URL url = c.getURL();
+ final String host = (url == null) ? "<null>" : url.getHost();
// The standard J2SE error message is not very useful.
//
if ("Connection timed out: connect".equals(ce.getMessage())) //$NON-NLS-1$