Checks for null uri to avoid NPE
fixes gh-1051
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user