diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2015-12-02 13:11:20 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2015-12-16 14:08:29 +0100 |
commit | f8eee3963a5639577004d51e6fce02024323b4ae (patch) | |
tree | bbf8d9fc24f2213dc53294a56531cb1c37349f51 /org.eclipse.jgit.http.apache | |
parent | 2647d024afe7aac427ab37bba1655f2e54b257d5 (diff) | |
download | jgit-f8eee3963a5639577004d51e6fce02024323b4ae.tar.gz jgit-f8eee3963a5639577004d51e6fce02024323b4ae.zip |
Fix NPE in HttpSupport
Bug: 483366
Change-Id: I107f1b44e0e6371e3cfbd1cc18a970412e1fc679
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.http.apache')
-rw-r--r-- | org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java index d42d6f29ee..de81bf82bf 100644 --- a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java +++ b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java @@ -100,7 +100,7 @@ import org.eclipse.jgit.util.TemporaryBuffer.LocalFile; public class HttpClientConnection implements HttpConnection { HttpClient client; - String urlStr; + URL url; HttpUriRequest req; @@ -176,16 +176,19 @@ public class HttpClientConnection implements HttpConnection { /** * @param urlStr + * @throws MalformedURLException */ - public HttpClientConnection(String urlStr) { + public HttpClientConnection(String urlStr) throws MalformedURLException { this(urlStr, null); } /** * @param urlStr * @param proxy + * @throws MalformedURLException */ - public HttpClientConnection(String urlStr, Proxy proxy) { + public HttpClientConnection(String urlStr, Proxy proxy) + throws MalformedURLException { this(urlStr, proxy, null); } @@ -193,10 +196,12 @@ public class HttpClientConnection implements HttpConnection { * @param urlStr * @param proxy * @param cl + * @throws MalformedURLException */ - public HttpClientConnection(String urlStr, Proxy proxy, HttpClient cl) { + public HttpClientConnection(String urlStr, Proxy proxy, HttpClient cl) + throws MalformedURLException { this.client = cl; - this.urlStr = urlStr; + this.url = new URL(urlStr); this.proxy = proxy; } @@ -206,11 +211,7 @@ public class HttpClientConnection implements HttpConnection { } public URL getURL() { - try { - return new URL(urlStr); - } catch (MalformedURLException e) { - return null; - } + return url; } public String getResponseMessage() throws IOException { @@ -250,11 +251,11 @@ public class HttpClientConnection implements HttpConnection { public void setRequestMethod(String method) throws ProtocolException { this.method = method; if ("GET".equalsIgnoreCase(method)) //$NON-NLS-1$ - req = new HttpGet(urlStr); + req = new HttpGet(url.toString()); else if ("PUT".equalsIgnoreCase(method)) //$NON-NLS-1$ - req = new HttpPut(urlStr); + req = new HttpPut(url.toString()); else if ("POST".equalsIgnoreCase(method)) //$NON-NLS-1$ - req = new HttpPost(urlStr); + req = new HttpPost(url.toString()); else { this.method = null; throw new UnsupportedOperationException(); |