Checks for null uri to avoid NPE

fixes gh-1051
This commit is contained in:
Spencer Gibb
2018-06-07 13:05:57 -04:00
parent b0433ba689
commit 20b88b5b5f
2 changed files with 7 additions and 1 deletions

View File

@@ -71,7 +71,7 @@ public class HttpClientConfigurableHttpConnectionFactory implements Configurable
}
private void addHttpClient(JGitEnvironmentProperties properties) throws GeneralSecurityException {
if (properties.getUri().startsWith("http")) {
if (properties.getUri() != null && properties.getUri().startsWith("http")) {
httpClientBuildersByUri.put(properties.getUri(), HttpClientSupport.builder(properties));
}
}

View File

@@ -32,6 +32,12 @@ public class HttpClientConfigurableHttpConnectionFactoryTest {
assertThat(actual).isNotNull();
}
@Test
public void nullPointerCheckGh1051() throws Exception {
MultipleJGitEnvironmentProperties properties = new MultipleJGitEnvironmentProperties();
connectionFactory.addConfiguration(properties);
}
@Test
public void matchingUrl() throws Exception {
String url = "http://localhost/test.git";