瀏覽代碼

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
tags/v4.3.1.201605051710-r
Christian Halstrick 8 年之前
父節點
當前提交
ddc0e9e84a
共有 1 個檔案被更改,包括 4 行新增2 行删除
  1. 4
    2
      org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java

+ 4
- 2
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$

Loading…
取消
儲存