Skip to content

Commit 9bb8b29

Browse files
committed
Added check for missing url
1 parent 1a25ace commit 9bb8b29

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

client/src/main/java/io/split/client/dtos/ProxyConfiguration.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public ProxyConfiguration.Builder url(URL url) throws MalformedURLException {
4444
try {
4545
_proxyHost = new HttpHost(url.getProtocol(), url.getHost(), url.getPort());
4646
} catch (Exception exc) {
47-
throw new MalformedURLException("roxy configuration is ignored. The proxy `url` was not provided or is malformed");
47+
throw new MalformedURLException("Proxy configuration is invalid. The proxy `url` is malformed");
4848
}
4949
return this;
5050
}
@@ -56,6 +56,9 @@ public ProxyConfiguration.Builder mtls(String p12File, String passKey) {
5656
}
5757

5858
public ProxyConfiguration build() {
59+
if (_proxyHost == null) {
60+
throw new IllegalArgumentException("Proxy configuration is invalid. The proxy `url` was not provided");
61+
}
5962
return new ProxyConfiguration(_proxyHost, _provider, _p12File, _passKey);
6063
}
6164
}

client/src/test/java/io/split/client/SplitClientConfigTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,14 @@ public void cannotUseInvalidUrl() throws MalformedURLException {
333333
.build();
334334
}
335335

336+
@Test(expected = IllegalArgumentException.class)
337+
public void mustUseUrl() throws MalformedURLException {
338+
SplitClientConfig.builder()
339+
.proxyConfiguration(new ProxyConfiguration.Builder()
340+
.build())
341+
.build();
342+
}
343+
336344
@Test(expected = IllegalArgumentException.class)
337345
public void mustUseP12FileWithProxyMtls() throws MalformedURLException {
338346
SplitClientConfig.builder()

0 commit comments

Comments
 (0)